/**
 * Events Module - Dark Mode Theme v1.0
 * CSS Variables for Dark/Light Mode
 *
 * Usage:
 *   1. Include this file FIRST
 *   2. Add theme initialization script before </head>
 *   3. Add theme toggle button
 */

/* ========================================
   DARK MODE (Default)
   ======================================== */
:root {
    /* Background Colors */
    --bg-primary: #0f172a;      /* Main page background */
    --bg-secondary: #1e293b;    /* Cards, panels */
    --bg-tertiary: #334155;     /* Inputs, hover states */
    --bg-elevated: #1e293b;     /* Modals, dropdowns */

    /* Module Accent - Purple/Indigo Theme (matches events gradient) */
    --accent-primary: #8b5cf6;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-gradient-hover: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    --hero-gradient: linear-gradient(135deg, #4c1d95 0%, #1e1b4b 100%);

    /* Standard Accents */
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;
    --accent-yellow: #eab308;
    --accent-teal: #14b8a6;
    --accent-indigo: #6366f1;

    /* Text Colors */
    --text-primary: #f1f5f9;    /* Main text */
    --text-secondary: #94a3b8;  /* Secondary text */
    --text-muted: #64748b;      /* Muted/disabled text */
    --text-inverse: #ffffff;    /* Text on dark backgrounds */

    /* Border Colors */
    --border-color: #334155;
    --border-light: #475569;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);

    /* Event Type Colors */
    --event-featured: #eab308;
    --event-camps: #10b981;
    --event-matches: #f59e0b;
    --event-training: #3b82f6;
    --event-tournament: #ef4444;
    --event-clinic: #ec4899;
    --event-general: #6b7280;

    /* Color scheme for native elements */
    color-scheme: dark;
}

/* ========================================
   LIGHT MODE
   ======================================== */
[data-theme="light"] {
    /* Background Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-elevated: #ffffff;

    /* Module Accent - Slightly darker for light mode */
    --accent-primary: #7c3aed;
    --accent-secondary: #6d28d9;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-gradient-hover: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    --hero-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Standard Accents - Darker for light mode */
    --accent-blue: #2563eb;
    --accent-green: #059669;
    --accent-purple: #7c3aed;
    --accent-pink: #db2777;
    --accent-orange: #ea580c;
    --accent-amber: #d97706;
    --accent-red: #dc2626;
    --accent-cyan: #0891b2;
    --accent-yellow: #ca8a04;
    --accent-teal: #0d9488;
    --accent-indigo: #4f46e5;

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Border Colors */
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;

    /* Shadows - Softer for light mode */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.2);

    /* Color scheme for native elements */
    color-scheme: light;
}

/* ========================================
   BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   NAVIGATION STYLES
   ======================================== */
nav, .nav, .navbar {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav a {
    color: var(--text-secondary) !important;
    transition: color 0.15s ease;
}

nav a:hover {
    color: var(--text-primary) !important;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero-gradient {
    background: var(--hero-gradient) !important;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

[data-theme="light"] .glass-effect {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

/* ========================================
   FILTER SECTION
   ======================================== */
.filter-card {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

/* ========================================
   EVENT CARDS
   ======================================== */
.event-card {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.event-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.list-view-card {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.list-view-card:hover {
    box-shadow: var(--shadow-md);
}

/* ========================================
   VIEW TOGGLE
   ======================================== */
.view-toggle {
    background: var(--bg-tertiary) !important;
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    transition: all 0.2s;
    cursor: pointer;
}

.view-toggle button.active {
    background: var(--bg-secondary) !important;
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
input, select, textarea {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted) !important;
}

select option {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Date inputs */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="datetime-local"] {
    color-scheme: light;
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: none;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-primary {
    background: var(--accent-blue) !important;
    color: white !important;
}

.btn-primary:hover {
    background: #2563eb !important;
}

.btn-success {
    background: var(--accent-green) !important;
    color: white !important;
}

.btn-success:hover {
    background: #059669 !important;
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination-btn {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    transform: translateY(-1px);
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    background: #0f172a !important;
    border-top: 1px solid var(--border-color) !important;
}

[data-theme="light"] footer {
    background: #1e293b !important;
}

footer a {
    color: var(--text-secondary) !important;
    transition: color 0.15s;
}

footer a:hover {
    color: var(--text-primary) !important;
}

/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle i {
    font-size: 1.125rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.theme-toggle:hover i {
    color: white;
    transform: rotate(20deg);
}

/* Light mode toggle styling */
[data-theme="light"] .theme-toggle {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="light"] .theme-toggle:hover {
    background: #1e293b;
    border-color: #1e293b;
}

/* Toggle tooltip */
.theme-toggle::before {
    content: 'Light Mode';
    position: absolute;
    right: 54px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover::before {
    opacity: 1;
}

[data-theme="light"] .theme-toggle::before {
    content: 'Dark Mode';
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   SELECTION STYLING
   ======================================== */
::selection {
    background: var(--accent-primary);
    color: white;
}

/* ========================================
   FOCUS STYLES
   ======================================== */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Staggered animation for cards */
.event-card:nth-child(1) { animation-delay: 0ms; }
.event-card:nth-child(2) { animation-delay: 50ms; }
.event-card:nth-child(3) { animation-delay: 100ms; }
.event-card:nth-child(4) { animation-delay: 150ms; }
.event-card:nth-child(5) { animation-delay: 200ms; }
.event-card:nth-child(6) { animation-delay: 250ms; }
