/* 🎨 BASE CSS - Styles fondamentaux pour Quran Games */

/* ================================
   🔧 VARIABLES CSS GLOBALES
   ================================ */
:root {
    /* 🎨 Palette de couleurs orientales */
    --color-primary: #00A693;        /* Vert émeraude */
    --color-primary-light: #1DB5A6;  /* Vert émeraude clair */
    --color-primary-dark: #008A7A;   /* Vert émeraude foncé */
    
    --color-secondary: #1B365D;      /* Bleu nuit */
    --color-secondary-light: #2A4A73; /* Bleu nuit clair */
    --color-secondary-dark: #0F1E36;  /* Bleu nuit très foncé */
    
    --color-accent: #D4AF37;         /* Or islamique */
    --color-accent-light: #E1C654;   /* Or clair */
    --color-accent-dark: #B8941F;    /* Or foncé */
    
    /* 🌈 Couleurs neutres */
    --color-background: #F5F2E8;     /* Beige sable */
    --color-surface: #FEFEFE;        /* Blanc nacré */
    --color-surface-alt: #F8F6F0;    /* Blanc cassé */
    
    --color-text-primary: #2C3E50;   /* Texte principal */
    --color-text-secondary: #5D6D7E; /* Texte secondaire */
    --color-text-muted: #85929E;     /* Texte atténué */
    --color-text-inverse: #FFFFFF;   /* Texte inversé */
    
    /* 🎯 Couleurs sémantiques */
    --color-success: #27AE60;        /* Succès */
    --color-warning: #F39C12;        /* Avertissement */
    --color-error: #E74C3C;          /* Erreur */
    --color-info: #3498DB;           /* Information */
    
    /* 📏 Espacement et tailles */
    --spacing-xs: 0.25rem;    /* 4px */
    --spacing-sm: 0.5rem;     /* 8px */
    --spacing-md: 1rem;       /* 16px */
    --spacing-lg: 1.5rem;     /* 24px */
    --spacing-xl: 2rem;       /* 32px */
    --spacing-xxl: 3rem;      /* 48px */
    --spacing-xxxl: 4rem;     /* 64px */
    
    /* 🎭 Typographie */
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-arabic: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
    --font-family-decorative: 'Aref Ruqaa', cursive;
    
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */
    --font-size-4xl: 2.25rem;   /* 36px */
    --font-size-5xl: 3rem;      /* 48px */
    
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* 🔘 Bordures et rayons */
    --border-radius-sm: 0.375rem;   /* 6px */
    --border-radius-md: 0.5rem;     /* 8px */
    --border-radius-lg: 0.75rem;    /* 12px */
    --border-radius-xl: 1rem;       /* 16px */
    --border-radius-2xl: 1.5rem;    /* 24px */
    --border-radius-full: 9999px;   /* Cercle */
    
    --border-width: 1px;
    --border-width-thick: 2px;
    
    /* 🌫️ Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 2px 4px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-elevated: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow-primary: 0 0 20px rgba(0, 166, 147, 0.3);
    --shadow-glow-accent: 0 0 20px rgba(212, 175, 55, 0.3);
    
    /* ⚡ Animations */
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
    
    /* 📱 Breakpoints */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
    
    /* 🎲 Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
    
    /* 🎮 Variables pour les pages de jeu */
    --accent-color: var(--color-accent);
    --gold-color: var(--color-accent);
    --primary-color: var(--color-primary);
    
    /* 🎨 Dégradés pour interfaces */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    --gradient-accent: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    --gradient-surface: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
    --gradient-error: linear-gradient(135deg, var(--color-error) 0%, #c0392b 100%);
    --gradient-success: linear-gradient(135deg, var(--color-success) 0%, #1e8449 100%);
    
    /* 🌟 Effets visuels */
    --backdrop-blur: blur(10px);
    --border-glass: 1px solid rgba(255, 255, 255, 0.2);
    --pattern-geometric-subtle: radial-gradient(circle at 25% 25%, var(--color-accent) 1px, transparent 1px);
    
    /* 🎭 Font families */
    --font-family-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ================================
   🔄 RESET ET NORMALISATION
   ================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    line-height: var(--line-height-normal);
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ================================
   🎭 TYPOGRAPHIE
   ================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--spacing-md);
    line-height: var(--line-height-relaxed);
}

/* Texte arabe */
.arabic-text {
    font-family: var(--font-family-arabic);
    font-size: 1.1em;
    line-height: var(--line-height-relaxed);
    direction: rtl;
    text-align: right;
}

.decorative-text {
    font-family: var(--font-family-decorative);
}

/* ================================
   🔗 LIENS
   ================================ */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

/* ================================
   📋 LISTES
   ================================ */
ul, ol {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-lg);
}

