/* Theme Picker Styles */

/* Container */
#theme-picker-container {
    margin-bottom: 12px;
}

/* Main Picker Wrapper */
.theme-picker {
    position: relative;
}

/* Trigger Button */
.theme-picker-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-picker-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.theme-picker-btn svg {
    flex-shrink: 0;
}

.theme-picker-btn svg:first-child {
    color: var(--accent-blue);
}

.theme-picker-btn svg:last-child {
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.theme-picker-label {
    flex: 1;
    text-align: left;
}

/* Dropdown */
.theme-picker-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 -4px 20px var(--shadow-color, rgba(0, 0, 0, 0.3));
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.theme-picker-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-picker-dropdown.open + .theme-picker-btn svg:last-child {
    transform: rotate(180deg);
}

/* Header */
.theme-picker-header {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

/* Options Container */
.theme-picker-options {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
}

/* Individual Theme Option */
.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    text-align: left;
}

.theme-option:hover {
    background-color: var(--bg-tertiary);
}

.theme-option.active {
    background-color: var(--accent-blue);
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-hover) 100%);
}

.theme-option.active:hover {
    background-color: var(--accent-blue-hover);
}

/* Theme Preview Swatch */
.theme-option-preview {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 4px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.theme-option-preview-accent {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Theme Info */
.theme-option-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-option-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-option.active .theme-option-name {
    color: white;
}

/* Checkmark for Active Theme */
.theme-option-check {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Scrollbar Styling */
.theme-picker-options::-webkit-scrollbar {
    width: 6px;
}

.theme-picker-options::-webkit-scrollbar-track {
    background: transparent;
}

.theme-picker-options::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.theme-picker-options::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

/* Smooth Color Transitions */
body,
.sidebar,
.main-content,
.control-card,
.modal-content,
.dashboard-card,
.poam-table,
.nav-btn,
.filter-select,
.search-box,
input,
textarea,
select,
button {
    transition: background-color 0.3s ease,
                border-color 0.3s ease,
                color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .theme-picker-dropdown {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%) scale(0.95);
        width: calc(100vw - 32px);
        max-width: 320px;
        margin-bottom: 0;
    }

    .theme-picker-dropdown.open {
        transform: translate(-50%, -50%) scale(1);
    }

    /* Add backdrop for mobile */
    .theme-picker-dropdown::before {
        content: '';
        position: fixed;
        inset: -100vh -100vw;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .theme-picker-dropdown.open::before {
        opacity: 1;
    }
}

/* Focus States for Accessibility */
.theme-picker-btn:focus-visible,
.theme-option:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Animation for Theme Switch */
@keyframes themeSwitch {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 1; }
}

html.theme-switching * {
    animation: themeSwitch 0.3s ease;
}

/* Header Theme Picker (Compact) */
.header-theme-picker {
    position: relative;
}

.header-theme-dropdown {
    position: relative;
}

.header-theme-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.header-theme-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.header-theme-btn svg:first-child {
    color: var(--accent-blue);
}

.header-theme-btn svg:last-child {
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.header-theme-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px var(--shadow-color, rgba(0, 0, 0, 0.2));
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    z-index: 1001;
    min-width: 160px;
    padding: 4px;
}

.header-theme-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s ease;
}

.header-theme-option:hover {
    background: var(--bg-tertiary);
}

.header-theme-option.active {
    background: var(--accent-blue);
}

.header-theme-option.active:hover {
    background: var(--accent-blue-hover);
}

.header-theme-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid;
    flex-shrink: 0;
}

.header-theme-name {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.header-theme-option.active .header-theme-name {
    color: white;
}

.header-theme-check {
    font-size: 0.6875rem;
    color: white;
}

.header-theme-category {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 10px 4px;
    margin-top: 4px;
}

.header-theme-category:first-child {
    margin-top: 0;
    padding-top: 4px;
}

.header-theme-menu {
    max-height: 400px;
    overflow-y: auto;
}

.header-theme-menu::-webkit-scrollbar {
    width: 4px;
}

.header-theme-menu::-webkit-scrollbar-track {
    background: transparent;
}

.header-theme-menu::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 2px;
}

.header-theme-menu::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}
