/* Covoiturage — thème pastel. Les couleurs --c-* sont injectées par
   templates/header.php à partir des paramètres de l'administrateur. */
:root {
  --c-principale: #a8d8ea;
  --c-secondaire: #cdb4db;
  --c-accent: #ffafcc;
  --c-fond: #f6f8fc;
  --c-surface: #ffffff;
  --c-texte: #34495e;
  --c-voiture: #a8d8ea;
  --opacite-voiture: .12;
  --c-bord: color-mix(in srgb, var(--c-texte) 14%, transparent);
  --c-muted: color-mix(in srgb, var(--c-texte) 62%, var(--c-fond));
  --c-ok: #c9ecd5;
  --c-warn: #ffeebb;
  --c-err: #ffd0d0;
  --radius: 14px;
  --ombre: 0 2px 10px color-mix(in srgb, var(--c-texte) 10%, transparent);
}

* { box-sizing: border-box; }
html { background: var(--c-fond); }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  color: var(--c-texte);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Image de voiture en fond, transparente, teintée par le thème */
.bg-voiture {
  position: fixed;
  right: -4vw;
  bottom: -2vh;
  width: min(78vw, 980px);
  aspect-ratio: 640 / 300;
  background: var(--c-voiture);
  -webkit-mask: url("../img/voiture.svg") no-repeat center / contain;
  mask: url("../img/voiture.svg") no-repeat center / contain;
  opacity: var(--opacite-voiture);
  pointer-events: none;
  z-index: 0;
}
.topbar, .container, .footer { position: relative; z-index: 1; }

a { color: color-mix(in srgb, var(--c-accent) 35%, var(--c-texte)); }
h1 { font-size: 1.6rem; margin: .3em 0 .6em; }
h2 { font-size: 1.15rem; margin: 0 0 .6em; }
.muted { color: var(--c-muted); }
.small { font-size: .85em; }

/* Barre de menu */
.topbar {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: .6rem 1.4rem;
  background: var(--c-principale);
  box-shadow: var(--ombre);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--c-texte); }
.brand-logo {
  width: 42px; height: 20px; background: var(--c-texte);
  -webkit-mask: url("../img/voiture.svg") no-repeat center / contain;
  mask: url("../img/voiture.svg") no-repeat center / contain;
}
.mainnav { display: flex; gap: .3rem; flex-wrap: wrap; flex: 1; }
.mainnav a {
  padding: .35rem .8rem; border-radius: 999px; text-decoration: none; color: var(--c-texte);
}
.mainnav a:hover { background: color-mix(in srgb, var(--c-surface) 45%, transparent); }
.mainnav a.active { background: var(--c-surface); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.userbox form { margin: 0; }
.linklike { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 1.2rem 1.4rem 2rem; flex: 1; }
.footer { text-align: center; font-size: .8rem; color: var(--c-muted); padding: 1rem; }

/* Cartes */
.card {
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  border: 1px solid var(--c-bord);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--ombre);
  backdrop-filter: blur(2px);
}
.card.narrow { max-width: 520px; margin: 2rem auto; }
.login-card { margin-top: 4rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.2rem; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + * { margin-top: 1.2rem; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: .8rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.narrow-form { max-width: 760px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
input, select, textarea {
  font: inherit; color: var(--c-texte);
  padding: .45rem .6rem;
  border: 1px solid var(--c-bord);
  border-radius: 9px;
  background: var(--c-surface);
}
input:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--c-accent) 55%, transparent); outline-offset: 1px; }
select:disabled { opacity: .45; }
fieldset { border: 1px dashed var(--c-bord); border-radius: var(--radius); padding: .8rem 1rem; }
legend { padding: 0 .4rem; font-weight: 600; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form label { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* Boutons */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none; text-align: center;
  font: inherit; font-weight: 500; color: var(--c-texte);
  padding: .45rem 1rem;
  border: 1px solid var(--c-bord);
  border-radius: 999px;
  background: var(--c-surface);
  transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(.96); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--c-principale); border-color: color-mix(in srgb, var(--c-principale) 70%, var(--c-texte)); font-weight: 600; }
