/* 選擇分類-標籤外部頂部路徑列（樣式與排序視窗統一） */
.category-external-top-bar {
    position: fixed;
    z-index: 10005 !important;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 90%;
    max-width: 400px;
    height: 74px;
    padding: 0 12px;
    border-radius: 18px;
    background: var(--popup-bg);
    backdrop-filter: blur(var(--blur-val));
    -webkit-backdrop-filter: blur(var(--blur-val));
    border: 1px solid var(--glass-border);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), var(--glass-inner-highlight);
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transform: translateY(34px) scale(0.94) translateZ(0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0s, opacity 0.18s ease 0s;
    user-select: none;
    -webkit-user-select: none;
}

.category-external-top-bar.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1) translateZ(0);
    transition: transform 0.44s cubic-bezier(0.34, 1.38, 0.64, 1) 0.06s, opacity 0.24s ease 0.06s;
}

/* 選擇分類-標籤與搬移視窗外部底部操作列 */
.category-external-bottom-bar {
    position: fixed;
    z-index: 10005 !important;
    display: none;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    width: 90%;
    max-width: 400px;
    height: 112px;
    padding: 10px;
    border-radius: 18px;
    background: var(--popup-bg);
    backdrop-filter: blur(var(--blur-val));
    -webkit-backdrop-filter: blur(var(--blur-val));
    border: 1px solid var(--glass-border);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), var(--glass-inner-highlight);
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-34px) scale(0.94) translateZ(0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0s, opacity 0.18s ease 0s;
    user-select: none;
    -webkit-user-select: none;
}

.category-external-bottom-bar.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1) translateZ(0);
    transition: transform 0.44s cubic-bezier(0.34, 1.38, 0.64, 1) 0.06s, opacity 0.24s ease 0.06s;
}

.btn-add-category-item {
    background: var(--primary);
    color: #FAF6EE;
    border: 1px solid var(--primary);
    border-radius: 12px;
    flex: 1;
    width: auto;
    min-width: 0;
    height: 100%;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(154, 135, 30, 0.3), var(--glass-inner-highlight);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    outline: none !important;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
}

.btn-add-category-item:active:not(:disabled) {
    transform: scale(0.92) translateZ(0) !important;
}

.btn-add-category-item:disabled {
    background: rgba(150, 150, 150, 0.25) !important;
    color: var(--text-secondary) !important;
    border-color: var(--glass-border) !important;
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

@media (hover: hover) {
    .btn-add-category-item:hover:not(:disabled) {
        transform: scale(1.03);
    }
}

.category-bottom-right-actions {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    height: 100%;
    box-sizing: border-box;
}

.category-bottom-right-actions .btn-primary {
    width: 100%;
    flex: 1;
    height: 42px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    box-sizing: border-box;
}

.category-bottom-right-actions .btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

/* 選擇分類-標籤與搬移排序視窗（樣式與側邊欄排序視窗統一） */
#category-modal {
    z-index: 10003 !important;
    display: none;
    flex-direction: column;
    width: 90%;
    max-width: 400px;
    height: min(536px, calc(100vh - 238px));
    max-height: min(536px, calc(100vh - 238px));
    padding: 28px 24px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2), var(--glass-inner-highlight);
    box-sizing: border-box;
    background: var(--popup-bg);
    backdrop-filter: blur(var(--blur-val));
    -webkit-backdrop-filter: blur(var(--blur-val));
    border: 1px solid var(--glass-border);
    pointer-events: none;
    text-align: left;
    position: fixed;
    top: 50%;
    left: 50%;
    opacity: 0;
    transform: translate(-50%, calc(-50% + 16px)) scale(0.95);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.04s, transform 0.22s cubic-bezier(0.4, 0, 0.2, 1) 0.04s;
}

#category-modal.active {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) 0s, transform 0.42s cubic-bezier(0.34, 1.38, 0.64, 1) 0s;
}

.category-column-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 4px;
    box-sizing: border-box;
    height: 100%;
}

#same-category-warning {
    box-sizing: border-box;
    width: min(90%, 340px);
    padding: 24px;
    border-radius: 18px;
    background: var(--popup-bg);
    color: var(--text);
}

#same-category-warning::backdrop {
    background: var(--modal-overlay);
}

#same-category-warning h2 {
    margin: 0 0 10px;
}

#same-category-warning p {
    margin: 0;
    color: var(--text-secondary);
}

#same-category-warning .modal-actions {
    justify-content: flex-end;
}

/* 項目樣式：與排序視窗選框（.sort-modal-item）相同樣式 */
.category-modal-item {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    height: 70px;
    min-height: 70px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
    font-size: 16.5px;
    font-weight: 600;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-inner-highlight);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
    white-space: nowrap;
    outline: none !important;
    touch-action: pan-y;
    transform: translateZ(0);
}

.category-draft-label {
    flex: none;
    font-size: 12px;
}

.category-move-label {
    flex: none;
    font-size: 14px;
    font-weight: 600;
    color: #FAF6EE !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    letter-spacing: 0.5px;
}

.category-modal-item:active {
    transform: scale(0.92) translateZ(0) !important;
    transition: transform 0.04s ease-out !important;
}

.category-modal-item .item-icon.category-dot,
.category-inline-input-wrapper .item-icon.category-dot {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.category-modal-item .item-icon.category-dot .category-dot-circle,
.category-inline-input-wrapper .item-icon.category-dot .category-dot-circle {
    display: block;
    width: 4px;
    height: 4px;
    min-width: 4px;
    min-height: 4px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    opacity: 0.38;
    box-sizing: border-box;
    pointer-events: none;
    transform-origin: center center;
    transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.category-modal-item.active {
    background: var(--primary) !important;
    color: #FAF6EE !important;
    border-color: var(--primary) !important;
    box-shadow: var(--glass-inner-highlight) !important;
}

.category-modal-item.active .item-icon.category-dot .category-dot-circle {
    background-color: #FAF6EE !important;
    opacity: 1 !important;
    box-shadow: none !important;
}

@media (hover: hover) {
    .category-modal-item:hover:not(.active) {
        background: rgba(150, 150, 150, 0.15) !important;
        color: var(--text) !important;
        border-color: var(--glass-border) !important;
    }

    .category-modal-item:hover:not(.active) .item-icon.category-dot .category-dot-circle {
        background-color: var(--primary);
        opacity: 1;
        box-shadow: 0 0 6px var(--primary);
        transform: scale(1.2);
    }
}

.category-modal-item-text {
    flex: 1;
    min-width: 0;
    font-size: 16.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.category-empty-hint {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.6;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
    padding: 20px 10px;
    box-sizing: border-box;
}

.category-inline-input-wrapper {
    box-sizing: border-box;
    height: 70px;
    min-height: 70px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-inner-highlight);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.category-inline-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 16.5px;
    font-weight: 600;
    outline: none;
    padding: 0;
    caret-color: var(--primary);
}

