/* ========================================
   SYSTÈME DE DESIGN MODERNE - RUBNK GAMES
   ======================================== */

/* Variables CSS pour les thèmes */
:root {
    /* Couleurs principales */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-gradient: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    
    /* Mode clair */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #edf2f7;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e0;
    
    /* Ombres */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.2);
    
    /* États */
    --success-bg: #c6f6d5;
    --success-text: #22543d;
    --success-border: #9ae6b4;
    --error-bg: #fed7d7;
    --error-text: #742a2a;
    --error-border: #fc8181;
    --info-bg: #bee3f8;
    --info-text: #2a4365;
    --info-border: #63b3ed;
    
    /* Rayons de bordure */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50px;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mode sombre */
[data-theme="dark"] {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: #2d3748;
    --border-hover: #4a5568;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
    
    --success-bg: #22543d;
    --success-text: #c6f6d5;
    --success-border: #38a169;
    --error-bg: #742a2a;
    --error-text: #fed7d7;
    --error-border: #e53e3e;
    --info-bg: #2a4365;
    --info-text: #bee3f8;
    --info-border: #3182ce;
}

/* ========================================
   BASE ET RESET
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    position: relative;
}

/* ========================================
   HEADER ET NAVIGATION
   ======================================== */

.header {
    margin-bottom: 3rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 50px;
    width: auto;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    filter: drop-shadow(var(--shadow-sm));
}

.logo:hover {
    transform: translateY(-2px) scale(1.05);
    filter: drop-shadow(var(--shadow-md)) brightness(1.1);
}

.main-logo {
    height: 60px;
}

.game-logo {
    height: 40px;
}

/* ========================================
   BOUTON DE THÈME
   ======================================== */

.theme-toggle {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    transition: left var(--transition-slow);
    z-index: -1;
}

.theme-toggle:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
    color: white;
}

.theme-toggle:hover::before {
    left: 0;
}

.theme-icon {
    font-size: 1.2rem;
    transition: transform var(--transition-normal);
}

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

/* ========================================
   TITRE PRINCIPAL
   ======================================== */

.title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 3rem;
    font-weight: 400;
}

/* ========================================
   GRILLE DE JEUX
   ======================================== */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 400px);
    gap: 1rem;
    justify-content: center;
}

/* ========================================
   CARTES DE JEUX
   ======================================== */

.game-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    box-shadow: var(--shadow-md);
    transform-style: preserve-3d;
    animation: cardAppear 0.6s ease-out;
    animation-fill-mode: both;
    max-width: 400px;
    margin: 0 auto;
}

.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.2s; }
.game-card:nth-child(3) { animation-delay: 0.3s; }
.game-card:nth-child(4) { animation-delay: 0.4s; }
.game-card:nth-child(5) { animation-delay: 0.5s; }

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(50px) rotateX(-10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 1;
}

.game-card:hover {
    transform: translateY(-8px) rotateX(5deg);
    box-shadow: var(--shadow-xl);
    border-color: rgba(102, 126, 234, 0.3);
}

.game-card:hover::before {
    opacity: 0.05;
}

/* Effet de brillance au survol */
.game-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    transition: transform var(--transition-slow);
    z-index: 2;
}

.game-card:hover::after {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

/* ========================================
   CONTENU DES CARTES
   ======================================== */

.game-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    aspect-ratio: 2/1;
    transition: all var(--transition-slow);
    filter: brightness(0.95);
}

.game-card:hover .game-image {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.2);
}

.game-content {
    padding: 1.5rem;
    position: relative;
    z-index: 3;
}

.game-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    transition: all var(--transition-normal);
}

