/* =========================================
   4. COMPONENTS
   ========================================= */

/* --- Cards --- */
.glass-card, .card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl); box-shadow: var(--shadow-soft);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.3s;
}
.glass-card { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

.stat-card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl); padding: 1.5rem;
    transition: all 0.25s ease; position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; right: 0;
    width: 120px; height: 120px; border-radius: 50%;
    background: var(--accent-glow); filter: blur(50px);
    opacity: 0; transition: opacity 0.3s;
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: rgba(217,119,6,0.2); transform: translateY(-2px); }
.stat-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-subtle); color: var(--accent-light);
}
.stat-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }
.stat-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

/* --- Buttons --- */
.btn {
    font-family: var(--font-body); font-weight: 600; font-size: 0.875rem;
    border-radius: var(--radius-lg); padding: 0.55rem 1.25rem;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid transparent; letter-spacing: 0.01em;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff; border-color: transparent; box-shadow: 0 4px 14px -4px var(--accent-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-light), var(--accent-lighter));
    box-shadow: 0 6px 20px -4px var(--accent-glow); transform: translateY(-1px); color: #fff;
}
.btn-secondary { background: var(--bg-elevated); color: var(--text-secondary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-surface-hover); color: var(--text-primary); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border-color); }
.btn-ghost:hover { background: var(--accent-subtle); color: var(--accent-light); border-color: rgba(217,119,6,0.2); }
.btn-danger { background: #991b1b; color: #fecaca; border-color: transparent; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-outline-danger { background: transparent; color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.btn-outline-danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: #ef4444; }
.btn-light { background: var(--bg-elevated); color: var(--text-secondary); border-color: var(--border-color); }
.btn-light:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.btn-success { background: #166534; color: #bbf7d0; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-icon {
    width: 38px; height: 38px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px; background: var(--bg-elevated);
    border: 1px solid var(--border-color); color: var(--text-secondary);
}
.btn-icon:hover { background: var(--accent-subtle); color: var(--accent-light); border-color: rgba(217,119,6,0.2); }
.rounded-pill { border-radius: var(--radius-pill) !important; }

/* --- Forms --- */
.form-control, .form-select {
    background: var(--bg-input); border: 1px solid var(--border-color);
    color: var(--text-primary); border-radius: var(--radius-lg);
    padding: 0.6rem 1rem; font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
    background: var(--bg-input); border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow); color: var(--text-primary); outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-label { font-weight: 600; font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.form-check-input { background-color: var(--bg-input); border-color: var(--border-color); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-glow); }
.form-text { color: var(--text-muted); font-size: 0.8rem; }
.form-control-lg { padding: 0.75rem 1.15rem; font-size: 0.95rem; }

/* --- Tables --- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text-primary); --bs-table-border-color: var(--border-color); color: var(--text-primary); }
.table th { font-weight: 600; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; border-bottom: 1px solid var(--border-color); padding: 0.85rem 1.25rem; color: var(--text-muted); background: transparent; }
.table td { padding: 0.85rem 1.25rem; vertical-align: middle; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--accent-subtle); }

/* --- Badges --- */
.badge-accent { background: var(--accent-subtle); color: var(--accent-light); font-weight: 600; font-size: 0.72rem; padding: 0.3em 0.7em; border-radius: var(--radius-md); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); font-size: 0.7rem; padding: 0.25em 0.6em; border-radius: var(--radius-md); }

/* --- Modal --- */
.modal { z-index: 2050 !important; }
.modal-backdrop { z-index: 2040 !important; }
.modal-content {
    background: var(--bg-surface) !important; border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-2xl) !important; box-shadow: 0 24px 64px -16px rgba(0,0,0,0.5) !important;
    color: var(--text-primary);
}
.modal-header { border-bottom-color: var(--border-color); }
.modal-footer { border-top-color: var(--border-color); }
.btn-close { filter: invert(0.7); }
[data-bs-theme='light'] .btn-close { filter: none; }

