/* === RESET & VARIABLES === */
:root {
    /* Palette harmonisée pour fond rouge : Anthracite et Bordeaux */
    --primary: #2d2d2d; 
    --secondary: #5a5a5a;
    --accent: #c0392b; 
    --light: rgba(255, 255, 255, 0.7); 
    --border: rgba(189, 195, 199, 0.6);
    --success: #27ae60;
    --warning: #e67e22;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

/* === ARRIÈRE-PLAN ET EFFET VERRE === */
body { 
    background: url('img_fond.png') no-repeat center center fixed; 
    background-size: cover;
    color: #333; 
    overflow-y: auto; 
}

header { background: rgba(45, 45, 45, 0.9); color: white; text-align: center; backdrop-filter: blur(5px); }
h1 { padding: 15px; }

/* === ONGLETS ÉLARGIS === */
.tabs-container { background: rgba(0,0,0,0.3); padding-top: 10px; }
.tabs { display: flex; justify-content: center; width: 100%; max-width: 800px; margin: 0 auto; }
.tab-btn { flex: 1; background: transparent; color: white; border: none; padding: 15px 25px; font-size: 1.1em; cursor: pointer; transition: background 0.3s; border-radius: 8px 8px 0 0; margin: 0 5px; }
.tab-btn:hover { background: rgba(255,255,255,0.15); }
.tab-btn.active { background: rgba(192, 57, 43, 0.95); font-weight: bold; backdrop-filter: blur(5px); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === BOUTONS & FORMULAIRES === */
.btn-primary { width: 100%; padding: 12px; background: rgba(192, 57, 43, 0.9); color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 1em; font-weight: bold; transition: 0.2s; backdrop-filter: blur(2px); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.btn-primary:hover:not(:disabled) { background: #e74c3c; transform: scale(1.02); }
.btn-primary:disabled { background: var(--secondary); cursor: not-allowed; opacity: 0.7; }
.btn-secondary { width: 100%; padding: 10px; background: rgba(90, 90, 90, 0.9); color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 0.95em; transition: 0.2s; backdrop-filter: blur(2px);}
.btn-secondary:hover { background: #7f8c8d; transform: scale(1.02); }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: bold; margin-bottom: 5px; color: var(--primary); }
.form-group input[type="text"], .form-group input[type="file"] { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 4px; background: rgba(255, 255, 255, 0.9); color: var(--primary); }

/* === TOAST NOTIFICATIONS ET ANIMATIONS === */
#toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: rgba(45, 45, 45, 0.95); color: white; padding: 15px 20px; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); font-weight: bold; display: flex; align-items: center; gap: 10px; transform: translateX(120%); animation: slideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards, fadeOut 0.5s 4s forwards; border-left: 5px solid var(--success); backdrop-filter: blur(5px);}
@keyframes slideIn { to { transform: translateX(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-20px); } }

.drumroll-container { font-size: 1.5em; font-weight: bold; color: var(--primary); text-align: center; padding: 40px 20px; background: rgba(255, 255, 255, 0.85); border-radius: 8px; border: 2px dashed var(--accent); grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 15px; backdrop-filter: blur(10px); }
.drumroll-icon { font-size: 2.5em; animation: wobble 0.5s infinite alternate; display: inline-block; }
@keyframes wobble { from { transform: rotate(-10deg) scale(1); } to { transform: rotate(10deg) scale(1.2); } }

/* === PANNEAUX TRANSLUCIDES (GLASSMORPHISM) === */
.setup-panel, .sidebar, .main-content { 
    background: rgba(255, 255, 255, 0.9); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); 
}

/* === ONGLET 1 : SETUP & GROUPES === */
.setup-container { display: flex; flex-direction: column; padding: 15px; gap: 20px; }
.setup-panel { padding: 25px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.3); }
.table-container { max-height: 400px; overflow-y: auto; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.6); border-radius: 6px;}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: rgba(236, 240, 241, 0.95); position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1); backdrop-filter: blur(5px); color: var(--primary); }
.tt-checkbox { transform: scale(1.5); cursor: pointer; position: relative; z-index: 1; accent-color: var(--accent); }

.groups-grid { display: grid; grid-template-columns: 1fr; gap: 15px; margin-top: 20px; }
.group-card { border: 2px solid rgba(192, 57, 43, 0.6); border-radius: 8px; overflow: hidden; animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; opacity: 0; transform: scale(0.8); background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(4px); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
@keyframes popIn { to { opacity: 1; transform: scale(1); } }
.group-card h4 { background: rgba(192, 57, 43, 0.9); color: white; padding: 10px; text-align: center; font-size: 1.1em; }
.group-card ul { list-style: none; padding: 10px 15px; }
.group-card li { padding: 8px 0; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; font-weight: 500;}
.group-card li:last-child { border-bottom: none; }
.tt-badge { background: var(--warning); color: white; font-size: 0.75em; padding: 3px 8px; border-radius: 12px; }

/* === ONGLET 2 : ÉVALUATION === */
.container { display: flex; flex-direction: column; width: 100%; }
.sidebar { padding: 15px; border-bottom: 2px solid var(--border); }
.import-box { padding: 15px; background: rgba(192, 57, 43, 0.08); border-radius: 8px; border: 1px solid rgba(192, 57, 43, 0.2); }
.student-list { list-style: none; margin-top: 15px; }
.student-list li { padding: 12px 10px; background: rgba(255, 255, 255, 0.8); border: 1px solid var(--border); margin-bottom: 5px; cursor: pointer; border-radius: 6px; transition: all 0.2s; font-weight: 500;}
.student-list li:hover { background: rgba(255, 255, 255, 1); transform: translateX(5px); }
.student-list li.active { border-left: 5px solid var(--accent); font-weight: bold; background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.1); color: var(--accent); }
.student-list li .badge { float: right; background: var(--success); color: white; padding: 3px 8px; border-radius: 12px; font-size: 0.8em; }

