/* ===========================
   ENHANCEMENTS.CSS - Améliorations UI/UX
   Mode sombre, responsive amélioré, et nouvelles animations
   =========================== */

/* ===========================
   THEME SYSTEM - Dark/Light Mode
   =========================== */

:root {
    /* Light Mode (default - valeurs existantes) */
    --theme-transition: 0.3s ease-in-out;
}

html.light-theme {
    --bg-darker: #f8fafc;
    --bg-dark: #f1f5f9;
    --bg-navy: #e2e8f0;
    --bg-card: rgba(226, 232, 240, 0.6);
    --bg-card-hover: rgba(226, 232, 240, 0.8);
    --bg-glass: rgba(248, 250, 252, 0.7);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --border-color: rgba(148, 163, 184, 0.3);
    --border-glow: rgba(148, 163, 184, 0.6);
}

html.light-theme body::before {
    background-image: 
        linear-gradient(rgba(124, 58, 237, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.08) 1px, transparent 1px);
}

/* Transition smooth entre les thèmes */
body, .container, .header, .btn, .card, .stat-box, .player-card {
    transition: background-color var(--theme-transition), 
                color var(--theme-transition),
                border-color var(--theme-transition),
                box-shadow var(--theme-transition);
}

/* ===========================
   THEME TOGGLE BUTTON - HIDDEN
   Mode sombre uniquement
   =========================== */
.theme-toggle {
    display: none !important;
}

/* ===========================
   DUEL ENHANCEMENTS
   =========================== */

/* Combo Streak Indicator */
.combo-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 50;
    display: none;
}

.combo-indicator.show {
    display: flex;
}

.combo-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--accent-gold), var(--primary-purple));
    padding: 2rem;
    border-radius: 2rem;
    text-align: center;
    animation: comboAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.6);
}

.combo-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--bg-darker);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.combo-number {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--bg-darker);
    line-height: 1;
}

.combo-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--bg-darker);
    opacity: 0.9;
}

.combo-stars {
    font-size: 1.5rem;
    animation: comboStar 0.6s ease;
}

@keyframes comboAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes comboStar {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

/* Score Pulse Animation amélioré */
.player-score {
    font-size: 2.5rem;
    font-weight: 900;
    margin-top: 0.5rem;
    color: var(--accent-gold);
    transition: all var(--transition-fast);
}

.player-score.pulse {
    animation: scorePulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scorePulse {
    0% {
        transform: scale(1);
        color: var(--accent-gold);
    }
    50% {
        transform: scale(1.3);
        color: var(--primary-blue);
    }
    100% {
        transform: scale(1);
        color: var(--accent-gold);
    }
}

/* Speed Indicator - Indicateur de vitesse de réponse */
.speed-indicator {
    position: absolute;
    top: -40px;
    right: 10px;
    display: none;
    gap: 0.5rem;
}

.speed-indicator.show {
    display: flex;
}

.speed-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0.5;
}

.speed-dot.active {
    opacity: 1;
    animation: speedPulse 0.5s ease;
}

.speed-dot.very-slow {
    background-color: var(--error);
}

.speed-dot.slow {
    background-color: var(--warning);
}

.speed-dot.medium {
    background-color: var(--accent-gold);
}

.speed-dot.fast {
    background-color: var(--success);
}

.speed-dot.very-fast {
    background-color: var(--primary-blue);
}

@keyframes speedPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
    }
}