/* --- Timeline --- */
.timeline { position: relative; padding: 0.5rem 0; }
.timeline::before { content: ''; position: absolute; top: 0; bottom: 0; left: 22px; width: 2px; background: linear-gradient(to bottom, var(--accent), var(--border-color)); border-radius: 2px; }
.timeline-item { position: relative; padding-left: 56px; margin-bottom: 1.5rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot { position: absolute; left: 22px; top: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-root); transform: translate(-50%, 16px); z-index: 2; box-shadow: 0 0 0 3px var(--accent-glow); }

/* --- Upload Drop Zone --- */
.drop-zone { border: 2px dashed var(--border-color); border-radius: var(--radius-2xl); background: var(--bg-surface); transition: all 0.25s ease; cursor: pointer; }
.drop-zone.active, .drop-zone:hover { border-color: var(--accent); background: var(--accent-subtle); }

/* --- File Card --- */
.file-card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-xl); overflow: hidden;
    transition: all 0.25s ease; position: relative;
}
.file-card:hover { border-color: rgba(217,119,6,0.25); transform: translateY(-3px); box-shadow: 0 12px 32px -8px rgba(0,0,0,0.3); }
.file-card .file-thumb { aspect-ratio: 1/1; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.file-card .file-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.file-card:hover .file-thumb img { transform: scale(1.05); }
.file-card .file-actions { display: flex; justify-content: center; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border-subtle); }
.file-action-btn { background: none; border: none; padding: 4px; color: var(--text-muted); cursor: pointer; border-radius: 6px; transition: all 0.15s; display: flex; align-items: center; justify-content: center; }
.file-action-btn:hover { color: var(--accent-light); background: var(--accent-subtle); }
.file-action-btn.danger:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* --- Toast --- */
#liveToast { border-radius: var(--radius-lg) !important; }

/* --- Nav Tabs --- */
.nav-tabs { border-bottom-color: var(--border-color); }
.nav-tabs .nav-link { color: var(--text-muted); border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 0.75rem 1rem; font-weight: 500; font-size: 0.875rem; transition: color 0.2s, border-color 0.2s; }
.nav-tabs .nav-link:hover { color: var(--text-primary); border-bottom-color: var(--border-color); }
.nav-tabs .nav-link.active { color: var(--accent-light) !important; border-bottom-color: var(--accent) !important; background: transparent !important; font-weight: 600; }

/* --- Theme Toggle Icons --- */
[data-bs-theme='dark'] .sun-icon { display: none !important; }
[data-bs-theme='dark'] .moon-icon { display: block !important; }
[data-bs-theme='light'] .sun-icon { display: block !important; }
[data-bs-theme='light'] .moon-icon { display: none !important; }

/* --- Sidebar Profile (handled in layout.css) --- */

/* --- Settings Page --- */
.settings-nav {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 1rem;
}
.settings-nav-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 0.75rem 1rem; border-radius: var(--radius-lg);
    background: transparent; border: 1px solid transparent;
    color: var(--text-secondary); cursor: pointer;
    text-align: left; width: 100%;
    transition: all 0.2s ease;
}
.settings-nav-item:hover {
    background: var(--bg-surface-hover); color: var(--text-primary);
}
.settings-nav-item.active {
    background: var(--accent-subtle); color: var(--accent-light);
    border-color: rgba(217,119,6,0.15);
}
.settings-nav-item.active i { color: var(--accent-light); }
.settings-nav-item i {
    margin-top: 2px; flex-shrink: 0; opacity: 0.6;
    transition: opacity 0.2s;
}
.settings-nav-item:hover i,
.settings-nav-item.active i { opacity: 1; }
.settings-nav-title {
    display: block; font-weight: 600; font-size: 0.875rem;
    color: inherit; line-height: 1.3;
}
.settings-nav-desc {
    display: block; font-size: 0.75rem; color: var(--text-muted);
    margin-top: 1px; font-weight: 400;
}