.btn-secondary { background: var(--c-secondaire); border-color: color-mix(in srgb, var(--c-secondaire) 70%, var(--c-texte)); font-weight: 600; }
.btn-danger { background: var(--c-err); }
.btn-small { padding: .2rem .7rem; font-size: .85rem; }
.btn-big { padding: 1rem 2rem; font-size: 1.1rem; border-radius: var(--radius); }
.btn-big small { font-weight: 400; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Messages */
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--c-bord); }
.flash-success { background: var(--c-ok); }
.flash-error { background: var(--c-err); }
.flash-warning, .flash-info { background: var(--c-warn); }
.note { font-size: .9rem; background: color-mix(in srgb, var(--c-warn) 60%, transparent); padding: .4rem .7rem; border-radius: 9px; }

/* Badges */
.badge { display: inline-block; padding: .05rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--c-bord); vertical-align: middle; }
.badge-active { background: var(--c-ok); }
.badge-future { background: var(--c-secondaire); }
.badge-brouillon { background: color-mix(in srgb, var(--c-texte) 8%, var(--c-surface)); }
.badge-incomplete, .badge-inactif { background: var(--c-err); }
.badge-warning { background: var(--c-warn); }
.badge-admin { background: var(--c-accent); }

/* Choix de la fiche active */
.choix-active { border-left: 6px solid var(--c-ok); }
.choix-active.alerte { border-left-color: #f4a6a6; background: color-mix(in srgb, var(--c-err) 35%, var(--c-surface)); }
.choix-active .note { margin: .6rem 0 0; }

/* KPI */
.kpis { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.kpi { flex: 1 1 140px; background: color-mix(in srgb, var(--c-principale) 30%, var(--c-surface)); border-radius: var(--radius); padding: .7rem 1rem; font-size: .9rem; }
.kpi span { display: block; font-size: 1.7rem; font-weight: 700; }
.kpi-alerte { background: var(--c-err); }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .45rem .55rem; border-bottom: 1px solid var(--c-bord); text-align: left; vertical-align: top; }
.table thead th { background: color-mix(in srgb, var(--c-secondaire) 45%, var(--c-surface)); }
.table tr.exclu td { opacity: .6; }
.table td.actions { white-space: nowrap; }

/* Semaine (aperçu compact) */
.mini-semaine { border-collapse: separate; border-spacing: 4px; width: 100%; font-size: .85rem; }
.mini-semaine th { font-weight: 600; color: var(--c-muted); }
.mini-semaine td { text-align: center; padding: .3rem .2rem; border-radius: 8px; }
.type-travail { background: color-mix(in srgb, var(--c-principale) 40%, var(--c-surface)); }
.type-sans_vehicule { background: color-mix(in srgb, var(--c-accent) 35%, var(--c-surface)); }
.type-non_travaille { background: color-mix(in srgb, var(--c-texte) 7%, var(--c-surface)); color: var(--c-muted); }
.type-vide { background: var(--c-err); }

/* Saisie de la fiche */
.saisie-semaine { width: 100%; border-collapse: collapse; }
.saisie-semaine th, .saisie-semaine td { padding: .45rem; border-bottom: 1px solid var(--c-bord); text-align: left; }
.saisie-semaine thead th { background: color-mix(in srgb, var(--c-secondaire) 45%, var(--c-surface)); }
.saisie-semaine select { width: 100%; }
.saisie-semaine tr.repos td, .saisie-semaine tr.repos th { opacity: .6; }

/* Listes de fiches et conducteurs */
.fiche-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1.2rem; }
.fiche-list .card { margin: 0; }
.fiche-card header, .driver-card header { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.fiche-card header h2 { margin: 0; flex: 1; }
.fiche-card.statut-active { border: 2px solid color-mix(in srgb, var(--c-ok) 60%, var(--c-texte)); }
.fiche-card.statut-future { border: 2px dashed color-mix(in srgb, var(--c-secondaire) 70%, var(--c-texte)); }
.driver-card header { justify-content: space-between; align-items: flex-start; }
.driver-card header h2 { margin: 0; }
.driver-card header p { margin: .2rem 0 0; }
.driver-card.inactif { opacity: .7; }
.fiches-table tr.statut-active td:first-child { font-weight: 700; }
.filtres { margin-left: auto; font-size: .9rem; }
.filtres a { margin-left: .5rem; }
.filtres a.active { font-weight: 700; text-decoration: none; }

/* Apparence */
.color-row { flex-direction: row !important; align-items: center; gap: .7rem !important; font-weight: 400 !important; }
.color-row input[type=color] { width: 3rem; height: 2.2rem; padding: .1rem; cursor: pointer; }
.palettes { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1rem; }
.palette { display: flex; align-items: center; gap: 3px; padding: .4rem .7rem; border: 1px solid var(--c-bord); border-radius: var(--radius); background: var(--c-surface); cursor: pointer; font: inherit; color: var(--c-texte); }
.palette span { width: 16px; height: 22px; border-radius: 4px; border: 1px solid var(--c-bord); }
.palette strong { margin-left: .4rem; }

/* Génération */
.generate { display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: center; padding: 1.6rem; }

/* Mot de passe */
.pw-rules { list-style: none; margin: 0; padding: 0; display: flex; gap: .4rem 1rem; flex-wrap: wrap; font-size: .85rem; }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: #2e7d4f; }
.pw-rules li.ok::before { content: "✔ "; }

/* Planning */
.planning-wrap { overflow-x: auto; margin-bottom: 1.2rem; border-radius: var(--radius); box-shadow: var(--ombre); }
.planning { width: 100%; min-width: 980px; border-collapse: collapse; background: color-mix(in srgb, var(--c-surface) 94%, transparent); font-size: .86rem; table-layout: fixed; }
.planning th, .planning td { border: 1px solid var(--c-bord); padding: .4rem; vertical-align: top; }
.planning thead th { background: var(--c-secondaire); font-size: .95rem; }
.planning thead small { font-weight: 400; }
.planning .creneau-col { width: 70px; text-align: center; background: color-mix(in srgb, var(--c-principale) 55%, var(--c-surface)); font-size: 1rem; }
.planning tr.apresmidi .creneau-col { background: color-mix(in srgb, var(--c-accent) 45%, var(--c-surface)); }
.planning tr.separation th, .planning tr.separation td { border-top: 3px solid color-mix(in srgb, var(--c-texte) 30%, transparent); }
.planning tr.absents td { color: var(--c-muted); font-size: .82rem; }
.sens + .sens { margin-top: .4rem; }
.sens-titre { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); margin-bottom: .2rem; }
.vehicule { border-radius: 9px; padding: .3rem .45rem; margin-bottom: .3rem; border: 1px solid var(--c-bord); }
.vehicule-depart { background: color-mix(in srgb, var(--c-principale) 38%, var(--c-surface)); }
.vehicule-retour { background: color-mix(in srgb, var(--c-accent) 30%, var(--c-surface)); }
.v-conducteur { font-weight: 700; }
.v-info { font-weight: 400; font-size: .75rem; color: var(--c-muted); white-space: nowrap; }
.v-passagers { margin: .15rem 0 0; padding-left: 1.1rem; }
.v-seul, .v-libre { font-size: .75rem; color: var(--c-muted); }
mark.moi { background: var(--c-accent); color: var(--c-texte); border-radius: 4px; padding: 0 .25rem; font-weight: 700; }
.vehicule-moi { outline: 3px solid color-mix(in srgb, var(--c-accent) 80%, var(--c-texte)); }
.mes-trajets td, .mes-trajets th { vertical-align: middle; }
.sans-place { background: var(--c-err); border-radius: 8px; padding: .2rem .4rem; font-size: .8rem; }

@media (max-width: 720px) {
  .row2 { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar { padding: .6rem .8rem; }
  .container { padding: 1rem .8rem; }
  .saisie-semaine thead { display: none; }
  .saisie-semaine tr { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; padding: .5rem 0; border-bottom: 1px solid var(--c-bord); }
  .saisie-semaine th { grid-column: 1 / -1; border: 0; }
  .saisie-semaine td { border: 0; padding: 0; }
  .saisie-semaine td:nth-of-type(1) { grid-column: 1 / -1; }
}
