/* =============================================================
   Tableau Fil de l'eau - feuille de style
   Theme aquarelle bleue, Ville de La Bassee
   ============================================================= */
:root {
  --navy: #15375f;
  --navy-soft: #1f4f86;
  --blue: #2f86c9;
  --blue-light: #d9ecfb;
  --blue-lighter: #eef7fe;
  --sky: #bfe2f7;
  --ink: #1c2b3a;
  --line: #cfe2f1;
  --ok: #1e9e6a;
  --warn: #c97a12;
  --err: #c0392b;
  --paper: #ffffff;
  --shadow: 0 10px 30px rgba(21, 55, 95, 0.12);
  --radius: 16px;
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 50% -120px, #eaf5ff 0%, transparent 60%),
    linear-gradient(180deg, #f5fbff 0%, #eef6fd 100%);
  min-height: 100vh;
}

/* Bandeaux d'eau decoratifs */
.water-top, .water-bottom {
  height: 14px;
  background: linear-gradient(90deg, var(--sky), var(--blue), var(--sky));
  background-size: 200% 100%;
}
.water-top { box-shadow: 0 2px 10px rgba(47,134,201,.4); }

/* En-tete */
.site-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: #fff;
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.title-block h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: .5px;
  font-weight: 800;
}
.subtitle { margin: 6px 0 0; color: var(--sky); font-size: 15px; }
.logo {
  height: 70px;
  background: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* Banniere info */
.info-banner {
  max-width: 1080px;
  margin: 14px auto 0;
  padding: 12px 18px;
  background: #fff6e6;
  border: 1px solid #f0d39a;
  color: #8a5a12;
  border-radius: 12px;
  font-size: 14px;
}

/* Conteneur */
.container { max-width: 1080px; margin: 0 auto; padding: 22px 24px 40px; }
.help {
  color: var(--navy-soft);
  background: var(--blue-lighter);
  border-left: 4px solid var(--blue);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  margin: 6px 0 22px;
}

/* Onglets de jours */
.day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.tab {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s;
  box-shadow: 0 2px 6px rgba(21,55,95,.06);
}
.tab:hover { transform: translateY(-2px); border-color: var(--blue); }
.tab.active {
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  border-color: var(--navy);
  box-shadow: var(--shadow);
}
.tab.active .tab-day, .tab.active .tab-num { color: #fff; }
.tab-day { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--navy-soft); font-weight: 700; }
.tab-num { font-size: 22px; font-weight: 800; color: var(--navy); }
.tab-tag {
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
}
.tab-tag.semaine { background: var(--blue-light); color: var(--navy-soft); }
.tab-tag.weekend { background: #ffe7cf; color: #b25e12; }

/* Panneau du jour */
.day-panel {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
}
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(90deg, var(--blue-lighter), #fff);
  border-bottom: 1px solid var(--line);
}
.day-head h2 { margin: 0; color: var(--navy); font-size: 22px; }
.day-head-right { display: flex; align-items: center; gap: 14px; }
.day-type {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.day-type.semaine { background: var(--blue-light); color: var(--navy-soft); }
.day-type.weekend { background: #ffe7cf; color: #b25e12; }

.status { font-size: 13px; min-width: 130px; text-align: right; }
.status.saving { color: var(--warn); }
.status.saved { color: var(--ok); }
.status.error { color: var(--err); }
.status.saved::before { content: "\2713  "; }

/* Tableau */
.grid-wrap { padding: 8px 14px 18px; overflow-x: auto; }
.planning-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
.planning-table th {
  background: linear-gradient(180deg, var(--blue), var(--navy-soft));
  color: #fff;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 14px;
  text-align: left;
}
.planning-table th.col-name { text-align: center; }
.planning-table td { border: 1px solid var(--line); padding: 0; }

.action-cell {
  padding: 14px 16px;
  background: var(--blue-lighter);
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  vertical-align: middle;
}
.post-head { display: flex; align-items: center; gap: 8px; }
.post-icon { font-size: 20px; line-height: 1; }
.post-label { font-style: italic; font-size: 16px; }
.post-count {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(47, 134, 201, .12);
  font-style: normal;
  font-weight: 700;
  font-size: 11px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.creneau-cell {
  padding: 10px 14px;
  background: #f7fbff;
  font-weight: 600;
  color: var(--navy-soft);
  white-space: nowrap;
  text-align: center;
}
.post-first td { border-top: 2px solid var(--blue); }

.name-cell { background: #fff; }
.name-cell.empty { background: repeating-linear-gradient(45deg, #f4f8fc, #f4f8fc 6px, #eef4fa 6px, #eef4fa 12px); }

/* Poste supplementaire (ex : Flambeaux) - accent chaud */
.action-cell.action-extra {
  background: linear-gradient(180deg, #fff1e2, #ffe6cc);
  border-left: 4px solid #e8862f;
}
.action-cell.action-extra .post-count { color: #c96a14; background: rgba(232, 134, 47, .16); }
.name-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--ink);
  text-align: center;
}
.name-input::placeholder { color: #aac4da; font-style: italic; }
.name-input:focus {
  outline: none;
  background: var(--blue-lighter);
  box-shadow: inset 0 0 0 2px var(--blue);
}
.name-cell:hover { background: #f4faff; }

/* Pied de page */
.site-footer {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-mark { color: #8aa6bd; font-size: 13px; }

/* =============================================================
   VUE CARTES (mobile) - une carte par poste
   ============================================================= */
.post-cards { display: flex; flex-direction: column; gap: 14px; padding: 12px; }
.post-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(21, 55, 95, .06);
}
.post-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--blue-lighter);
  border-bottom: 1px solid var(--line);
}
.post-card-head .post-icon { font-size: 22px; line-height: 1; }
.post-card-head .post-label {
  font-style: italic; font-size: 17px; font-weight: 700; color: var(--navy);
}
.post-card-head .post-count {
  margin: 0 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(47, 134, 201, .12);
  color: var(--blue);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  white-space: nowrap;
}
.post-card-extra .post-card-head {
  background: linear-gradient(180deg, #fff1e2, #ffe6cc);
  border-left: 4px solid #e8862f;
}
.post-card-extra .post-count { color: #c96a14; background: rgba(232, 134, 47, .16); }

.post-card-body { padding: 4px 14px 12px; }
.slot-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.slot-row:first-child { border-top: none; }
.slot-time {
  font-size: 13px; font-weight: 700; color: var(--navy-soft);
  text-transform: uppercase; letter-spacing: .4px;
}
.slot-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.slot-inputs .name-input {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbff;
  padding: 12px 14px;
  font-size: 16px;            /* >= 16px pour eviter le zoom auto iOS */
  text-align: left;
  min-height: 48px;
}
.slot-inputs .name-input:focus {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--blue);
}

/* =============================================================
   ADAPTATIONS MOBILE
   ============================================================= */
@media (max-width: 640px) {
  .title-block h1 { font-size: 22px; }
  .subtitle { font-size: 13px; }
  .logo { height: 50px; }
  .header-inner { padding: 16px; gap: 12px; }

  .container { padding: 16px 14px 32px; }
  .help { font-size: 14px; padding: 10px 12px; margin-bottom: 16px; }

  /* Onglets : bande defilante horizontale au lieu d'un retour a la ligne */
  .day-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin: 0 -14px 16px;
    padding: 2px 14px 8px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 62px;
    padding: 8px 10px;
  }
  .tab-num { font-size: 20px; }

  /* En-tete du jour empile */
  .day-head { flex-direction: column; align-items: stretch; gap: 8px; padding: 14px 16px; }
  .day-head h2 { font-size: 19px; }
  .day-head-right { width: 100%; justify-content: space-between; }
  .status { min-width: 0; }

  /* Les cartes gerent leur propre marge interieure */
  .grid-wrap { padding: 0; overflow: visible; }
}

/* =============================================================
   PAGE EXPORT (admin.html)
   ============================================================= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 32px 30px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card .logo { height: 64px; margin-bottom: 8px; }
.login-card h1 { color: var(--navy); margin: 6px 0; font-size: 22px; }
.login-card p { color: #5d7b94; margin: 0 0 18px; font-size: 14px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 12px;
}
.login-card input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.login-card button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.login-card button:hover { filter: brightness(1.08); }
.login-err { color: var(--err); min-height: 18px; font-size: 14px; }
.back-link { color: var(--navy-soft); font-size: 14px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.export-app { max-width: 1080px; margin: 0 auto; padding: 0 24px 40px; }
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: #fff;
  padding: 14px 18px;
  border-radius: 0 0 14px 14px;
  margin-bottom: 16px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-logo { height: 34px; background: #fff; padding: 4px 6px; border-radius: 8px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.btn-primary, .btn-ghost {
  border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 700;
  cursor: pointer; text-decoration: none; border: 1px solid rgba(255,255,255,.5);
}
.btn-primary { background: #fff; color: var(--navy); border-color: #fff; }
.btn-primary:hover { filter: brightness(.95); }
.btn-ghost { background: transparent; color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); }

.export-status { color: var(--navy-soft); font-weight: 600; margin: 4px 0; }
.export-hint {
  color: #5d7b94; font-size: 14px; background: var(--blue-lighter);
  border-left: 4px solid var(--blue); padding: 10px 14px; border-radius: 10px;
}

.sheets { display: flex; flex-direction: column; gap: 22px; }
.day-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.sheet-logo { height: 46px; }
.sheet-head h2 { margin: 0; color: var(--navy); font-size: 20px; }
.sheet-head p { margin: 2px 0 0; color: var(--navy-soft); font-size: 14px; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th {
  background: var(--navy-soft); color: #fff; text-align: left;
  padding: 8px 12px; font-size: 12px; text-transform: uppercase;
}
.sheet-table td { border: 1px solid var(--line); padding: 9px 12px; font-size: 14px; }
.s-action { background: var(--blue-lighter); font-weight: 700; color: var(--navy); white-space: nowrap; }
.s-action.s-extra { background: #ffe6cc; border-left: 3px solid #e8862f; }
.s-creneau { background: #f7fbff; color: var(--navy-soft); font-weight: 600; white-space: nowrap; }
.s-name { min-width: 150px; }
.s-name:empty::after { content: "\00a0"; }
