/* ============================================================================
   MYFOOTBOL.INFO - DARK MODE UX ENHANCEMENTS
   Laravel-Inspired Premium Design System

   Implementation Strategy:
   1. Add this CSS after existing Tailwind/custom styles
   2. Add data-theme toggle functionality with JavaScript
   3. All transitions are hardware-accelerated (transform, opacity)
   4. Color palette uses HSL for smooth theme transitions
   ============================================================================ */

/* ============================================================================
   COLOR SYSTEM - HSL for Easy Theme Management
   ============================================================================ */
:root {
    /* Light Theme (Default) */
    --color-bg-primary: 255, 255, 255;
    --color-bg-secondary: 249, 250, 251;
    --color-bg-tertiary: 243, 244, 246;

    --color-text-primary: 17, 24, 39;
    --color-text-secondary: 75, 85, 99;
    --color-text-tertiary: 156, 163, 175;

    --color-border: 229, 231, 235;
    --color-border-hover: 209, 213, 219;

    /* Brand Colors */
    --color-brand-primary: 102, 126, 234;
    --color-brand-secondary: 118, 75, 162;
    --color-brand-tertiary: 99, 102, 241;

    /* Accent Colors */
    --color-accent-success: 34, 197, 94;
    --color-accent-warning: 251, 146, 60;
    --color-accent-error: 239, 68, 68;
    --color-accent-info: 59, 130, 246;

    /* Surface Colors */
    --color-surface: 255, 255, 255;
    --color-surface-hover: 249, 250, 251;
    --color-surface-elevated: 255, 255, 255;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Glassmorphism */
    --glass-blur: 20px;
    --glass-opacity: 0.85;
}

[data-theme="dark"] {
    /* Dark Theme */
    --color-bg-primary: 15, 23, 42;          /* slate-900 */
    --color-bg-secondary: 30, 41, 59;        /* slate-800 */
    --color-bg-tertiary: 51, 65, 85;         /* slate-700 */

    --color-text-primary: 248, 250, 252;     /* slate-50 */
    --color-text-secondary: 203, 213, 225;   /* slate-300 */
    --color-text-tertiary: 148, 163, 184;    /* slate-400 */

    --color-border: 51, 65, 85;              /* slate-700 */
    --color-border-hover: 71, 85, 105;       /* slate-600 */

    /* Surface Colors - Dark Mode */
    --color-surface: 30, 41, 59;
    --color-surface-hover: 51, 65, 85;
    --color-surface-elevated: 30, 41, 59;

    /* Adjusted Shadows for Dark Mode */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.8);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.9);

    /* Glassmorphism - Dark Mode */
    --glass-blur: 24px;
    --glass-opacity: 0.75;
}

/* ============================================================================
   BASE STYLES - Smooth Theme Transitions
   ============================================================================ */
body {
    background-color: rgb(var(--color-bg-primary));
    color: rgb(var(--color-text-primary));
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-duration: 0.2s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   NAVIGATION - Laravel-Inspired Glass Effect
   ============================================================================ */
.nav-glass {
    background: rgba(var(--color-surface), var(--glass-opacity)) !important;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid rgba(var(--color-border), 0.3);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.6, 1);
}

[data-theme="dark"] .nav-glass {
    background: rgba(var(--color-surface), 0.8) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(var(--color-border), 0.2);
}

.nav-glass.scrolled {
    background: rgba(var(--color-surface), 0.98) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .nav-glass.scrolled {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Navigation Links */
.nav-glass a {
    color: rgb(var(--color-text-primary));
    position: relative;
    transition: color 0.2s ease;
}

.nav-glass a:hover {
    color: rgb(var(--color-brand-primary));
}

/* Animated Underline Effect */
.nav-glass a:not(.btn-modern-primary):not(.btn-modern-secondary)::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg,
        rgb(var(--color-brand-primary)),
        rgb(var(--color-brand-secondary)));
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-glass a:not(.btn-modern-primary):not(.btn-modern-secondary):hover::after {
    width: 100%;
}

/* ============================================================================
   BUTTONS - Premium Dark Mode Styling
   ============================================================================ */
.btn-modern-primary {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg,
        rgb(var(--color-brand-primary)) 0%,
        rgb(var(--color-brand-secondary)) 50%,
        rgb(var(--color-brand-tertiary)) 100%);
    background-size: 200% 200%;
    color: white;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 20px rgba(var(--color-brand-primary), 0.35);
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-modern-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent);
    transition: left 0.5s ease;
}

.btn-modern-primary:hover::before {
    left: 100%;
}

.btn-modern-primary:hover {
    background-position: 100% 100%;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(var(--color-brand-secondary), 0.5);
}

.btn-modern-primary:active {
    transform: translateY(-1px) scale(0.98);
}