.settings-section {
    margin-bottom: 2rem; padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}
.settings-section:last-child {
    border-bottom: none; margin-bottom: 1rem; padding-bottom: 0;
}
.settings-section-header { margin-bottom: 1.25rem; }
.settings-section-title {
    font-weight: 700; font-size: 0.95rem; color: var(--text-primary);
    margin-bottom: 0.2rem;
}
.settings-section-desc {
    font-size: 0.8rem; color: var(--text-muted); margin: 0;
}

.settings-row {
    display: flex; align-items: flex-start; gap: 2rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border-subtle);
}
.settings-row:last-child { border-bottom: none; }
.settings-row:first-of-type { padding-top: 0; }
.settings-row-label {
    flex-shrink: 0; max-width: 240px; width: 100%;
    padding-top: 0.45rem;
}
.settings-field-title {
    display: block; font-weight: 600; font-size: 0.85rem;
    color: var(--text-primary); line-height: 1.3;
}
.settings-field-desc {
    display: block; font-size: 0.75rem; color: var(--text-muted);
    margin-top: 2px; line-height: 1.4;
}
.settings-row-control {
    flex: 1; min-width: 0;
    max-width: 420px;
}

.settings-logo-preview {
    width: 48px; height: 48px; flex-shrink: 0;
    border-radius: 10px; background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.settings-logo-preview img {
    max-width: 100%; max-height: 100%; object-fit: contain;
}

.settings-save-bar {
    position: sticky; bottom: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    margin: 2rem -1.25rem -1rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
    backdrop-filter: blur(12px);
    z-index: 10;
}

/* Settings transitions */
.settings-fade-in { animation: settingsFadeIn 0.25s ease forwards; }
.settings-fade-start { opacity: 0; transform: translateY(6px); }
.settings-fade-end { opacity: 1; transform: translateY(0); }
@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile settings */
@media (max-width: 991.98px) {
    .settings-nav {
        flex-direction: row; overflow-x: auto; gap: 6px;
        position: static; padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .settings-nav-item {
        flex-shrink: 0; white-space: nowrap; padding: 0.6rem 1rem;
    }
    .settings-nav-desc { display: none; }
    .settings-row {
        flex-direction: column; gap: 0.5rem;
    }
    .settings-row-label { max-width: 100%; padding-top: 0; }
    .settings-row-control { max-width: 100%; }
    .settings-save-bar {
        margin: 1.5rem -0.75rem -0.5rem;
        padding: 0.875rem 1rem;
        flex-direction: column; gap: 0.75rem;
    }
    .settings-save-bar .btn { width: 100%; justify-content: center; }
}

/* --- Utilities --- */
.text-accent { color: var(--accent-light) !important; }
.bg-accent-subtle { background: var(--accent-subtle) !important; }
.border-accent { border-color: var(--accent) !important; }
.cursor-pointer { cursor: pointer; }
.hover-elevate { transition: transform 0.25s ease, box-shadow 0.25s ease; }

/* --- Empty State --- */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-align: center;
    padding: 4rem 2rem; min-height: 50vh;
}
.empty-state-icon {
    position: relative;
    width: 100px; height: 100px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.empty-state-circle {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: var(--accent-subtle);
    border: 1px dashed rgba(217,119,6,0.25);
    animation: empty-pulse 3s ease-in-out infinite;
}
@keyframes empty-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.08); opacity: 1; }
}
.empty-state-title {
    font-size: 1.15rem; font-weight: 700;
    color: var(--text-primary); margin-bottom: 0.4rem;
}
.empty-state-text {
    font-size: 0.875rem; color: var(--text-muted);
    max-width: 320px; margin-bottom: 1.5rem; line-height: 1.5;
}

/* ═══════════════════════════════════════════
   UPLOAD MODAL
   ═══════════════════════════════════════════ */

