/* ============================================================
   FISS — component.css
   Tous les composants réutilisables : cartes, boutons, modaux...
   ============================================================ */

/* ── Cards ── */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px;
  box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 10px; }
.card-title { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.card-subtitle { color: var(--ink3); font-size: 11.5px; margin-top: 2px; }
.card-hover { transition: transform var(--transition), box-shadow var(--transition); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ── Stat cards ── */
.stat-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px; display: flex; flex-direction: column; gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { font-size: 26px; }
.stat-label { color: var(--ink3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--ink); }

/* ── Boutons ── */
.btn {
  padding: 8px 16px; border-radius: var(--radius-sm); font-family: inherit;
  font-size: 13px; font-weight: 600; cursor: pointer; border: none;
  transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #a80015; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212,0,26,.3); }
.btn-secondary { background: var(--bg2); color: var(--ink2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--mid-blue); color: white; }
.btn-success:hover { background: var(--dark-navy); }
.btn-danger { background: #FCE8E8; color: var(--accent); border: 1px solid #F5C0C0; }
.btn-danger:hover { background: var(--accent); color: white; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Tags ── */
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.tag-maternelle { background: #EBF3FF; color: var(--accent4); }
.tag-elementaire { background: #E3EEFF; color: var(--mid-blue); }
.tag-college { background: #FFF0F0; color: var(--red); }
.tag-period { background: var(--bg2); color: var(--ink2); border: 1px solid var(--border); }
.tag-confirmed { background: #E8F5EE; color: #1A6B45; }
.tag-pending { background: #FFF8E0; color: #7A5A00; }
.tag-toronto { background: rgba(212,0,26,.12); color: var(--toronto); }
.tag-monaco { background: rgba(26,74,138,.12); color: var(--monaco); }
.tag-guizeh { background: rgba(201,134,10,.15); color: var(--guizeh); }

/* ── Formulaires ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-bottom: 13px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 11px; font-weight: 700; color: var(--ink2); text-transform: uppercase; letter-spacing: .06em; }
.form-field input,
.form-field select,
.form-field textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; background: var(--bg); color: var(--ink); outline: none;
  transition: border-color var(--transition);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--accent); }
.form-field textarea { resize: vertical; min-height: 80px; }
.form-full { grid-column: 1 / -1; }
.form-hint { font-size: 11px; color: var(--ink3); margin-top: 2px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px; background: none; border: none; font-family: inherit;
  font-size: 13px; font-weight: 500; color: var(--ink3); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition);
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.tab:hover:not(.active) { color: var(--ink); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,35,82,.55);
  display: none; align-items: center; justify-content: center;
  z-index: var(--z-modal); backdrop-filter: blur(3px);
  padding: 20px;
}
.modal-overlay.open { display: flex; }
/* .modal-box est un deuxième nom utilisé pour la même boîte de dialogue
   dans une partie des pages (héritage historique) — jamais défini nulle
   part avant ce correctif, ce qui rendait ces modales totalement sans
   style (pas de fond, pas de marge, pas de largeur maximale) : sur mobile
   en particulier, une modale avec une largeur fixe en pixels (ex.
   style="width:680px") débordait carrément de l'écran. */
.modal, .modal-box {
  background: var(--surface); border-radius: var(--radius); padding: 28px;
  width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn .25s ease;
}
.modal-lg, .modal-box-lg { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-title { font-family: var(--font-display); font-size: 19px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; background: var(--bg2); border: none;
  font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--ink3); transition: background var(--transition);
}
.modal-close:hover { background: var(--border); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Tableau ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--bg2); padding: 10px 13px; text-align: left;
  font-weight: 700; color: var(--ink2); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 11px 13px; border-bottom: 1px solid var(--bg2); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg); }
.data-table tr:last-child td { border-bottom: none; }

/* ── Period pill ── */
.period-pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 700; background: var(--bg2); color: var(--ink3); text-align: center;
}
.period-pill.done { background: #E8F5EE; color: #1A6B45; }
.period-pill.active { background: var(--accent); color: white; }

/* ── Notifications ── */
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-icon { font-size: 18px; width: 36px; height: 36px; background: var(--bg2); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-body { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--ink3); margin-left: auto; white-space: nowrap; }
.notif-unread .notif-icon { background: #FCE8E8; }
.notif-unread .notif-title::before { content: '● '; color: var(--accent); font-size: 8px; vertical-align: middle; }

/* ── Student row ── */
.student-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.student-row:last-child { border-bottom: none; }
.student-row:hover { background: var(--bg); }
.student-av { width: 36px; height: 36px; border-radius: 50%; color: white; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.student-name { font-size: 14px; font-weight: 500; }
.student-class { font-size: 12px; color: var(--ink3); }
.house-tag { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; color: white; }
.pts-badge { font-family: var(--font-mono); font-size: 12px; color: var(--ink3); white-space: nowrap; }

/* ── Houses ── */
.house-card {
  border-radius: var(--radius); padding: 22px 20px; text-align: center; color: white;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
}
.house-card::before {
  content: ''; position: absolute; top: -30%; right: -20%; width: 120px; height: 120px;
  background: rgba(255,255,255,.08); border-radius: 50%;
}
.house-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,.2); }
.house-badge { font-size: 38px; }
.house-name { font-family: var(--font-display); font-size: 19px; margin-top: 8px; }
.house-points { font-size: 13px; opacity: .85; margin-top: 4px; font-family: var(--font-mono); }
.house-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.house-row:last-child { border-bottom: none; }
.house-color { width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; }
.house-bar-bg { flex: 1; height: 7px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.house-bar { height: 100%; border-radius: 4px; transition: width .6s ease; }
.house-pts { font-family: var(--font-mono); font-size: 12px; color: var(--ink3); min-width: 50px; text-align: right; }

/* ── Star of the week ── */
.star-card {
  background: linear-gradient(135deg, #FFF8E8, #FEF3CE);
  border: 1px solid #F0D080; border-radius: var(--radius); padding: 24px; text-align: center;
}
.star-emoji { font-size: 46px; }
.star-name { font-family: var(--font-display); font-size: 22px; margin-top: 8px; color: var(--ink); }
.star-class { color: var(--ink3); font-size: 13px; margin-top: 4px; }
.star-quote {
  background: white; border-radius: var(--radius-sm); padding: 12px; margin: 12px 0;
  color: var(--ink2); font-size: 13px; line-height: 1.5; border: 1px solid var(--border);
  font-style: italic;
}

/* ── Assembly ── */
.assembly-item { display: flex; align-items: flex-start; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.assembly-item:last-child { border-bottom: none; }
.assembly-time { font-family: var(--font-mono); font-size: 12px; color: var(--ink3); min-width: 46px; padding-top: 1px; }
.assembly-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }

/* ── Agenda ── */
.agenda-day { margin-bottom: 22px; }
.agenda-day-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.agenda-day-num { font-family: var(--font-display); font-size: 28px; line-height: 1; color: var(--ink); min-width: 36px; }
.agenda-day-name { font-size: 13px; font-weight: 600; color: var(--ink2); }
.agenda-day-name small { display: block; color: var(--ink3); font-weight: 400; font-size: 11px; }
.agenda-event {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--border);
  margin-bottom: 6px; transition: box-shadow var(--transition);
}
.agenda-event:hover { box-shadow: var(--shadow); }
.agenda-event-color { width: 4px; height: 32px; border-radius: 2px; flex-shrink: 0; }
.agenda-event-title { font-size: 13px; font-weight: 500; }
.agenda-event-time { font-family: var(--font-mono); font-size: 11px; color: var(--ink3); margin-top: 2px; }
.agenda-event-tag { margin-left: auto; }

/* ── Cantine ── */
.menu-day { border-radius: var(--radius); padding: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.menu-day-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.menu-day-label { font-family: var(--font-display); font-size: 15px; text-transform: capitalize; }
.menu-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 13px; }
.menu-row-label { color: var(--ink3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; min-width: 82px; }
.menu-badges { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.menu-badge { padding: 3px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; background: var(--bg2); color: var(--ink3); }
.menu-badge.halal { background: #E8F5EE; color: #1A6B45; }
.menu-badge.veg { background: #EBF5FF; color: #1A4A8A; }
.menu-badge.allergen { background: #FFF8E0; color: #7A5A00; }

/* ── Clubs périscolaires ── */
.club-card { border-radius: var(--radius); padding: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition); }
.club-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.club-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.club-icon { font-size: 32px; }
.club-name { font-family: var(--font-display); font-size: 16px; }
.club-meta { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.club-places { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--ink3); }
.club-places-bar { flex: 1; height: 5px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.club-places-fill { height: 100%; border-radius: 3px; transition: width .4s; }

/* ── Ressources ── */
.ressource-card { border-radius: var(--radius); padding: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); cursor: pointer; transition: transform var(--transition), box-shadow var(--transition); }
.ressource-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ── Chat ── */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 160px); min-height: 400px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 10px; align-items: flex-start; }
.chat-msg.own { flex-direction: row-reverse; }
.chat-av { width: 34px; height: 34px; border-radius: 50%; color: white; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-bubble { max-width: 65%; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.chat-msg.own .chat-bubble { background: var(--mid-blue); color: white; border-color: var(--mid-blue); }
.chat-bubble-text { font-size: 14px; line-height: 1.5; }
.chat-bubble-meta { font-size: 10px; color: var(--ink3); margin-top: 4px; }
.chat-msg.own .chat-bubble-meta { color: rgba(255,255,255,.6); }
.chat-name { font-size: 11px; font-weight: 600; color: var(--ink3); margin-bottom: 4px; }
.chat-input-area { display: flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.chat-input {
  flex: 1; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; background: var(--bg); color: var(--ink); outline: none;
  resize: none; height: 46px; transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--accent2); }

/* ── Journées internationales ── */
.journee-card { border-radius: var(--radius); padding: 18px; border: 1px solid var(--border); background: var(--surface); transition: transform var(--transition), box-shadow var(--transition); position: relative; overflow: hidden; }
.journee-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.journee-card.ce-mois { border-color: var(--accent2); }
.journee-card.ce-mois::before { content: 'Ce mois'; position: absolute; top: 10px; right: 10px; background: var(--accent2); color: white; font-size: 9px; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .06em; }

/* ── Photos ── */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-thumb { aspect-ratio: 1; border-radius: var(--radius-sm); background: var(--bg2); display: flex; align-items: center; justify-content: center; font-size: 32px; border: 1px solid var(--border); overflow: hidden; cursor: pointer; transition: transform var(--transition); position: relative; }
.photo-thumb:hover { transform: scale(1.03); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb-overlay { position: absolute; inset: 0; background: rgba(10,35,82,.55); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.photo-thumb:hover .photo-thumb-overlay { opacity: 1; }
.photo-thumb-overlay span { color: white; font-size: 24px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: var(--z-toast);
  background: var(--ink); color: white; padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease; max-width: 360px;
}
.toast.success { background: #1A6B45; }
.toast.error { background: var(--accent); }

/* ── Utilitaires ── */
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.btn-block { width: 100%; justify-content: center; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
.btn-icon {
    background: var(--bg2);
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, background 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: var(--border);
}

/* ── Grilles supplémentaires ── */
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
@media (max-width: 1200px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px)  { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 600px)  { .grid-2 { grid-template-columns: 1fr; } }