/* Dark Mode Button Glow */
[data-theme="dark"] .btn-modern-primary {
    box-shadow: 0 4px 20px rgba(var(--color-brand-primary), 0.5),
                0 0 40px rgba(var(--color-brand-primary), 0.15);
}

[data-theme="dark"] .btn-modern-primary:hover {
    box-shadow: 0 8px 30px rgba(var(--color-brand-secondary), 0.6),
                0 0 60px rgba(var(--color-brand-primary), 0.25);
}

/* Secondary Button */
.btn-modern-secondary {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgb(var(--color-surface));
    color: rgb(var(--color-brand-primary));
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 12px;
    border: 2px solid rgb(var(--color-brand-primary));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.6, 1);
    text-decoration: none;
    cursor: pointer;
}

.btn-modern-secondary:hover {
    background: rgb(var(--color-brand-primary));
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(var(--color-brand-primary), 0.35);
}

.btn-modern-secondary:active {
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-modern-secondary {
    border-color: rgb(var(--color-brand-primary));
    box-shadow: 0 0 20px rgba(var(--color-brand-primary), 0.1);
}

[data-theme="dark"] .btn-modern-secondary:hover {
    box-shadow: 0 8px 25px rgba(var(--color-brand-primary), 0.4),
                0 0 40px rgba(var(--color-brand-primary), 0.2);
}

/* ============================================================================
   CARDS - Enhanced Depth & Hover States
   ============================================================================ */
.module-card,
.feature-card,
.problem-card {
    background: rgb(var(--color-surface));
    border: 1px solid rgba(var(--color-border), 0.5);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Card Shine Effect */
.module-card::before,
.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(var(--color-brand-primary), 0.05),
        transparent);
    transition: left 0.6s ease;
}

.module-card:hover::before,
.feature-card:hover::before {
    left: 100%;
}

/* Card Hover States */
.module-card:hover,
.feature-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: var(--shadow-2xl);
    border-color: rgba(var(--color-brand-primary), 0.3);
}

[data-theme="dark"] .module-card:hover,
[data-theme="dark"] .feature-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8),
                0 0 80px rgba(var(--color-brand-primary), 0.15);
    border-color: rgba(var(--color-brand-primary), 0.4);
}

/* Card Icons */
.module-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.module-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: inherit;
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.module-card:hover .module-icon {
    transform: scale(1.1) rotate(5deg);
}

.module-card:hover .module-icon::after {
    opacity: 0.5;
}

/* ============================================================================
   HERO SECTION - Dark Mode Overlay
   ============================================================================ */
.hero-pattern {
    background: linear-gradient(135deg,
        rgb(var(--color-brand-primary)) 0%,
        rgb(var(--color-brand-secondary)) 50%,
        rgb(var(--color-brand-tertiary)) 100%);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .hero-pattern {
    background: linear-gradient(135deg,
        rgba(var(--color-brand-primary), 0.9) 0%,
        rgba(var(--color-brand-secondary), 0.9) 50%,
        rgba(var(--color-brand-tertiary), 0.9) 100%);
}

/* Carousel Overlay - Better contrast in dark mode */
.carousel .absolute.inset-0 {
    background: rgba(0, 0, 0, 0.5);
    transition: background 0.3s ease;
}

[data-theme="dark"] .carousel .absolute.inset-0 {
    background: rgba(0, 0, 0, 0.7);
}

/* Carousel Navigation Buttons */
.carousel button {
    background: rgba(var(--color-surface), var(--glass-opacity));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.6, 1);
}

.carousel button:hover {
    background: rgba(var(--color-surface), 1);
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .carousel button {
    background: rgba(var(--color-surface), 0.4);
    border-color: rgba(var(--color-border), 0.3);
}

[data-theme="dark"] .carousel button:hover {
    background: rgba(var(--color-surface), 0.8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6),
                0 0 40px rgba(var(--color-brand-primary), 0.2);
}

/* ============================================================================
   FORMS - Enhanced Dark Mode Inputs
   ============================================================================ */
.contact-input,
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgb(var(--color-surface));
    color: rgb(var(--color-text-primary));
    border: 2px solid rgba(var(--color-border), 0.5);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgb(var(--color-brand-primary));
    box-shadow: 0 0 0 4px rgba(var(--color-brand-primary), 0.1);
    transform: translateY(-2px);
}

[data-theme="dark"] .contact-input:focus,
[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] input[type="tel"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    box-shadow: 0 0 0 4px rgba(var(--color-brand-primary), 0.2),
                0 0 30px rgba(var(--color-brand-primary), 0.15);
}

/* Placeholder Styling */
::placeholder {
    color: rgba(var(--color-text-tertiary), 0.6);
    transition: color 0.2s ease;
}

input:focus::placeholder,
textarea:focus::placeholder {
    color: rgba(var(--color-text-tertiary), 0.4);
}

/* ============================================================================
   BACKGROUND SECTIONS - Dark Mode Variants
   ============================================================================ */
