:root {
    --primary: #6366f1;
    --primary-light: #eef2ff;
    --primary-gradient: linear-gradient(90deg, #4f46e5, #9333ea);
    --bg: #f3f4f6;
    --white: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --gray-light: #f9fafb;
    --gray-button: #f3f4f6;
    --gray-button-hover: #e5e7eb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #22c55e;
    --timeline-avail: #86efac;
    --timeline-unavail: #fca5a5;
    --timeline-empty: #e5e7eb;
    --radius: 24px;
}
/* ================= FORM LAYOUTS ================= */

.form-body { padding: 48px 24px 24px 24px; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.section-label { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }

/* ================= INPUTS & SELECTS ================= */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    background: #f9fafb;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #4f46e5;
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ================= TOGGLES (SWITCH) ================= */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 12px;
    margin-bottom: 8px;
}

.toggle-info { display: flex; flex-direction: column; }
.toggle-title { font-size: 14px; font-weight: 700; }
.toggle-desc { font-size: 12px; color: #6b7280; }

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #d1d5db;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: #4f46e5; }
input:checked + .slider:before { transform: translateX(20px); }

/* ================= OPTIONS (RADIO BUTTONS) ================= */

.flex-options { display: flex; flex-wrap: wrap; gap: 8px; }
.option-item { flex: 1 1 auto; position: relative; min-width: calc(33.333% - 8px); }
.option-item input { position: absolute; opacity: 0; }
.option-item label { display: block; padding: 10px; border: 1px solid var(--border); border-radius: 10px; text-align: center; cursor: pointer; font-size: 13px; font-weight: 600; transition: 0.2s; white-space: nowrap; }
.option-item input:checked + label { border-color: var(--primary); background: var(--primary-light); color: var(--primary); border-width: 2px; padding: 9px; }


/* Header style Profil */
.profile-header, .login-header {
    background: linear-gradient(90deg, #4f46e5, #9333ea);
    padding: 40px 20px;
    text-align: center;
    position: relative;height: 96px;
    color: white;flex-shrink: 0;
}


.avatar-wrapper { position: absolute; bottom: -32px; left: 24px; }


.avatar-img { width: 80px; height: 80px; border-radius: 50%; border: 4px solid var(--white); box-shadow: 0 4px 6px rgba(0,0,0,0.1); object-fit: cover; background: var(--white); }

/* Grilles */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* Toggles / Switch */
.toggle-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px; 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    margin-bottom: 8px; 
}

.toggle-info { display: flex; flex-direction: column; text-align: left; }
.toggle-title { font-size: 13px; font-weight: 700; color: var(--text-main); }
.toggle-desc { font-size: 11px; color: var(--text-muted); }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { 
    position: absolute; cursor: pointer; inset: 0; 
    background-color: var(--border); transition: .4s; border-radius: 34px; 
}
.slider:before { 
    position: absolute; content: ""; height: 18px; width: 18px; 
    left: 3px; bottom: 3px; background-color: white; 
    transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); 
}
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }

/* Bouton manque jeu */