.speed-label {
    position: absolute;
    top: -20px;
    right: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.speed-indicator:hover .speed-label {
    opacity: 1;
}

/* Enhanced Feedback Display */
.answer-feedback {
    animation: feedbackSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes feedbackSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-icon {
    font-size: 3rem;
    animation: feedbackIconBounce 0.6s ease;
}

@keyframes feedbackIconBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* ===========================
   RESPONSIVE IMPROVEMENTS
   =========================== */

/* Breakpoint 768px - Tablets */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    .header {
        flex-wrap: wrap;
        padding: 16px 10px;
        gap: 16px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .btn {
        padding: 16px 32px;
        font-size: 1.1rem;
    }

    .btn-connexion {
        padding: 12px 20px;
    }

    .game-header {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .progress-container {
        max-width: 100%;
        flex: 0 1 100%;
    }

    .game-stats {
        width: 100%;
        justify-content: center;
        gap: 12px;
    }

    .stat-box {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .stat-box .stat-value {
        font-size: 1.4rem;
    }

    .duel-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .player-card {
        min-width: 100%;
        width: 100%;
    }

    .vs-badge {
        margin: 0.5rem;
    }

    .question-card {
        padding: 20px;
    }

    .question-text {
        font-size: 1.3rem !important;
    }

    .answers-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .answer-btn {
        padding: 16px 20px !important;
        font-size: 1rem !important;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
        top: 15px;
        right: 15px;
    }

    .combo-content {
        padding: 1.5rem;
    }

    .combo-number {
        font-size: 2.8rem;
    }

    .combo-text {
        font-size: 1rem;
    }

    .combo-stars {
        font-size: 1.2rem;
    }

    .main-content {
        padding: 20px 10px;
    }

    .hero-section h1 {
        font-size: 2rem !important;
    }

    .subtitle {
        font-size: 1.1rem !important;
    }

    .action-buttons {
        flex-direction: column !important;
    }

    .action-buttons .btn {
        width: 100% !important;
    }

    .stats-section {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .stat-item {
        min-width: 100% !important;
    }
}

/* Breakpoint 480px - Mobile phones */
@media (max-width: 480px) {
    .container {
        padding: 0;
    }

    .header {
        padding: 12px 8px;
        gap: 12px;
    }

    .logo {
        font-size: 1.2rem;
        gap: 8px;
    }

    .logo span {
        display: none;
    }

    .btn-connexion {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .btn-connexion span {
        display: none;
    }

    .btn {
        padding: 14px 24px;
        font-size: 1rem;
        gap: 8px;
    }

    .btn-text {
        display: none;
    }

    .btn-icon {
        font-size: 1.2rem;
    }

    .game-header {
        gap: 12px;
        padding: 12px;
    }

    .progress-container {
        border-radius: 25px;
        padding: 4px;
    }

    .progress-text {
        font-size: 0.8rem;
    }

    .stat-box {
        padding: 10px 16px;
        gap: 8px;
        border-radius: 25px;
    }

    .stat-box .stat-icon {
        font-size: 1.2rem;
    }

    .stat-box .stat-value {
        font-size: 1.2rem;
    }

    .game-content {
        padding: 12px !important;
    }

    .question-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .question-text {
        font-size: 1.1rem !important;
    }

    .question-number {
        font-size: 0.9rem !important;
    }

    .answers-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .answer-btn {
        padding: 14px 16px !important;
        font-size: 0.95rem !important;
        border-radius: 12px !important;
    }

    .answer-letter {
        font-size: 1rem !important;
    }

    .answer-text {
        font-size: 0.95rem !important;
    }

    .action-container {
        margin-top: 12px;
    }

    .btn-next {
        width: 100% !important;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        top: 12px;
        right: 12px;
    }

    .combo-content {
        padding: 1rem;
        border-radius: 1.5rem;
    }

    .combo-number {
        font-size: 2.2rem;
    }

    .combo-text {
        font-size: 0.9rem;
    }

    .combo-stars {
        font-size: 1rem;
    }

    .duel-header {
        padding: 0.75rem;
    }

    .player-card {
        padding: 1rem;
        min-width: 100%;
    }

    .player-name {
        font-size: 1rem !important;
    }

    .player-score {
        font-size: 2rem;
    }

    .vs-badge {
        font-size: 1rem;
        margin: 0.3rem;
    }

    .hero-section h1 {
        font-size: 1.5rem !important;
    }

    .subtitle {
        font-size: 1rem !important;
    }

    .features {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .feature {
        font-size: 0.95rem !important;
    }

    .stats-section {
        grid-template-columns: 1fr !important;
    }

    .footer {
        padding: 12px 8px;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 6px;
    }

    .footer-links a {
        font-size: 0.8rem;
    }

    .footer-copyright {
        font-size: 0.8rem;
    }
}

/* ===========================
   LANDSCAPE MODE - Mobile landscape
   =========================== */
@media (max-height: 600px) and (orientation: landscape) {
    .game-header {
        margin-bottom: 1rem;
        gap: 12px;
    }

    .question-card {
        padding: 16px;
        margin-bottom: 1rem;
    }

    .question-text {
        font-size: 1.1rem !important;
    }

    .answers-grid {
        gap: 10px !important;
    }

    .answer-btn {
        padding: 12px 16px !important;
        font-size: 0.95rem !important;
    }

    .game-over-modal .modal-content {
        max-height: 80vh;
        overflow-y: auto;
    }

    .combo-content {
        padding: 1rem;
    }

    .combo-number {
        font-size: 2.5rem;
    }
}

/* ===========================
   HIGH DPI / RETINA DISPLAYS
   =========================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .particle {
        filter: blur(1px);
    }

    .combo-stars {
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}

/* ===========================
   ACCESSIBILITY IMPROVEMENTS
   =========================== */

/* Focus visible pour la navigation au clavier */
.btn:focus-visible,
.answer-btn:focus-visible,
.theme-toggle:focus-visible {
    outline: 3px solid var(--primary-purple);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .combo-indicator,
    .speed-indicator,
    .feedback-icon {
        animation: none !important;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    /* Keep default dark theme */
}

@media (prefers-color-scheme: light) {
    html {
        color-scheme: light;
    }
}