/* =========================================
   STYLE.CSS - SEB PROJECT ULTIMATE (FINAL STABLE)
   ========================================= */

:root {
    --bg-color: #0d1117; /* Darker, GitHub-like background */
    --primary: #58a6ff; /* Neon Blue/Cyan for main actions */
    --accent: #bb86fc; /* Neon Purple/Pink for accents */
    --glass: rgba(30, 41, 59, 0.4); /* Subtle Glass effect */
    --glass-border: rgba(88, 166, 255, 0.2); /* Neon Blue border */
    --text-main: #c9d1d9; /* Light text for dark background */
    --text-muted: #8b949e;
    --card-bg: rgba(22, 27, 34, 0.7); /* Dark card background */
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Poppins', sans-serif; 
    text-decoration: none; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 80%, rgba(88, 166, 255, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 20%, rgba(187, 134, 252, 0.15) 0%, transparent 20%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    transition: background-color 0.5s;
}

/* --- NAVIGATION --- */
.glass-nav {
    position: fixed; top: 25px; left: 50%; transform: translateX(-50%);
    background: rgba(13, 17, 23, 0.9); 
    backdrop-filter: blur(15px);
    padding: 10px 30px; border-radius: 40px; 
    border: 1px solid var(--glass-border);
    display: flex; align-items: center; gap: 40px; z-index: 1000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5); width: max-content;
}
.logo { font-weight: 800; font-size: 1.4rem; letter-spacing: 1px; color: white; }
.logo span { color: var(--primary); }
.nav-links { list-style: none; display: flex; gap: 25px; }
.nav-links a { 
    color: var(--text-muted); 
    font-size: 0.9rem; 
    font-weight: 500;
    transition: 0.3s; 
    padding: 5px 0;
}
.nav-links a:hover, .nav-links a.active-page { 
    color: white; 
    text-shadow: 0 0 5px var(--primary);
    border-bottom: 2px solid var(--primary);
}

/* --- GLOBAL --- */
.container { 
    max-width: 1400px; 
    margin: 0 auto; 
    padding: 140px 20px 60px; 
    flex: 1; 
    width: 100%; 
    animation: fadeIn 0.8s ease; 
}
h2 { 
    font-size: 2.8rem; 
    margin-bottom: 25px; 
    font-weight: 800;
    color: white; 
    text-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
}
h3 {
    font-size: 1.5rem;
    color: var(--text-main);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* --- BUTTONS --- */
.btn-primary {
    background: var(--primary); 
    color: var(--bg-color); 
    padding: 12px 25px; 
    border-radius: 10px; 
    border: none;
    font-weight: 700; 
    cursor: pointer; 
    transition: all 0.3s; 
    display: inline-block; 
    box-shadow: 0 5px 15px rgba(88, 166, 255, 0.4);
    text-transform: uppercase;
    font-size: 0.9rem;
}
.btn-primary:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 10px 30px rgba(88, 166, 255, 0.7), inset 0 0 5px white;
}
.btn-primary:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
    transform: none; 
    box-shadow: none;
}

/* --- HERO SECTION & PROJETS --- */
.hero-layout { min-height: 50vh; display: flex; align-items: center; }
.hero-content h1 { font-size: 4rem; line-height: 1.2; margin: 20px 0; }
.hero-content p { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 30px; max-width: 600px; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-top: 30px; }
.project-card {
    background: var(--card-bg); border: 1px solid rgba(187, 134, 252, 0.2); padding: 30px; border-radius: 18px;
    transition: all 0.3s; box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.project-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 10px 25px rgba(187, 134, 252, 0.3); }
.project-card h3 { color: var(--accent); margin-bottom: 10px; }
.project-card .tags span {
    display: inline-block; background: rgba(88, 166, 255, 0.1); color: var(--primary);
    padding: 5px 10px; border-radius: 6px; font-size: 0.75rem; margin-right: 8px; margin-bottom: 15px;
}
.project-card p { color: var(--text-muted); margin-bottom: 20px; }