.game-card:hover .game-title {
    color: #667eea;
    transform: translateY(-2px);
    text-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.game-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.difficulty {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: var(--shadow-sm);
}

.difficulty:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.difficulty.easy {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.difficulty.easy:hover {
    background: var(--success-text);
    color: var(--success-bg);
}

.difficulty.medium {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

.difficulty.medium:hover {
    background: var(--info-text);
    color: var(--info-bg);
}

.difficulty.hard {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.difficulty.hard:hover {
    background: var(--error-text);
    color: var(--error-bg);
}

/* Icônes pour les niveaux de difficulté */
.difficulty.easy::before {
    content: "🟢";
    font-size: 0.7rem;
}

.difficulty.medium::before {
    content: "🟡";
    font-size: 0.7rem;
}

.difficulty.hard::before {
    content: "🔴";
    font-size: 0.7rem;
}

/* ========================================
   PAGES DE JEUX
   ======================================== */

.game-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: gameAppear 0.8s ease-out;
}

@keyframes gameAppear {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: all var(--transition-normal);
}

.game-header h1:hover {
    transform: scale(1.02);
    text-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.score {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
    cursor: default;
}

.score:hover {
    transform: scale(1.05);
    color: #667eea;
}

/* ========================================
   BOUTONS
   ======================================== */

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-weight: 500;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.back-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    transition: left var(--transition-normal);
    z-index: -1;
}

.back-button:hover {
    transform: translateX(-3px) translateY(-2px);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}

.back-button:hover::before {
    left: 0;
}

.game-button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0.5rem;
}

.game-button::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 var(--transition-slow);
}

.game-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.game-button:hover::before {
    left: 100%;
}

.game-button:active {
    transform: translateY(-1px) scale(0.98);
}

.game-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.game-button:disabled:hover {
    transform: none;
}

/* ========================================
   INPUTS
   ======================================== */

.game-input {
    padding: 1rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-normal);
    text-align: center;
    font-weight: 500;
    min-width: 200px;
    margin: 0.5rem;
}

.game-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), var(--shadow-md);
    transform: translateY(-2px) scale(1.02);
    background: var(--bg-secondary);
}

.game-input::placeholder {
    color: var(--text-muted);
}

/* ========================================
   MESSAGES ET ALERTES
   ======================================== */

.message {
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    font-weight: 500;
    text-align: center;
    position: relative;
    border: 2px solid;
    animation: messageAppear 0.5s ease-out;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.message.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
    animation: messageAppear 0.5s ease-out, shake 0.6s ease-in-out;
}

.message.info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    text-align: center;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.footer-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.footer-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: var(--primary-gradient);
    transition: left var(--transition-slow);
}

.footer-link::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0;
    transition: all var(--transition-slow);
    z-index: -1;
}

.footer-link:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.footer-link:hover::before {
    left: 0;
}

.footer-link:hover::after {
    left: 0;
    opacity: 1;
}

/* ========================================
   PARTICULES D'ARRIÈRE-PLAN
   ======================================== */

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: 50%;
    opacity: 0.1;
    animation: float 6s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
        opacity: 0.1; 
    }
    50% { 
        transform: translateY(-20px) rotate(180deg); 
        opacity: 0.3; 
    }
}

/* ========================================
   ANIMATIONS UTILITAIRES
   ======================================== */

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in-up {
    animation: slideInUp 0.6s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header-top {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .game-card {
        margin: 0 auto;
        max-width: 400px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .theme-toggle {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .game-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .game-input {
        min-width: 150px;
        font-size: 1rem;
    }
    
    /* Désactiver les effets avancés sur mobile */
    .game-card::after,
    .particle {
        display: none;
    }
    
    .game-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }
    
    .game-container {
        padding: 1rem;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .game-button {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
        margin: 0.3rem;
    }
}

/* ========================================
   STYLES SPÉCIFIQUES AUX JEUX
   ======================================== */

/* Cartes Memory */
.memory-card {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    transform-style: preserve-3d;
}

.memory-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* Grille Snake */
.game-canvas {
    border: 3px solid #667eea;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
}

.game-canvas:hover {
    box-shadow: var(--shadow-xl);
}

/* Boutons Hangman */
.letter-btn {
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 500;
}

.letter-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: var(--shadow-md);
}

.letter-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.letter-btn.correct {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.letter-btn.incorrect {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

/* ========================================
   UTILITIES
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none; }
.visible { display: block; }

/* ========================================
   FIN DU FICHIER CSS
   ======================================== */