/* — Dropzone — */
.upload-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg, 12px);
    background: var(--accent-subtle, rgba(217,119,6,0.04));
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 2rem;
}
.upload-dropzone:hover {
    border-color: var(--accent);
    background: rgba(217,119,6,0.07);
}
.upload-dropzone.active {
    border-color: var(--accent);
    background: rgba(217,119,6,0.1);
    box-shadow: 0 0 20px rgba(217,119,6,0.1);
}
.upload-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
}
.upload-dropzone-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-subtle, rgba(217,119,6,0.08));
    color: var(--accent);
    margin-bottom: 0.25rem;
}
.upload-dropzone-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}
.upload-dropzone-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* — Overall Progress — */
.upload-overall {
    margin-bottom: 1rem;
}
.upload-overall-bar {
    height: 5px;
    background: var(--border-color, rgba(255,255,255,0.08));
    border-radius: 999px;
    overflow: hidden;
}
.upload-overall-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #f59e0b);
    border-radius: 999px;
    transition: width 0.3s ease;
    min-width: 0;
}
.upload-overall-fill.completed {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}
.upload-overall-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* — File List — */
.upload-file-list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.upload-file-list::-webkit-scrollbar {
    width: 4px;
}
.upload-file-list::-webkit-scrollbar-track {
    background: transparent;
}
.upload-file-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 999px;
}

/* — File Item — */
.upload-file-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm, 8px);
    background: rgba(255,255,255,0.02);
    transition: all 0.2s ease;
}
.upload-file-item:hover {
    background: rgba(255,255,255,0.04);
}
.upload-file-item.is-uploading {
    background: rgba(217,119,6,0.05);
}
.upload-file-item.is-done {
    background: rgba(34,197,94,0.04);
}
.upload-file-item.is-error {
    background: rgba(239,68,68,0.05);
}

/* — File Icon — */
.upload-file-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm, 8px);
    background: var(--card-bg, rgba(255,255,255,0.03));
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

/* — File Info — */
.upload-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.upload-file-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-file-size {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* — File Status — */
.upload-file-status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
}
.upload-file-percent {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.upload-file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.upload-file-remove:hover {
    color: #ef4444;
    background: rgba(239,68,68,0.1);
}

/* — Spinner — */
.upload-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(217,119,6,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: upload-spin 0.7s linear infinite;
}
@keyframes upload-spin {
    to { transform: rotate(360deg); }
}

/* — Actions — */
.upload-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

/* ═══════════════════════════════════════════
   FOLDER COMPONENTS
   ═══════════════════════════════════════════ */

/* — Breadcrumb — */
.folder-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.9rem;
    background: var(--card-bg, rgba(255,255,255,0.03));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
}
.folder-breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm, 6px);
    transition: all 0.15s ease;
}
.folder-breadcrumb-item:hover {
    color: var(--accent);
    background: var(--accent-subtle, rgba(217,119,6,0.06));
}
.folder-breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.4;
    flex-shrink: 0;
}
.folder-breadcrumb-current {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.2rem 0.45rem;
}

/* — Folder Card — */
.folder-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: var(--card-bg, rgba(255,255,255,0.03));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl, 16px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.folder-card:hover {
    border-color: rgba(217,119,6,0.35);
    transform: translateY(-4px);
    box-shadow: 0 12px 28px -6px rgba(0,0,0,0.25), 0 0 0 1px rgba(217,119,6,0.1);
}
.folder-card-glow {
    position: absolute;
    top: -30px;
    right: -30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-glow, rgba(217,119,6,0.15));
    filter: blur(30px);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 0;
}
.folder-card:hover .folder-card-glow {
    opacity: 1;
}

/* Visual / Icon Area */
.folder-card-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem 0.75rem;
    position: relative;
    z-index: 1;
}
.folder-card-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(217,119,6,0.1), rgba(245,158,11,0.06));
    color: var(--accent);
    transition: all 0.3s ease;
    border: 1px solid rgba(217,119,6,0.1);
}
.folder-card:hover .folder-card-icon {
    background: linear-gradient(135deg, rgba(217,119,6,0.18), rgba(245,158,11,0.1));
    border-color: rgba(217,119,6,0.2);
    transform: scale(1.06);
    box-shadow: 0 4px 16px -4px rgba(217,119,6,0.25);
}