/* --- AI CHAT INTERFACE --- */
.ai-interface {
    max-width: 800px; margin: 0 auto; background: var(--card-bg); border: 1px solid var(--glass-border);
    border-radius: 20px; backdrop-filter: blur(10px); box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; height: 70vh; min-height: 500px;
}
.ai-header { padding: 20px 30px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.mode-btn {
    background: rgba(139, 148, 158, 0.1); color: var(--text-muted); border: 1px solid var(--text-muted);
    padding: 8px 15px; border-radius: 8px; cursor: pointer; margin-right: 10px; transition: 0.2s;
}
.mode-btn:hover { background: var(--primary); color: var(--bg-color); border-color: var(--primary); }
.chat-box { flex: 1; padding: 20px 30px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.msg { max-width: 80%; padding: 12px 18px; border-radius: 15px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--primary); color: var(--bg-color); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--accent); color: white; border-bottom-left-radius: 4px; }
.input-area { display: flex; padding: 20px; border-top: 1px solid rgba(255,255,255,0.05); gap: 10px; }
.input-area input {
    flex: 1; padding: 15px; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px; color: white; font-size: 1rem; outline: none; transition: border-color 0.3s;
}
.input-area input:focus { border-color: var(--primary); }

/* --- GAMES HUB --- */
.games-hub-grid { display: flex; gap: 40px; justify-content: center; margin-top: 40px; }
.game-select-card {
    background: var(--card-bg); border: 1px solid var(--glass-border); padding: 30px; border-radius: 20px;
    text-align: center; width: 350px; transition: all 0.3s; box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.game-select-card:hover { transform: translateY(-8px); border-color: var(--accent); box-shadow: 0 15px 30px rgba(187, 134, 252, 0.4); }
.game-icon {
    font-size: 3rem; margin-bottom: 15px; background: rgba(255,255,255,0.05); border-radius: 50%;
    width: 80px; height: 80px; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,0.1); margin-top: 10px;
}
.game-select-card h3 { margin: 10px 0 5px; color: var(--primary); }
.game-select-card p { color: var(--text-muted); margin-bottom: 20px; font-size: 0.9rem; }

/* --- TETRIS UI --- */
.game-container { display: flex; justify-content: flex-start; align-items: flex-start; min-height: 60vh; padding-left: 20px; }
.game-ui {
    display: flex; gap: 40px; padding: 40px; background: var(--card-bg); border: 1px solid var(--glass-border);
    border-radius: 24px; backdrop-filter: blur(15px); width: 100%; max-width: 1100px;
}
.game-info { flex: 1; display: flex; flex-direction: column; gap: 25px; } 
.player-input-zone label { display: block; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; font-weight: 500; }
.player-input-zone input {
    width: 100%; padding: 15px; background: rgba(0, 0, 0, 0.4); border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px; color: white; font-size: 1.1rem; outline: none; transition: all 0.3s; box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}
.player-input-zone input:focus { border-color: var(--primary); box-shadow: 0 0 15px rgba(88, 166, 255, 0.5), inset 0 0 5px rgba(88, 166, 255, 0.5); }
.score-board { background: rgba(255, 255, 255, 0.05); padding: 20px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); text-align: center; }
#timer, #score { color: var(--primary); font-family: monospace; font-size: 2.2rem; text-shadow: 0 0 8px var(--primary); }
canvas#tetris { border: 5px solid var(--accent); border-radius: 12px; background: #050505; box-shadow: 0 0 30px rgba(187, 134, 252, 0.5); }
.leaderboard-section { margin-top: 25px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; }
.scrollable-list { max-height: 250px; overflow-y: auto; list-style: none; }
.scrollable-list li { display: flex; justify-content: space-between; padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.05); transition: background 0.2s; }
.scrollable-list li:hover { background: rgba(88, 166, 255, 0.05); }

/* BOUTON RESET STYLISÉ */
#reset-leaderboard {
    background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5;
    padding: 8px 16px; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 0.85rem;
    text-transform: uppercase; transition: all 0.3s ease; backdrop-filter: blur(4px);
}
#reset-leaderboard:hover { background: #ef4444; color: white; border-color: #ef4444; box-shadow: 0 0 20px rgba(239, 68, 68, 0.6); transform: translateY(-2px); }

