/* ==========================================
   Theme System - CSS Custom Properties
   Dark/Light mode support via data-bs-theme
   ========================================== */

/* Light Theme (default) */
[data-bs-theme="light"] {
    /* Body */
    --theme-body-bg: #f5f7fa;
    --theme-body-fg: #212529;

    /* Surfaces */
    --theme-surface-bg: #ffffff;
    --theme-surface-fg: #212529;
    --theme-surface-secondary: #f8f9fa;
    --theme-surface-secondary-fg: #495057;
    --theme-surface-tertiary: #e9ecef;

    /* Borders */
    --theme-border-color: #dee2e6;
    --theme-border-light: #e9ecef;

    /* Shadows */
    --theme-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --theme-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --theme-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);

    /* Inputs */
    --theme-input-bg: #ffffff;
    --theme-input-border: #dee2e6;
    --theme-input-focus-border: #0066cc;

    /* Text */
    --theme-text-primary: #212529;
    --theme-text-secondary: #495057;
    --theme-text-muted: #6c757d;

    /* Context Menu */
    --theme-context-bg: #ffffff;
    --theme-context-hover: #f8f9fa;
    --theme-context-border: #dee2e6;
    --theme-context-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

    /* Search Highlight */
    --theme-search-highlight-bg: #fff3cd;
    --theme-search-highlight-border: #ffeaa7;

    /* Tables */
    --theme-table-header-bg: #343a40;
    --theme-table-header-fg: #ffffff;
    --theme-table-hover-bg: rgba(0, 102, 204, 0.05);
    --theme-table-border: #dee2e6;
    --theme-table-stripe-bg: rgba(0, 0, 0, 0.02);

    /* Scrollbar */
    --theme-scrollbar-track: #f1f1f1;
    --theme-scrollbar-thumb: #6c757d;
    --theme-scrollbar-thumb-hover: #343a40;

    /* Loading Overlay */
    --theme-loading-bg: linear-gradient(135deg, #f8f9fa, #e9ecef);
    --theme-loading-surface: #ffffff;

    /* Dropdown */
    --theme-dropdown-bg: #ffffff;
    --theme-dropdown-hover: #f8f9fa;
    --theme-dropdown-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* Slot Finder */
    --theme-slot-finder-bg: #ffffff;
    --theme-slot-results-header: #f8f9fa;

    /* Pattern Grid */
    --theme-pattern-header-bg: #e9ecef;
    --theme-pattern-time-bg: #f8f9fa;
    --theme-pattern-cell-bg: #ffffff;
    --theme-pattern-grid-border: #dee2e6;

    /* College Faculty Card */
    --theme-faculty-card-bg: #ffffff;
    --theme-faculty-card-border: #e9ecef;
    --theme-faculty-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --theme-faculty-card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);

    /* Expanded Content */
    --theme-expanded-bg: #ffffff;
    --theme-expanded-border: #e9ecef;

    /* Misc */
    --theme-code-bg: #f8f9fa;
    --theme-badge-muted-bg: #e9ecef;

    /* Ramadan Mode */
    --theme-ramadan-banner-bg: linear-gradient(135deg, #fff8e1, #ffecb3);
    --theme-ramadan-banner-border: #f9a825;
    --theme-ramadan-banner-fg: #5d4037;
}

/* Dark Theme */
[data-bs-theme="dark"] {
    /* Body */
    --theme-body-bg: #1a1d21;
    --theme-body-fg: #e9ecef;

    /* Surfaces */
    --theme-surface-bg: #212529;
    --theme-surface-fg: #e9ecef;
    --theme-surface-secondary: #2b3035;
    --theme-surface-secondary-fg: #adb5bd;
    --theme-surface-tertiary: #343a40;

    /* Borders */
    --theme-border-color: #495057;
    --theme-border-light: #343a40;

    /* Shadows */
    --theme-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --theme-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --theme-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

    /* Inputs */
    --theme-input-bg: #2b3035;
    --theme-input-border: #495057;
    --theme-input-focus-border: #4d94ff;

    /* Text */
    --theme-text-primary: #e9ecef;
    --theme-text-secondary: #adb5bd;
    --theme-text-muted: #8c959d;

    /* Context Menu */
    --theme-context-bg: #2b3035;
    --theme-context-hover: #343a40;
    --theme-context-border: #495057;
    --theme-context-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);

    /* Search Highlight */
    --theme-search-highlight-bg: #5c4b1f;
    --theme-search-highlight-border: #7a6423;

    /* Tables */
    --theme-table-header-bg: #2b3035;
    --theme-table-header-fg: #e9ecef;
    --theme-table-hover-bg: rgba(77, 148, 255, 0.08);
    --theme-table-border: #495057;
    --theme-table-stripe-bg: rgba(255, 255, 255, 0.02);

    /* Scrollbar */
    --theme-scrollbar-track: #2b3035;
    --theme-scrollbar-thumb: #495057;
    --theme-scrollbar-thumb-hover: #6c757d;

    /* Loading Overlay */
    --theme-loading-bg: linear-gradient(135deg, #1a1d21, #212529);
    --theme-loading-surface: #2b3035;

    /* Dropdown */
    --theme-dropdown-bg: #2b3035;
    --theme-dropdown-hover: #343a40;
    --theme-dropdown-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);

    /* Slot Finder */
    --theme-slot-finder-bg: #2b3035;
    --theme-slot-results-header: #343a40;

    /* Pattern Grid */
    --theme-pattern-header-bg: #343a40;
    --theme-pattern-time-bg: #2b3035;
    --theme-pattern-cell-bg: #212529;
    --theme-pattern-grid-border: #495057;

    /* College Faculty Card */
    --theme-faculty-card-bg: #212529;
    --theme-faculty-card-border: #343a40;
    --theme-faculty-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --theme-faculty-card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);

    /* Expanded Content */
    --theme-expanded-bg: #2b3035;
    --theme-expanded-border: #343a40;

    /* Misc */
    --theme-code-bg: #2b3035;
    --theme-badge-muted-bg: #343a40;

    /* Ramadan Mode */
    --theme-ramadan-banner-bg: linear-gradient(135deg, #3e2723, #4e342e);
    --theme-ramadan-banner-border: #f9a825;
    --theme-ramadan-banner-fg: #ffe082;

    /* FullCalendar Dark Mode Overrides */
    --fc-border-color: #495057;
    --fc-page-bg-color: #212529;
    --fc-neutral-bg-color: #2b3035;
    --fc-today-bg-color: rgba(77, 148, 255, 0.08);
    --fc-list-event-hover-bg-color: #343a40;
    --fc-highlight-color: rgba(77, 148, 255, 0.12);
}

/* Smooth theme transition */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Theme toggle button */
.theme-toggle {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle .theme-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(30deg);
}

/* Fixed position toggle (for login, landing pages) */
.theme-toggle-fixed {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1050;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-fixed:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

[data-bs-theme="light"] .theme-toggle-fixed {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.15);
    color: #333;
}

[data-bs-theme="light"] .theme-toggle-fixed:hover {
    background: rgba(0, 0, 0, 0.2);
}