/* Body / Info */
.folder-card-body {
    padding: 0 1rem 1rem;
    text-align: center;
    position: relative;
    z-index: 1;
}
.folder-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    transition: color 0.2s;
}
.folder-card:hover .folder-card-name {
    color: var(--accent-light, #f59e0b);
}
.folder-card-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.01em;
    font-weight: 500;
}

/* Actions */
.folder-card-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 3px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 3;
}
.folder-card:hover .folder-card-actions {
    opacity: 1;
    transform: translateY(0);
}
.folder-action-btn {
    background: var(--bg-surface, rgba(0,0,0,0.4));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 5px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
.folder-action-btn:hover {
    color: var(--accent-light);
    background: var(--accent-subtle, rgba(217,119,6,0.12));
    border-color: rgba(217,119,6,0.2);
}
.folder-action-btn.danger:hover {
    color: #ef4444;
    background: rgba(239,68,68,0.12);
    border-color: rgba(239,68,68,0.2);
}

/* — Folder Card Entrance Animation — */
.folder-item {
    animation: folderSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.folder-item:nth-child(1) { animation-delay: 0s; }
.folder-item:nth-child(2) { animation-delay: 0.04s; }
.folder-item:nth-child(3) { animation-delay: 0.08s; }
.folder-item:nth-child(4) { animation-delay: 0.12s; }
.folder-item:nth-child(5) { animation-delay: 0.16s; }
.folder-item:nth-child(6) { animation-delay: 0.2s; }
.folder-item:nth-child(n+7) { animation-delay: 0.24s; }

@keyframes folderSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ═══════════════════════════════════════════
   THEME VIEW TRANSITION (Radial Spread)
   ═══════════════════════════════════════════ */
::view-transition-group(root) {
    animation-duration: 0.6s;
}
::view-transition-new(root),
::view-transition-old(root) {
    /* Prevent default crossfade animation */
    animation: none;
    mix-blend-mode: normal;
}
/* Ensure the old view stays underneath while the new view clips over it */
html.theme-transitioning::view-transition-old(root) {
    z-index: 1;
}
html.theme-transitioning::view-transition-new(root) {
    z-index: 9999;
}

/* ═══════════════════════════════════════════
   SEARCH COMMAND PALETTE
   ═══════════════════════════════════════════ */

/* — Trigger Button — */
.search-trigger-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    background: var(--bg-input, rgba(255,255,255,0.04));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.82rem;
    font-weight: 500;
    height: 38px;
    min-width: 180px;
}
.search-trigger-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--accent-subtle, rgba(217,119,6,0.06));
}
.search-trigger-label {
    flex: 1;
    text-align: left;
    opacity: 0.7;
}
.search-trigger-kbd {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    font-family: var(--font-body);
    line-height: 1.3;
}
@media (max-width: 767.98px) {
    .search-trigger-btn { min-width: auto; padding: 0.4rem 0.6rem; }
    .search-trigger-label, .search-trigger-kbd { display: none; }
}

/* — Overlay — */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: min(20vh, 140px);
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* — Palette Card — */
.search-palette {
    width: 560px;
    max-width: calc(100vw - 2rem);
    background: var(--bg-surface, #1a1a1a);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl, 20px);
    box-shadow: 0 24px 64px -16px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    overflow: hidden;
    transform: translateY(-12px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    opacity: 0;
}
.search-overlay.active .search-palette {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* — Header — */
.search-palette-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
}
.search-palette-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}
.search-palette-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-body);
    padding: 0;
}
.search-palette-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
.search-palette-esc {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 5px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s;
    line-height: 1.2;
}
.search-palette-esc:hover {
    background: rgba(255,255,255,0.1);
}

