/* ===== eCalendar Family — charte de marque edukisto =====
   Fond anthracite #333333 · surface #3d3d3d · accent unique #38bdf8
   Variante teal du logo #0e7490 · rayon 8px (kit de marque) ===== */
:root {
    --accent: #38bdf8;
    --accent-2: #38bdf8;
    --teal: #0e7490;
    --teal-clair: #7dd3fc;
    --fond: #333333;
    --surface: #3d3d3d;
    --bord: #4a4a4a;
    --texte: #ffffff;
    --muted: #a8b3bd;
    --vert: #2ecc71;
    --rouge: #ef5b7c;
    --orange: #f59e0b;
    --violet: #b085f5;
    --bleu-clair: #38bdf8;
    --cyan: #38bdf8;
    --bleu-vac: #24445a;
    --rouge-ferie: #4d2733;
    --gris-we: #383838;
    --radius: 8px;
    /* alias historiques */
    --bleu-fonce: #333333;
    --bleu: #0e7490;
    --blanc: #3d3d3d;
}
body.sombre {
    --fond: #1f1f1f;
    --surface: #2a2a2a;
    --bord: #3a3a3a;
    --bleu-vac: #1c3a4d;
    --gris-we: #262626;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--fond);
    color: var(--texte);
}

/* ===== En-tête ===== */
.app-header {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--fond); border-bottom: 1px solid var(--bord); color: #fff;
    padding: 10px 18px; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
