/**
 * Navbar theme picker — uses site theme tokens (themes.css).
 * Sizing: 1080p px baseline; mobile overrides at bottom.
 */

.theme-picker-nav-item {
    display: flex;
    align-items: center;
    margin-left: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 1001;
}

.theme-picker {
    position: relative;
    display: flex;
    align-items: center;
}

.theme-picker-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-picker-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.theme-picker-btn[aria-expanded="true"] {
    background: rgba(6, 135, 201, 0.15);
    border-color: rgba(6, 135, 201, 0.35);
}

.theme-picker-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.theme-picker-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 168px;
    padding: 6px;
    margin: 0;
    list-style: none;
    background: var(--bg-card, #141428);
    border: 1px solid var(--border-default, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-sm, 10px);
    box-shadow: var(--shadow-md, 0 8px 30px rgba(0, 0, 0, 0.35));
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.theme-picker-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary, #f1f5f9);
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.theme-picker-option:hover {
    background: var(--bg-card-hover, rgba(255, 255, 255, 0.06));
}

.theme-picker-option.is-active {
    background: rgba(6, 135, 201, 0.18);
    color: var(--text-primary, #f1f5f9);
    outline: 1px solid rgba(6, 135, 201, 0.45);
}

.theme-picker-swatch {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.theme-picker-swatch[data-theme="dark"] {
    background: #0a0a1a;
}

.theme-picker-swatch[data-theme="light"] {
    background: #f0f0f5;
    border-color: rgba(0, 0, 0, 0.15);
}

.theme-picker-swatch[data-theme="midnight"] {
    background: #0f172a;
}

.theme-picker-swatch[data-theme="quantum"] {
    background: linear-gradient(135deg, #1a0a25, #7c3aed);
}

html[data-theme="light"] .theme-picker-icon {
    filter: invert(1);
}

html[data-theme="light"] .theme-picker-menu {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.theme-picker-nav-item--toolbar {
    display: none;
}

@media (max-width: 767.98px) {
    .theme-picker-nav-item--desktop {
        display: none !important;
    }

    .theme-picker-nav-item--toolbar {
        display: flex;
        align-items: center;
        margin: 0 0 0 auto;
        padding: 0;
        flex-shrink: 0;
        position: relative;
    }

    .theme-picker-nav-item--toolbar .theme-picker-btn {
        width: 40px;
        height: 40px;
    }

    .theme-picker-nav-item--toolbar .theme-picker-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        width: auto;
        margin-top: 0;
        display: block;
    }

    .theme-picker-nav-item--toolbar .theme-picker-menu:not(.is-open) {
        display: none;
    }

    /* Legacy: picker still inside collapsed nav on pages without navbar-actions */
    .theme-picker-nav-item:not(.theme-picker-nav-item--desktop):not(.theme-picker-nav-item--toolbar) {
        width: 100%;
        margin: 8px 0 4px;
        padding: 0 8px;
    }

    .theme-picker-nav-item:not(.theme-picker-nav-item--desktop):not(.theme-picker-nav-item--toolbar) .theme-picker {
        width: 100%;
    }

    .theme-picker-nav-item:not(.theme-picker-nav-item--desktop):not(.theme-picker-nav-item--toolbar) .theme-picker-btn {
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
        padding: 8px 12px;
        height: auto;
    }

    .theme-picker-nav-item:not(.theme-picker-nav-item--desktop):not(.theme-picker-nav-item--toolbar) .theme-picker-btn::after {
        content: 'Theme';
        font-family: var(--font-display, 'Khand', sans-serif);
        font-size: 16px;
        color: var(--text-secondary);
        letter-spacing: 0.5px;
    }

    .theme-picker-nav-item:not(.theme-picker-nav-item--desktop):not(.theme-picker-nav-item--toolbar) .theme-picker-menu {
        position: static;
        width: 100%;
        margin-top: 6px;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--border-subtle);
    }

    .theme-picker-nav-item:not(.theme-picker-nav-item--desktop):not(.theme-picker-nav-item--toolbar) .theme-picker-menu:not(.is-open) {
        display: none;
    }
}