li {
    margin-bottom: var(--spacing-xs);
}

/* ================================
   🖼️ IMAGES ET MÉDIAS
   ================================ */
img, svg, video, canvas, audio, iframe, embed, object {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-radius: var(--border-radius-md);
}

/* ================================
   📝 FORMULAIRES
   ================================ */
button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    border: var(--border-width) solid #CBD5E0;
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    transition: border-color var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 147, 0.1);
}

/* ================================
   📐 LAYOUT UTILITAIRES
   ================================ */
.container {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

.container-fluid {
    width: 100%;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-end { justify-content: flex-end; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ================================
   🎨 UTILITAIRES VISUELS
   ================================ */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-slow);
}

/* ================================
   🎮 Advanced Visual Effects for Difficulty Selection
   ================================ */

/* Shimmer effect */
.difficulty-option::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    transform: translateX(-100%) rotate(45deg);
    transition: transform 0.6s;
    opacity: var(--shimmer-opacity, 0);
    pointer-events: none;
}

.difficulty-option:hover::before {
    transform: translateX(100%) rotate(45deg);
}

/* Floating elements animations */
.floating-element {
    position: absolute;
    font-size: 20px;
    opacity: 0.2;
    pointer-events: none;
    animation: float-up linear infinite;
    user-select: none;
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Level dots enhanced animations */
.level-dot {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.level-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    pointer-events: none;
}

.difficulty-option:hover .level-dot::after {
    width: 16px;
    height: 16px;
}

/* Pulse animation for active elements */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(var(--accent-color-rgb), 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(var(--accent-color-rgb), 0.8);
    }
}

.difficulty-option:focus {
    animation: pulse-glow 2s infinite;
    outline: none;
}

/* Mobile touch optimizations */
@media (max-width: 768px) {
    .difficulty-option {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .difficulty-option:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .floating-element,
    .difficulty-option::before,
    .level-dot::after {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .difficulty-option {
        border: 2px solid;
        background: var(--background-color);
    }
    
    .level-dot {
        border: 1px solid;
    }
}

/* ================================
   📱 RESPONSIVE
   ================================ */
@media (min-width: 640px) {
    .container { padding-left: var(--spacing-lg); padding-right: var(--spacing-lg); }
    .container-fluid { padding-left: var(--spacing-lg); padding-right: var(--spacing-lg); }
    
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:text-left { text-align: left; }
}

@media (min-width: 768px) {
    .container { padding-left: var(--spacing-xl); padding-right: var(--spacing-xl); }
    .container-fluid { padding-left: var(--spacing-xl); padding-right: var(--spacing-xl); }
    
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:flex-row { flex-direction: row; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ================================
   ♿ ACCESSIBILITÉ
   ================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible pour navigation clavier */
@media (any-hover: hover) {
    :focus:not(:focus-visible) {
        outline: none;
    }
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

/* ================================
   🌙 MODE SOMBRE (futur)
   ================================ */
@media (prefers-color-scheme: dark) {
    /* Variables seront ajoutées plus tard */
}

/* ================================
   🔤 STYLES ARABES SPÉCIFIQUES
   ================================ */
.arabic-text {
    font-family: var(--font-family-arabic);
    font-size: 1.2em;
    line-height: 2;
    text-align: center;
    direction: rtl;
    unicode-bidi: embed;
}

.verse-text {
    font-family: var(--font-family-arabic);
    font-size: 1.8em;
    line-height: 1.8;
    color: var(--color-text-primary);
    text-align: center;
    direction: rtl;
    unicode-bidi: embed;
    font-weight: 400;
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius-lg);
    border-right: 4px solid var(--color-accent);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    box-shadow: var(--shadow-sm);
}

.surah-name {
    font-family: var(--font-family-arabic);
    font-size: 1.1em;
    font-weight: 600;
    direction: rtl;
    unicode-bidi: embed;
}

/* ================================
   📱 NAVIGATION DROPDOWN FIX
   ================================ */
.navbar-nav .dropdown-menu {
    font-size: var(--font-size-base) !important;
    padding: var(--spacing-sm);
}

.navbar-nav .dropdown-item {
    font-size: var(--font-size-base) !important;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text-primary);
    transition: var(--transition-fast);
}

.navbar-nav .dropdown-item:hover {
    background-color: var(--color-primary-light);
    color: var(--color-text-inverse);
}

.navbar-nav .dropdown-toggle {
    font-size: var(--font-size-base) !important;
}