/* — Body — */
.search-palette-body {
    max-height: 360px;
    overflow-y: auto;
    padding: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.search-palette-body::-webkit-scrollbar { width: 4px; }
.search-palette-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 999px; }

/* — States — */
.search-empty, .search-loading, .search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
}

/* — Results — */
.search-result-section {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.6rem 0.75rem 0.35rem;
    opacity: 0.7;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md, 10px);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.12s ease;
    cursor: pointer;
}
.search-result-item:hover,
.search-result-item.active {
    background: var(--accent-subtle, rgba(217,119,6,0.08));
}
.search-result-item.active {
    background: rgba(217,119,6,0.1);
}

/* Icon / Thumb */
.search-result-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-elevated, rgba(255,255,255,0.04));
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}
.search-result-item.active .search-result-icon,
.search-result-item:hover .search-result-icon {
    color: var(--accent);
    border-color: rgba(217,119,6,0.2);
}
.search-result-thumb {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Info */
.search-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.search-result-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-name mark {
    background: rgba(245,158,11,0.25);
    color: var(--accent-light, #f59e0b);
    border-radius: 2px;
    padding: 0 1px;
}
.search-result-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}
.search-result-arrow {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.search-result-item.active .search-result-arrow,
.search-result-item:hover .search-result-arrow {
    opacity: 0.6;
    transform: translateX(2px);
}

/* — Footer — */
.search-palette-footer {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 0.6rem 1.1rem;
    border-top: 1px solid var(--border-color);
}
.search-palette-hint {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    opacity: 0.7;
}
.search-palette-hint kbd {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    font-family: var(--font-body);
    line-height: 1.2;
}

/* Light mode adjustments */
[data-bs-theme='light'] .search-trigger-kbd,
[data-bs-theme='light'] .search-palette-esc,
[data-bs-theme='light'] .search-palette-hint kbd {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.1);
    color: var(--text-muted);
}
[data-bs-theme='light'] .search-overlay {
    background: rgba(0,0,0,0.35);
}
[data-bs-theme='light'] .search-palette {
    box-shadow: 0 24px 64px -16px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.06);
}

/* =========================================
   SPA Page Transition Preloader
   ========================================= */

.spa-preloader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    position: relative;
    animation: spa-preloader-fadein 0.2s ease;
}

@keyframes spa-preloader-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Ambient glow behind spinner */
.spa-preloader-glow {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--accent-glow);
    filter: blur(40px);
    opacity: 0.5;
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.9); }
    50%      { opacity: 0.6; transform: scale(1.1); }
}

/* Ring spinner */
.spa-preloader-ring {
    width: 48px;
    height: 48px;
    position: relative;
    z-index: 1;
}

.spa-preloader-ring svg {
    width: 100%;
    height: 100%;
    animation: ring-spin 1.2s linear infinite;
}

.spa-preloader-ring circle {
    stroke: var(--accent);
    stroke-dasharray: 80, 200;
    stroke-dashoffset: 0;
    animation: ring-dash 1.5s ease-in-out infinite;
}

@keyframes ring-spin {
    100% { transform: rotate(360deg); }
}

@keyframes ring-dash {
    0%   { stroke-dasharray: 1, 200;  stroke-dashoffset: 0; }
    50%  { stroke-dasharray: 80, 200; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 80, 200; stroke-dashoffset: -125; }
}

/* Pulse dots */
.spa-preloader-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 1.25rem;
    position: relative;
    z-index: 1;
}
.spa-preloader-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-light);
    opacity: 0.3;
    animation: dot-pulse 1.2s ease-in-out infinite;
}
.spa-preloader-dot:nth-child(2) { animation-delay: 0.2s; }
.spa-preloader-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
    0%, 100% { opacity: 0.15; transform: scale(0.8); }
    50%      { opacity: 0.8;  transform: scale(1.3); }
}