.bg-gray-50 {
    background-color: rgb(var(--color-bg-secondary)) !important;
}

.bg-white {
    background-color: rgb(var(--color-surface)) !important;
}

.bg-gradient-to-br {
    transition: background 0.3s ease;
}

[data-theme="dark"] .bg-gradient-to-br.from-purple-50 {
    background: linear-gradient(to bottom right,
        rgb(var(--color-bg-secondary)),
        rgb(var(--color-bg-tertiary))) !important;
}

/* ============================================================================
   TEXT COLORS - Proper Contrast
   ============================================================================ */
.text-gray-700 {
    color: rgb(var(--color-text-primary)) !important;
}

.text-gray-600 {
    color: rgb(var(--color-text-secondary)) !important;
}

.text-gray-500 {
    color: rgb(var(--color-text-tertiary)) !important;
}

/* Gradient Text - Works in Both Modes */
.gradient-text {
    background: linear-gradient(135deg,
        rgb(var(--color-brand-primary)) 0%,
        rgb(var(--color-brand-secondary)) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .gradient-text {
    background: linear-gradient(135deg,
        rgb(var(--color-brand-primary)) 0%,
        rgb(var(--color-brand-tertiary)) 100%);
    filter: brightness(1.2);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ============================================================================
   LOADING STATES - Skeleton & Spinners
   ============================================================================ */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton {
    background: linear-gradient(90deg,
        rgba(var(--color-bg-secondary), 1) 0%,
        rgba(var(--color-bg-tertiary), 1) 50%,
        rgba(var(--color-bg-secondary), 1) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 8px;
}

/* Loading Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(var(--color-border), 0.3);
    border-top-color: rgb(var(--color-brand-primary));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

[data-theme="dark"] .spinner {
    box-shadow: 0 0 20px rgba(var(--color-brand-primary), 0.3);
}

/* ============================================================================
   MICRO-INTERACTIONS - Premium Feel
   ============================================================================ */

/* Smooth Scale on Interactive Elements */
button,
a,
.interactive {
    will-change: transform;
}

button:active,
a:active,
.interactive:active {
    transform: scale(0.97);
}

/* Ripple Effect Container (Add to buttons) */
.ripple-container {
    position: relative;
    overflow: hidden;
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    animation: ripple 0.6s ease-out;
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Pulse Animation for Important Elements */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.02);
    }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================================================
   SCROLLBAR - Custom Styling
   ============================================================================ */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgb(var(--color-bg-secondary));
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-border), 0.5);
    border-radius: 6px;
    border: 2px solid rgb(var(--color-bg-secondary));
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-brand-primary), 0.6);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    box-shadow: inset 0 0 10px rgba(var(--color-brand-primary), 0.2);
}

/* ============================================================================
   MOBILE MENU - Enhanced Dark Mode
   ============================================================================ */
.mobile-menu {
    background: rgba(var(--color-surface), 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(var(--color-border), 0.2);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu a:hover {
    background: rgba(var(--color-brand-primary), 0.1);
    color: rgb(var(--color-brand-primary));
}

/* ============================================================================
   FOOTER - Dark Mode Support
   ============================================================================ */
footer {
    background: rgb(var(--color-bg-secondary));
    border-top: 1px solid rgba(var(--color-border), 0.2);
}

[data-theme="dark"] footer {
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
   ACCESSIBILITY - Focus Visible
   ============================================================================ */
*:focus-visible {
    outline: 3px solid rgb(var(--color-brand-primary));
    outline-offset: 2px;
    border-radius: 4px;
}

[data-theme="dark"] *:focus-visible {
    outline-color: rgb(var(--color-brand-tertiary));
    box-shadow: 0 0 20px rgba(var(--color-brand-primary), 0.3);
}

/* ============================================================================
   DARK MODE TOGGLE BUTTON - Add to Navigation
   ============================================================================ */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 32px;
    background: rgb(var(--color-bg-tertiary));
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(var(--color-border), 0.3);
}

.theme-toggle:hover {
    transform: scale(1.05);
    border-color: rgb(var(--color-brand-primary));
}

.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

[data-theme="dark"] .theme-toggle {
    background: rgb(var(--color-brand-primary));
}

[data-theme="dark"] .theme-toggle-slider {
    left: 30px;
    background: rgb(var(--color-bg-primary));
}

/* Icon colors */
.theme-toggle-slider .sun-icon {
    color: #fbbf24;
}

.theme-toggle-slider .moon-icon {
    color: #60a5fa;
}

/* ============================================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* GPU Acceleration for Smooth Animations */
.module-card,
.feature-card,
button,
.carousel button,
.nav-glass {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ============================================================================
   PRINT STYLES - Remove Dark Mode for Printing
   ============================================================================ */
@media print {
    [data-theme="dark"] {
        --color-bg-primary: 255, 255, 255;
        --color-text-primary: 0, 0, 0;
    }

    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
}