.main-content { padding: 15px; }
.student-title { color: var(--primary); margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid var(--border); font-size: 1.8em; }
.competence-box { background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(189, 195, 199, 0.8); padding: 15px; margin-bottom: 15px; border-radius: 8px; backdrop-filter: blur(5px); }
.competence-box h3 { font-size: 1.1em; color: var(--primary); margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.competence-box h3 span { font-size: 0.9em; background: rgba(255, 255, 255, 0.9); color: var(--primary); padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); display: flex; align-items: center; gap: 5px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); }
.coef-input { width: 50px; padding: 4px; border: 1px solid var(--border); border-radius: 4px; text-align: center; font-weight: bold; font-size: 1em; color: var(--accent); background: transparent; }

.radio-group { display: flex; justify-content: space-between; margin-bottom: 12px; background: rgba(255, 255, 255, 0.9); padding: 12px; border-radius: 6px; border: 1px solid var(--border); box-shadow: inset 0 1px 3px rgba(0,0,0,0.02); }
.radio-group label { cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: bold; color: var(--primary); font-size: 1.1em; }
.radio-group input[type="radio"] { accent-color: var(--accent); transform: scale(1.2); }
textarea { width: 100%; height: 70px; resize: vertical; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: rgba(255, 255, 255, 0.9); color: var(--primary); font-weight: 500; font-size: 0.95em; line-height: 1.4; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2); }
.appreciation-box label { font-weight: bold; display: block; margin-bottom: 8px; color: var(--primary); }
.appreciation-box textarea { height: 110px; }
.note-display { font-size: 2.2em; font-weight: bold; text-align: center; color: var(--primary); padding: 25px; border: 3px dashed rgba(192, 57, 43, 0.6); margin-top: 20px; border-radius: 12px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(4px); box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.note-display span { color: var(--accent); }

/* === RESPONSIVE VUES === */
@media (min-width: 725px) {
    .groups-grid { grid-template-columns: 1fr 1fr; }
    .container { flex-direction: row; height: calc(100vh - 120px); overflow: hidden; }
    .sidebar { width: 320px; height: 100%; overflow-y: auto; border-bottom: none; border-right: 1px solid var(--border); }
    .main-content { flex: 1; height: 100%; overflow-y: auto; padding: 25px; }
}

@media (min-width: 1025px) {
    .setup-container { flex-direction: row; max-width: 1400px; margin: 0 auto; padding: 25px; }
    .setup-panel { flex: 1; }
    .groups-grid { grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
    .main-content { overflow-y: hidden; display: flex; flex-direction: column; padding: 30px; }
    .evaluation-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; flex: 1; }
    .bottom-section { display: grid; grid-template-columns: 3fr 1fr; gap: 25px; margin-top: 20px; align-items: stretch; }
    .note-display { margin-top: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; }
}

/* === IMPRESSION === */
#print-zone { display: none; }
@media print {
    body { background: white !important; }
    .setup-panel, .sidebar, .main-content { background: white !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; box-shadow: none !important; }
    
    body * { visibility: hidden; }
    #print-zone, #print-zone * { visibility: visible; color: black !important; }
    #print-zone { position: absolute; left: 0; top: 0; width: 100%; display: block; }
    .fiche-impression { page-break-after: always; padding: 20px; font-family: serif; }
    .fiche-impression h1 { text-align: center; border-bottom: 2px solid black; padding-bottom: 10px; color: black; }
    .fiche-impression .header-info { display: flex; justify-content: space-between; margin: 20px 0; font-size: 1.2em; }
    .fiche-impression table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
    .fiche-impression th, .fiche-impression td { border: 1px solid black; padding: 10px; text-align: left; }
    .fiche-impression th { background-color: #f0f0f0 !important; -webkit-print-color-adjust: exact; }
    .fiche-impression .note-finale { font-size: 1.5em; font-weight: bold; text-align: right; margin-top: 20px; }
    
    .cases-vides span { display: inline-block; width: 20px; height: 20px; border: 1px solid black; margin-right: 5px; vertical-align: middle; }
    .cases-vides { display: flex; justify-content: space-around; font-weight: bold; font-family: sans-serif; }
}