/* ============================================
   THEME SWITCHER UI
   ============================================ */

/* Floating Theme Switcher Button */
.theme-switcher-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 9998;
    transition: all var(--transition-base);
    animation: pulse-subtle 3s ease-in-out infinite;
}

.theme-switcher-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.5);
}

.theme-switcher-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

@keyframes pulse-subtle {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow: 0 4px 30px rgba(102, 126, 234, 0.6);
    }
}

/* Theme Panel */
.theme-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: var(--surface-strong);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-base);
    max-width: 400px;
    scroll-behavior: smooth;
    width: calc(100vw - 60px);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    overflow-x: hidden;
}

.theme-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.theme-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.theme-panel-kicker {
    margin: 0 0 0.15rem;
    color: var(--accent-primary);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.theme-panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.theme-panel-close {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: var(--spacing-xs);
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.theme-panel-close:hover {
    color: var(--accent-primary);
}

/* Theme Grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--spacing-md);
}

/* Theme Card */
.theme-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.theme-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.theme-card.active {
    border-color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, var(--surface));
}

.theme-card.active::before {
    content: 'OK';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
}

/* Theme Preview */
.theme-preview {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
    position: relative;
    overflow: hidden;
}

/* Preview Styles for Each Theme */
.theme-preview.minimal {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
}

.theme-preview.minimal::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 20px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-preview.glassmorphism {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.theme-preview.glassmorphism::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.theme-preview.neumorphism {
    background: #e0e5ec;
}

.theme-preview.neumorphism::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 20px;
    background: #e0e5ec;
    border-radius: 12px;
    box-shadow:
        5px 5px 10px rgba(163, 177, 198, 0.6),
        -5px -5px 10px rgba(255, 255, 255, 0.5);
}

.theme-preview.cyberpunk {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a2e 100%);
    border: 1px solid #00f0ff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.theme-preview.cyberpunk::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 20px;
    background: transparent;
    border: 2px solid #00f0ff;
    border-radius: 4px;
    box-shadow:
        0 0 10px rgba(0, 240, 255, 0.5),
        inset 0 0 10px rgba(0, 240, 255, 0.2);
}

.theme-preview.brutalist {
    background: #ffffff;
    border: 3px solid #000000;
}

.theme-preview.brutalist::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 20px;
    background: #ffffff;
    border: 3px solid #000000;
    box-shadow: 4px 4px 0 #000000;
}

/* Theme Name */
.theme-name {
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    font-size: 0.875rem;
}

.theme-description {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: left;
    margin-top: 0.15rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .theme-panel {
        bottom: 100px;
        right: 15px;
        left: 15px;
        width: auto;
        max-width: none;
    }

    .theme-switcher-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Theme Transition Class */
body.theme-transitioning * {
    transition: background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease !important;
}

/* Custom scrollbar */
.theme-panel::-webkit-scrollbar {
    width: 8px;
}

.theme-panel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.theme-panel::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.theme-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}