/*.btn-missing-game { background: var(--primary-light); color: var(--primary); border: 1px dashed var(--primary); padding: 0 16px; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer; transition: 0.2s; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.btn-missing-game:hover { background: var(--primary); color: var(--white); border-style: solid; }
$/

/* --- CONTRÔLES D'AJOUT DE JEU --- */
.add-game-controls { 
    display: flex; 
    gap: 12px; 
    margin-top: 24px; /* ✅ Ajoute de l'espace au-dessus */
    margin-bottom: 16px; 
    align-items: stretch; /* ✅ Force la même hauteur pour tous les enfants */
}
.add-game-controls select,
.add-game-controls .btn-primary,
.add-game-controls .btn-missing-game {
    height: 44px; /* ✅ Hauteur fixe uniforme */
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.add-game-controls select { 
    flex: 1; 
    cursor: pointer; 
}
.add-game-controls .btn-primary {
    padding: 0 20px;
}

/* --- LISTE DE JEUX DANS LE PROFIL --- */
.games-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.game-card { 
    display: flex; align-items: center; gap: 10px; background: #f9fafb; 
    padding: 8px 12px; border-radius: 12px; border: 1px solid #e5e7eb; 
}
.game-name { flex: 1; font-weight: 700; font-size: 14px; }
.game-level-select { width: auto !important; margin-bottom: 0 !important; padding: 4px 8px !important; font-size: 12px !important; }
.btn-remove-game { background: none; border: none; color: #ef4444; cursor: pointer; padding: 4px; }

.add-game-controls { display: flex; gap: 12px; margin-bottom: 16px; }
.add-game-controls select { flex: 1; cursor: pointer; }
.btn-missing-game { background: var(--primary-light); color: var(--primary); border: 1px dashed var(--primary); padding: 0 16px; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer; transition: 0.2s; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.btn-missing-game:hover { background: var(--primary); color: var(--white); border-style: solid; }
.games-list { display: flex; flex-direction: column; gap: 8px; }
.game-card { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; background: var(--gray-light); border: 1px solid var(--border); padding: 8px 12px; border-radius: 12px; }
.game-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.game-level-select { padding: 6px 10px; font-size: 12px; font-weight: 500; border-radius: 8px; cursor: pointer; }
.btn-remove-game { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 24px; height: 24px; border-radius: 50%; transition: 0.2s; }
.btn-remove-game:hover { color: var(--danger); background: var(--danger-light); }

/* Footer & Boutons */

/* Footer & Boutons */
.form-footer { background: var(--gray-light); padding: 20px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; flex-shrink: 0; }
.btn { padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; transition: 0.2s; }
.btn-gray { background: var(--gray-button); color: var(--text-main); }
.btn-gray:hover { background: var(--gray-button-hover); }
.btn-primary { background: var(--primary); color: var(--white); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
.btn-primary:hover { transform: translateY(-2px); background: #4f46e5; }


/* --- AGENDA & TIMELINE --- */
/* --- AGENDA & TIMELINE (CORRIGÉ POUR LE RESPONSIVE) --- */
.week-selector { 
    display: flex; 
    flex-wrap: wrap; /* L'ÉLÉMENT CLÉ : Autorise le retour à la ligne */
    gap: 8px; 
    margin-bottom: 20px; 
}
.day-btn { 
    /* flex-grow: 1 (prend l'espace dispo), flex-shrink: 1, flex-basis: calcule 14% de base */
    flex: 1 1 calc(14% - 8px); 
    min-width: 45px; /* On réduit légèrement pour le mobile, tout en restant cliquable */
    padding: 8px 4px; /* On optimise l'espace intérieur */
    background: white; 
    border: 1px solid #e5e7eb; 
    border-radius: 12px; 
    text-align: center; 
    font-size: 12px; 
    font-weight: 700; 
    cursor: pointer;
    transition: 0.2s ease;
    user-select: none; /* Empêche la sélection de texte au double-clic rapide */
}

.day-btn.active { 
    border-color: var(--primary); 
    background: var(--primary-light); 
    color: var(--primary); 
}
.timeline-bar {
    display: flex;
    height: 6px;
    background: #f3f4f6; /* Fond par défaut si vide */
    border-radius: 10px;
    margin-top: 8px;
    overflow: hidden;
    width: 100%;
}
.timeline-segment {
    height: 100%;
    transition: width 0.3s ease;
}
.segment-avail { background: #22c55e; } /* Vert */
.segment-unavail { background: #ef4444; } /* Rouge */


.day-edit-panel { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 16px; padding: 16px; }
.time-slot-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.time-slot-row input { margin-bottom: 0 !important; }
.btn-text-add { background: none; border: none; color: #4f46e5; font-weight: 700; font-size: 13px; cursor: pointer; margin-top: 10px; }
.panel-header { font-size: 14px; font-weight: 700; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }

.status-radio-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.status-radio { position: relative; }
.status-radio input { position: absolute; opacity: 0; }
.status-radio label { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.status-radio input:checked + label { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.time-slots-list { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; border-top: 1px dashed var(--border); }
.time-slot-row { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; }
.btn-icon { background: var(--danger-light); color: var(--danger); border: none; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; }
.btn-icon:hover { background: var(--danger); color: var(--white); }
.btn-text-add { background: none; border: none; color: var(--primary); font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; margin-top: 8px; }


/* --- AFFICHAGE PROFIL JOUEUR --- */
.profile-bio { margin-top: 16px; padding: 16px; background: #f9fafb; border-radius: 12px; border: 1px solid #e5e7eb; font-size: 14px; line-height: 1.6; }
.action-buttons { display: flex; gap: 10px; margin: 20px 0; }
.btn-full { flex: 1; display: flex; justify-content: center; align-items: center; gap: 8px; }

/* Agenda en lecture seule */
.display-agenda { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; width: 100%;}
.display-day-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: white; border: 1px solid #e5e7eb; border-radius: 10px; }
.display-day-name { font-weight: 700; font-size: 13px; color: #4b5563; min-width: 40px; }
.status-badge-green { color: #166534; font-size: 12px; font-weight: 600; }
.status-badge-red { color: #991b1b; font-size: 12px; font-weight: 600; }

/* Badges groupés dans le header */
.badges-group { display: flex; flex-direction: column; gap: 4px; }
.badges-group .badge { background: white; color: #1f2937; border: 1px solid #e5e7eb; }

/* ================= MESSAGES D'ERREUR (AJAX) ================= */
.ajax-error-msg {
    background-color: var(--danger-light, #fef2f2);
    color: var(--danger, #ef4444);
    border: 2px solid #fca5a5;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.ajax-error-msg i {
    font-size: 18px;
}