:root {
  --bg: #0b1020; --panel: rgba(255,255,255,0.06); --panel2: rgba(255,255,255,0.10);
  --text: rgba(255,255,255,0.9); --muted: rgba(255,255,255,0.60); --border: rgba(255,255,255,0.15);
  --accent: #4472C4; --accent2: #ED7D31; --good: #34d399; --bad: #fb7185;
}

html { font-size: 100%; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0; padding: 0; font-size: 0.85rem;
}

.container { max-width: 1200px; margin: auto; position: relative; }

/* === EN-TÊTE === */
#main-content { padding: 10px; max-width: 1200px; margin: auto; }

#main-header {
    background-image: linear-gradient(to bottom, rgba(11, 16, 32, 0.5) 0%, rgba(11, 16, 32, 0.95) 100%), url('titre.jpg');
    background-size: cover; background-position: center;
    border-radius: 15px; border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 15px 0 15px; display: flex; flex-direction: column; justify-content: space-between;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5); min-height: 70px; position: sticky; top: 10px; z-index: 1000;
}

.header-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#main-title { margin: 0; font-size: 1.6rem; font-weight: 500; text-shadow: 0 2px 10px rgba(0,0,0,0.8); display: flex; align-items: baseline; flex-wrap: wrap; line-height: 1.2; }
.header-controls { display: flex; align-items: center; gap: 10px; }

/* === BOUTON DÉCONNEXION & POLICES === */
.btn-logout { 
    background: rgba(251, 113, 133, 0.15); color: var(--bad); border: 1px solid var(--bad);
    padding: 0 14px; height: 32px; border-radius: 16px; cursor: pointer; font-weight: bold; font-size: 0.85rem; transition: 0.2s; white-space: nowrap; display: flex; align-items: center; justify-content: center; box-sizing: border-box;
}
.btn-logout:hover { opacity: 0.8; }

.font-size-control-btn {
    display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0 12px; height: 32px; border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.3); box-sizing: border-box;
}

.click-a { color: var(--text); font-weight: bold; cursor: pointer; transition: color 0.2s, transform 0.2s; user-select: none; display: flex; align-items: center; justify-content: center; }
.click-a:hover { color: white; transform: scale(1.15); }
.click-a:active { transform: scale(0.9); }
.static-label-small { font-size: 11px !important; }
.static-label-large { font-size: 18px !important; }

.font-size-indicator-container { width: 30px; height: 30px; display: flex; justify-content: center; align-items: center; }
.font-size-dot { background-color: var(--accent); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: bold; transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1); box-shadow: 0 0 5px rgba(0,0,0,0.5); user-select: none; }
.dot-1 { width: 14px; height: 14px; font-size: 10px !important; }
.dot-2 { width: 18px; height: 18px; font-size: 12px !important; }
.dot-3 { width: 22px; height: 22px; font-size: 14px !important; }
.dot-4 { width: 26px; height: 26px; font-size: 16px !important; }
.dot-5 { width: 30px; height: 30px; font-size: 18px !important; }