/* --- BATTLE CARDS MENUS CORRIGÉS --- */
.mode-selection, .difficulty-selection {
    text-align: center; background: var(--card-bg); border: 1px solid var(--glass-border); border-radius: 24px;
    backdrop-filter: blur(10px); max-width: 600px; margin: 0 auto; padding: 50px 40px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.mode-selection h2, .difficulty-selection h3 {
    color: var(--primary); text-shadow: 0 0 5px rgba(88, 166, 255, 0.5); margin-bottom: 30px;
}
.menu-btn {
    display: block; width: 100%; margin: 20px 0; padding: 18px; font-size: 1.1rem;
    font-weight: 600; background: rgba(255,255,255,0.08); border: 2px solid var(--glass-border);
    color: var(--text-main); border-radius: 12px; cursor: pointer; transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.menu-btn:hover { 
    background: rgba(187, 134, 252, 0.15); border-color: var(--accent); color: white;
    transform: scale(1.03); box-shadow: 0 5px 20px rgba(187, 134, 252, 0.3);
}
#difficulty-screen .menu-btn { border-width: 1px; color: var(--text-main); background: rgba(255,255,255,0.03); }
#btn-diff-easy:hover { border-color: #4ade80; box-shadow: 0 0 15px rgba(74, 222, 128, 0.5); }
#btn-diff-medium:hover { border-color: #fbbf24; box-shadow: 0 0 15px rgba(251, 191, 36, 0.5); }
#btn-diff-hard:hover { border-color: #ef4444; box-shadow: 0 0 15px rgba(239, 68, 68, 0.5); }
#difficulty-screen .btn-primary {
    background: transparent; border: 1px solid var(--text-muted); color: var(--text-muted);
    margin-top: 30px; padding: 10px 20px; font-size: 0.9rem;
}
#difficulty-screen .btn-primary:hover { background: var(--text-muted); color: var(--bg-color); box-shadow: none; }


/* --- BATTLE CARDS JEU --- */
.arena { 
    height: 80vh; display: flex; flex-direction: column; justify-content: space-between; 
    background: var(--card-bg); border: 1px solid var(--glass-border); border-radius: 20px; padding: 20px; 
}
.board { height: 140px; width: 100%; border: 2px dashed rgba(255,255,255,0.1); border-radius: 15px; display: flex; align-items: center; justify-content: center; gap: 15px; }
.hand { display: flex; justify-content: center; height: 180px; align-items: flex-end; }
.card { 
    width: 130px; height: 180px; background: linear-gradient(135deg, #1e293b, #0d1117); 
    border: 3px solid var(--primary); border-radius: 15px; padding: 10px; position: relative; cursor: pointer; 
    transition: all 0.3s; box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.card:hover { transform: translateY(-20px) scale(1.05); z-index: 100; border-color: var(--accent); box-shadow: 0 15px 30px rgba(187, 134, 252, 0.5); }
.card-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; font-weight: 600; color: white; }
.mana-bubble { background: var(--accent); border-radius: 50%; width: 25px; height: 25px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
.card-visual { font-size: 3rem; text-align: center; flex: 1; display: flex; align-items: center; justify-content: center; }
.card-stats { display: flex; justify-content: space-around; font-weight: 800; font-size: 1.1rem; }
.card-stats .atk { color: var(--primary); }
.card-stats .hp { color: #4ade80; }
.card-back { background: repeating-linear-gradient(45deg, var(--bg-color), var(--bg-color) 12px, var(--primary) 12px, var(--primary) 14px); border-color: var(--primary); }
.hp-bar { font-size: 1.2rem; font-weight: bold; color: #f87171; }

#game-log {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.95); padding: 15px 30px; border-radius: 30px; border: 2px solid var(--accent);
    color: #facc15; font-weight: bold; pointer-events: none; opacity: 0; transition: opacity 0.5s; z-index: 200; font-size: 1.6rem;
    box-shadow: 0 0 30px #facc15;
}
.turn-indicator {
    padding: 8px 20px; border-radius: 15px; font-weight: bold; color: var(--bg-color);
    width: max-content; margin: 0 auto; transition: background-color 0.5s;
}

/* --- FOOTER & MEDIA QUERIES --- */
footer { 
    text-align: center; padding: 30px 20px; color: var(--text-muted); font-size: 0.85rem; 
    margin-top: auto; border-top: 1px solid rgba(255,255,255,0.05); background: rgba(0,0,0,0.3); 
}
@media (max-width: 900px) { 
    .glass-nav { width: 90%; flex-direction: column; gap: 15px; padding: 15px 20px; } 
    .nav-links { gap: 15px; }
    .container { padding-top: 180px; }
    .hero-content h1 { font-size: 3rem; }
    .games-hub-grid { flex-direction: column; align-items: center; }
}