.brand-logo svg { width: 34px; height: 34px; display: block; }
.brand { font-size: 1.2em; font-weight: bold; }
.brand em { color: var(--accent); font-style: normal; }
.header-date { font-size: .85em; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-right: auto; }
.tab {
    background: transparent; color: var(--muted); border: none; padding: 12px 16px;
    font-size: 1em; cursor: pointer; border-radius: 8px; font-weight: 600;
    min-height: 44px;
}
.tab.active { background: var(--teal); color: #fff; }
.tab:hover { color: #fff; }

/* ===== Vues / cartes ===== */
.view { display: none; padding: 20px; max-width: 1400px; margin: 0 auto; }
.view.active { display: block; }
.card {
    background: var(--surface); border: 1px solid var(--bord);
    border-radius: var(--radius); padding: 16px; margin-bottom: 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
h1 { color: #fff; font-size: 1.5em; margin: 0; }
h2 { margin: 0 0 10px; color: #fff; font-size: 1.1em; }
.hint { font-size: .82em; color: var(--muted); }
.today-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }

/* ===== Boutons / inputs ===== */
.btn {
    background: var(--teal); color: #fff; border: none; padding: 12px 16px;
    border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: .9em;
    min-height: 44px; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: var(--accent); color: #0e2230; }
.btn-orange { background: var(--orange); }
.btn-danger { background: var(--rouge); }
.btn-mini { padding: 6px 10px; font-size: .8em; min-height: 36px; }
.input {
    padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--bord);
    font-size: .95em; background: var(--fond); color: var(--texte); min-width: 120px;
}
.panel-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.panel-toolbar .input { flex: 1; }

/* ===== Aujourd'hui ===== */
.today-hero { background: linear-gradient(135deg, var(--fond), var(--teal)); border: 1px solid var(--bord); color: #fff; }
.today-hero .hero-date { font-size: 1.9em; font-weight: bold; }
.today-hero .hero-sous { opacity: .9; margin-top: 6px; font-size: 1.05em; line-height: 1.6; }
.today-hero .badge {
    display: inline-block; background: rgba(255,255,255,.2); border-radius: 14px;
    padding: 4px 12px; margin: 4px 6px 0 0; font-size: .9em;
}
.today-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--bord); }
.today-item:last-child { border-bottom: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
hint a, a { color: var(--accent); }

/* ===== Calendrier ===== */
.cal-toolbar { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-legend .leg { display: inline-flex; align-items: center; gap: 6px; font-size: .82em; color: var(--muted); }
.cal-grille { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-jour-tete { text-align: center; font-weight: bold; color: #fff; padding: 6px 0; }
.cal-cell {
    background: var(--surface); border: 1px solid var(--bord); border-radius: var(--radius);
    min-height: 96px; padding: 6px; cursor: pointer; position: relative;
    overflow: hidden; font-size: .82em;
}
.cal-cell.hors-mois { opacity: .35; }
.cal-cell.weekend { background: var(--gris-we); }
.cal-cell.ferie { background: var(--rouge-ferie); }
.cal-cell.vacances { background: var(--bleu-vac); }
.cal-cell.aujourdhui { border: 2px solid var(--rouge); }
.cal-cell .num { font-weight: bold; }
.cal-cell .ev { border-radius: 4px; padding: 2px 4px; margin-top: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-cell .anniv { color: var(--rouge); font-weight: 600; }

/* ===== Repas ===== */
.repas-semaine { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.repas-jour { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--radius); padding: 12px; min-height: 130px; cursor: pointer; }
.repas-jour h3 { margin: 0 0 8px; font-size: 1em; color: var(--accent); }
.repas-jour .repas-nom { font-size: .9em; color: var(--texte); }
.repas-jour .repas-nom.selectable:hover { color: var(--orange); }
.plats-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.plat-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 8px; font-size: .88em; }
.plat-item .cat { font-size: .78em; padding: 2px 8px; border-radius: 10px; background: rgba(56,189,248,.15); color: var(--accent); white-space: nowrap; }

/* ===== Tâches / objectifs ===== */
.tache-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.tache-item:last-child { border-bottom: none; }
.tache-item input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--vert); }
.tache-item.done .tache-titre { text-decoration: line-through; opacity: .5; }
.tache-titre { flex: 1; }
.pts { background: var(--orange); color: #1f1f1f; border-radius: 12px; padding: 2px 10px; font-size: .8em; font-weight: bold; }
.progress-bar { height: 14px; background: var(--bord); border-radius: 8px; overflow: hidden; margin: 8px 0; }
.progress-bar > div { height: 100%; background: var(--vert); border-radius: 8px; transition: width .3s; }

/* ===== Listes ===== */
.listes-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.liste-item { padding: 8px 0; border-bottom: 1px solid var(--bord); display: flex; gap: 10px; align-items: center; }
.liste-item input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--vert); }
.liste-item.done span { text-decoration: line-through; opacity: .5; }

/* ===== Photos ===== */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.photos-grid img, .repas-jour img, .today-item img { width: 100%; border-radius: 8px; object-fit: cover; }
.cadre-full { position: fixed; inset: 0; background: #000; z-index: 500; display: flex; align-items: center; justify-content: center; }
.cadre-full img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.hidden { display: none !important; }

/* ===== Modale / toast ===== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 400; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-content { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--radius); padding: 20px; max-width: 560px; width: 100%; max-height: 88vh; overflow: auto; }
.modal-content h2 { margin-bottom: 14px; }
.modal-content label { display: block; font-weight: 600; font-size: .85em; margin: 12px 0 4px; }
.modal-content .input, .modal-content select, .modal-content textarea { width: 100%; }
.modal-content textarea { min-height: 60px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--teal); color: #fff; padding: 12px 22px; border-radius: var(--radius);
    z-index: 600; box-shadow: 0 4px 14px rgba(0,0,0,.45); font-size: .95em;
}
.toast.err { background: var(--rouge); }

.switch { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: .92em; }
.switch input { width: 22px; height: 22px; accent-color: var(--vert); }

/* ===== Mode kiosque ===== */
body.kiosque .tab[data-view="reglages"] { display: none; }

@media (max-width: 700px) {
    .cal-cell { min-height: 60px; font-size: .68em; }
    .view { padding: 12px; }
    .tab { padding: 10px 10px; font-size: .85em; }
}