/* === ONGLETS === */
.header-bottom { display: flex; width: 100%; margin-top: 15px; }
.main-tabs { display: flex; gap: 4px; width: 100%; align-items: flex-end; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
.main-tabs::-webkit-scrollbar { display: none; } 

.tab-btn {
    background: rgba(255, 255, 255, 0.05); color: var(--muted); border: 1px solid rgba(255, 255, 255, 0.2); border-bottom: 3px solid transparent; 
    padding: 8px 14px; font-size: 0.95rem; cursor: pointer; border-radius: 10px 10px 0 0; transition: 0.2s; font-weight: 500; white-space: nowrap;
}
.tab-btn:hover { background: rgba(255, 255, 255, 0.15); color: white; }
.tab-btn.active { background: var(--bg); color: var(--accent); border-bottom: 3px solid var(--accent); font-weight: bold; }

#student-tab { margin-left: auto; background: rgba(68, 114, 196, 0.15); color: white; border-color: rgba(68, 114, 196, 0.3); }
.tab-select-wrapper { position: relative; overflow: hidden; }
.tab-select-wrapper select { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.tab-content { display: none; animation: fadeIn 0.2s ease-out; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.main-content-area { padding: 20px 0; position: relative; z-index: 1; }


/* === BOUTONS ET INPUTS === */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; }
.action-btn { width: auto; padding: 10px 15px; border-radius: 8px; border: none; cursor: pointer; font-weight: bold; transition: 0.2s; text-align: center; margin-top: 10px; }
.action-btn:hover { opacity: 0.8; transform: translateY(-1px); }
.blue-btn { background: var(--accent); color: white; }
.green-btn { background: var(--good); color: #000; }
.gold-btn { background: #ffd700; color: #000; }
.outline-btn { background: transparent; border: 1px solid var(--accent); color: var(--accent); }

input[type="number"].no-spinners { -moz-appearance: textfield; appearance: textfield; }
input[type="number"].no-spinners::-webkit-inner-spin-button, input[type="number"].no-spinners::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* === DASHBOARD & TABLEAUX DE NOTES === */
.dashboard { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; }
.card { flex: 1; background: var(--panel); padding: 15px; border-radius: 12px; border: 1px solid var(--border); min-width: 280px; box-sizing: border-box;}
.card h2 { margin-top: 0; font-size: 1.1rem; font-weight: 500; margin-bottom: 10px; }
.number { font-size: 1.2rem; font-weight: bold; }
.late { color: var(--bad); } .good-status { color: var(--good); }

table { width: 100%; border-collapse: collapse; margin-top: 5px; font-size: 0.9rem; table-layout: fixed; }
th, td { border: 1px solid var(--border); padding: 6px 4px; text-align: center; }
th { background-color: var(--panel2); font-weight: normal; }
#assignments-table th:first-child, #assignments-table td:first-child { text-align: left; background: var(--panel); width: 110px; padding-left: 8px; }
#assignments-table th:not(:first-child), #assignments-table td:not(:first-child) { width: 70px; overflow: hidden; }
.empty-cell { background-color: rgba(0, 0, 0, 0.4) !important; }


/* === NOUVELLES TABLES D'ADMINISTRATION DES ACCÈS COMPACTES === */
.access-table-wrapper { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
.access-table { width: 100%; table-layout: auto; margin-top: 0; font-size: 0.85rem; border: none; }
.access-table th { text-align: left; padding: 6px 8px; background: rgba(255,255,255,0.05); border: none; border-bottom: 1px solid var(--border); font-weight: bold; color: var(--muted); }
.access-table td { text-align: left; padding: 6px 8px; border: none; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: top; line-height: 1.3; }
.access-table tr:last-child td { border-bottom: none; }

/* === INDICATEURS VISUELS === */
.text-unverified { color: #fb7185 !important; } /* Rouge : email non vérifié */
.text-verified { color: #34d399 !important; font-weight: bold; } /* Vert : email vérifié sans droits */
.text-no-rights { color: #ED7D31 !important; font-style: italic; } /* Orange : profil sans utilisateur ou utilisateur orphelin */

/* Boutons et selects très compacts pour le mode édition */
.tbl-btn { background: transparent; border: 1px solid var(--border); color: white; padding: 2px 6px; border-radius: 4px; cursor: pointer; transition: 0.2s; font-size: 0.80rem; }
.tbl-btn:hover { background: rgba(255,255,255,0.1); }
.tbl-btn.edit-btn { color: var(--accent); border-color: rgba(68, 114, 196, 0.4); }
.tbl-btn.save-btn { color: var(--good); border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.1); font-weight: bold; }
.tbl-btn.del-btn { color: var(--bad); border-color: transparent; }
.tbl-btn.del-btn:hover { background: rgba(251, 113, 133, 0.1); }
.mini-select { background: rgba(0,0,0,0.5); border: 1px solid var(--border); color: white; padding: 2px 4px; border-radius: 4px; font-size: 0.80rem; height: auto; }


/* GRAPHIQUES ET NOTES */
.note-display { border-radius: 4px; cursor: pointer; min-height: 38px; width: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: 0.2s; }
.note-display:hover { background: rgba(255,255,255,0.15) !important; } 
.grade-moy { font-size: 1.2rem; font-weight: bold; margin-left: 3px; }
.chart-container { background: var(--panel); padding: 10px; border-radius: 12px; border: 1px solid var(--border); position: relative; z-index: 1;}
.graph-title { cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: color 0.2s; }
.graph-title:hover { color: var(--accent); }


/* === MODALS GÉNÉRALES === */
.modal { position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; padding: 15px; box-sizing: border-box; }
.modal-content { background: var(--bg); border-radius: 15px; border: 1px solid var(--border); width: 100%; max-height: 100%; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.modal-header { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2); }
.modal-header h2 { margin: 0; font-size: 1.1rem; color: var(--accent); }
.modal-body { padding: 15px; overflow-y: auto; }
.close-btn { color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; transition: 0.2s; }
.close-btn:hover { color: white; transform: scale(1.1); }

/* === MODALE "NOTE" === */
.note-modal-wrapper { background-color: #111827; border-radius: 16px; width: 100%; max-width: 320px; padding: 20px; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,0.6); border: 1px solid var(--border); }
.note-close-btn { position: absolute; top: 15px; right: 20px; color: var(--muted); font-size: 24px; cursor: pointer; transition: 0.2s; line-height: 1; }
.note-close-btn:hover { color: white; }
#note-modal-title { color: white; font-size: 1.1rem; text-align: center; margin-top: 0; margin-bottom: 20px; font-weight: 600; }
.note-section { background-color: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 12px 15px; margin-bottom: 15px; }
.note-section label { display: block; color: #60a5fa; font-size: 0.85rem; margin-bottom: 10px; text-align: center; }

.centered-date { width: 100%; max-width: 50%; min-width: 130px; margin: 0 auto; display: block; background: transparent; border: none; border-bottom: 2px solid var(--muted); color: white; font-size: 1.15rem; font-weight: bold; text-align: center; outline: none; padding: 5px; color-scheme: dark; transition: border-color 0.2s; border-radius: 0; }
.centered-date:focus { border-bottom-color: #60a5fa; }
.note-input-container { display: flex; justify-content: center; align-items: baseline; gap: 8px; }
.custom-note-input { background: transparent; border: none; border-bottom: 2px solid var(--muted); color: white; font-size: 1.6rem; font-weight: bold; width: 100%; max-width: 25%; min-width: 60px; text-align: center; outline: none; padding: 0 0 5px 0; border-radius: 0; transition: border-color 0.2s; }
.custom-note-input:focus { border-bottom-color: #60a5fa; }
#note-modal-max { color: var(--muted); font-size: 1.2rem; }
.note-save-btn { width: 100%; background-color: #4f46e5; color: white; border: none; border-radius: 10px; padding: 14px; font-size: 1.05rem; font-weight: bold; cursor: pointer; transition: 0.2s; }
.note-save-btn:hover { background-color: #4338ca; }


input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="date"], select { 
    background: rgba(255,255,255,0.08); border: 1px solid var(--border); color: white; padding: 10px; border-radius: 8px; width: 100%; box-sizing: border-box; font-family: inherit; 
}
select option { background-color: var(--bg); color: white; }

.subject-link { cursor: pointer; text-decoration: underline; text-decoration-color: transparent; transition: 0.2s; }
.subject-link:hover { color: var(--accent); }

#login-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.login-box { background: var(--panel); padding: 30px; border-radius: 15px; text-align: center; width: 280px; border: 1px solid var(--border); }


/* === RESPONSIVE === */
@media (max-width: 700px) {
  #main-header { padding: 12px 12px 0 12px; }
  #main-title { font-size: 1.3rem; }
  .logout-text { display: none; }
  .logout-icon { display: flex !important; align-items: center; justify-content: center; font-size: 1.2rem; margin-top: -2px; }
  .btn-logout { padding: 0; width: 32px; height: 32px; border-radius: 16px; }
  .tab-text { display: none; }
  .tab-btn { font-size: 1rem; padding: 8px 12px; } 
  .card { min-width: 100%; }
  .header-top { gap: 5px; }
  .header-controls { gap: 6px; }
  .font-size-control-btn { padding: 0 8px; gap: 6px; }
  
  .access-table th, .access-table td { padding: 8px 6px; font-size: 0.9em; }
  .tbl-btn { padding: 4px 6px; font-size: 0.8em; }
}