/* Theme System for Dashboard */

/* Theme 1: Wellness Journey (Warm & Welcoming - inspired by the design) */
[data-theme="wellness"] {
    --primary-color: #1e3d59;
    --secondary-color: #f6a192;
    --accent-color: #ff8c69;
    --background-color: #f9f5f3;
    --card-background: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --sidebar-bg: #1e3d59;
    --sidebar-text: rgba(255, 255, 255, 0.9);
    --sidebar-hover: rgba(246, 161, 146, 0.2);
    --sidebar-active: #f9f5f3;
    --button-primary: #ff8c69;
    --button-secondary: #f6a192;
    --progress-bar: #ff8c69;
    --border-color: #e8e8e8;
    --success-color: #5ab88e;
    --warning-color: #f6a192;
    --info-color: #6eb5d6;
}

/* Theme 2: Professional Blue (Corporate & Clean) */
[data-theme="professional"] {
    --primary-color: #0052cc;
    --secondary-color: #4c9aff;
    --accent-color: #0747a6;
    --background-color: #f4f5f7;
    --card-background: #ffffff;
    --text-primary: #172b4d;
    --text-secondary: #5e6c84;
    --sidebar-bg: #0052cc;
    --sidebar-text: rgba(255, 255, 255, 0.9);
    --sidebar-hover: rgba(76, 154, 255, 0.2);
    --sidebar-active: #f4f5f7;
    --button-primary: #0052cc;
    --button-secondary: #4c9aff;
    --progress-bar: #0052cc;
    --border-color: #dfe1e6;
    --success-color: #36b37e;
    --warning-color: #ffab00;
    --info-color: #4c9aff;
}

/* Theme 3: Modern Dark (Sleek & Contemporary) */
[data-theme="dark"] {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --background-color: #0f0f0f;
    --card-background: #1a1a2e;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --sidebar-bg: #16213e;
    --sidebar-text: rgba(234, 234, 234, 0.9);
    --sidebar-hover: rgba(15, 52, 96, 0.5);
    --sidebar-active: #e94560;
    --button-primary: #e94560;
    --button-secondary: #0f3460;
    --progress-bar: #e94560;
    --border-color: #2a2a3e;
    --success-color: #00d9a3;
    --warning-color: #ffb648;
    --info-color: #5b8def;
}

/* Theme 4: Original (Your current design) */
[data-theme="original"],
:root {
    --primary-color: #052d4c;
    --secondary-color: #ee7c5c;
    --accent-color: #ff6b54;
    --background-color: #f6f6f6;
    --card-background: #ffffff;
    --text-primary: #052d4c;
    --text-secondary: #999999;
    --sidebar-bg: #052d4c;
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-hover: rgba(246, 246, 246, 0.1);
    --sidebar-active: #f6f6f6;
    --button-primary: #ff6b54;
    --button-secondary: #052d4c;
    --progress-bar: #052d4c;
    --border-color: #f0f0f0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

/* Apply theme variables to elements */
body {
    background-color: var(--background-color);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

#sidebar-wrapper {
    background-color: var(--sidebar-bg) !important;
}

.list-group > a,
.has-submenu > a {
    color: var(--sidebar-text) !important;
}

.list-group > a:hover:not(.active2),
.has-submenu > a:hover:not(.active2) {
    background-color: var(--sidebar-hover) !important;
}

a.active2,
a.active2:hover {
    background-color: var(--sidebar-active) !important;
    color: var(--primary-color) !important;
}

a.active2 span {
    color: var(--primary-color) !important;
}

.card,
.program-detail-card,
.large-card,
.share-stream,
.accumulator-card {
    background-color: var(--card-background) !important;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.program-detail-card {
    border-color: var(--secondary-color) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 2px 8px rgba(238, 124, 92, 0.15);
}

[data-theme="wellness"] .program-detail-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 2px 8px rgba(246, 161, 146, 0.15);
}

[data-theme="professional"] .program-detail-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 2px 8px rgba(76, 154, 255, 0.15);
}

[data-theme="dark"] .program-detail-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 2px 8px rgba(233, 69, 96, 0.2);
}

.program-detail-card:hover {
    background-color: var(--card-background) !important;
    filter: brightness(0.98);
}

.program-detail-icon {
    color: var(--secondary-color) !important;
    background: var(--card-background) !important;
}

.quick-action-card.orange {
    background: var(--accent-color) !important;
}

.quick-action-card.dark-blue {
    background: var(--primary-color) !important;
}

.accumulator-bar-fill {
    background: var(--progress-bar) !important;
}

.accumulator-bar-fill.orange {
    background: var(--accent-color) !important;
}

.btn-primary {
    background-color: var(--button-primary) !important;
    border-color: var(--button-primary) !important;
}

.btn-secondary {
    background-color: var(--button-secondary) !important;
    border-color: var(--button-secondary) !important;
}

.text-muted,
.program-detail-label,
.program-detail-sub,
.share-item-date {
    color: var(--text-secondary) !important;
}

.share-stream-header,
.share-stream-item {
    border-color: var(--border-color) !important;
}

#wrapper {
    background: var(--background-color) !important;
}

/* Theme Switcher Styles */
.theme-switcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.theme-switcher-button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-switcher-button:hover {
    background-color: var(--sidebar-hover);
    transform: scale(1.1);
}

.theme-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    min-width: 200px;
    z-index: 10000;
}

.theme-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.theme-option:hover {
    background-color: var(--sidebar-hover);
}

.theme-option.active {
    background-color: var(--primary-color);
    color: white;
}

.theme-option.active .theme-color-preview {
    border: 2px solid white;
}

.theme-color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.theme-name {
    flex: 1;
    font-weight: 500;
}

/* Specific theme color previews */
.theme-option[data-theme="wellness"] .theme-color-preview {
    background: linear-gradient(135deg, #1e3d59 0%, #f6a192 100%);
}

.theme-option[data-theme="professional"] .theme-color-preview {
    background: linear-gradient(135deg, #0052cc 0%, #4c9aff 100%);
}

.theme-option[data-theme="dark"] .theme-color-preview {
    background: linear-gradient(135deg, #16213e 0%, #e94560 100%);
}

.theme-option[data-theme="original"] .theme-color-preview {
    background: linear-gradient(135deg, #052d4c 0%, #ee7c5c 100%);
}

/* Mobile theme switcher adjustments */
@media (max-width: 768px) {
    .theme-switcher {
        padding: 0.25rem 0.5rem;
    }

    .theme-switcher-button {
        font-size: 1rem;
        padding: 0.35rem;
    }

    .theme-dropdown {
        right: auto;
        left: 0;
    }

    #mobile-header .theme-switcher {
        background: transparent;
        box-shadow: none;
        padding: 0;
    }

    #mobile-header .theme-switcher-button {
        color: white;
    }

    #mobile-header .theme-dropdown {
        background: var(--sidebar-bg);
        top: 50px;
    }

    #mobile-header .theme-option {
        color: white;
    }

    #mobile-header .theme-option:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    #mobile-header .theme-option.active {
        background-color: var(--accent-color);
    }
}

/* Smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Override transitions for specific elements that shouldn't animate */
.submenu,
#sidebar-wrapper,
#mobile-menu-overlay {
    transition: transform 0.3s ease, opacity 0.3s ease !important;
}
