/* ===========================================================
   Claveres — Photos
   Palette :
     --bg        #F7F4EE  fond papier chaud
     --surface   #FFFFFF  cartes / formulaire
     --ink       #2B2B28  texte principal
     --muted     #6B675F  texte secondaire
     --accent    #1F5D5B  vert-bleu profond (confiance, lisible)
     --accent-dk #163F3D  accent foncé (survol, sidebar)
     --border    #E3DFD3
     --danger    #A63A32
   Police : Atkinson Hyperlegible — conçue pour la lisibilité,
   particulièrement adaptée à un public senior. Servie par la page
   elle-même (assets/fonts, licence OFL dans OFL.txt, caractères latins,
   accents compris) depuis le 07/11/2026 : chargée chez Google Fonts, elle
   transmettait à Google l'adresse de chaque visiteur, et la politique de
   sécurité (.htaccess) n'accepte que les polices de la page.
   =========================================================== */

@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/atkinson-hyperlegible-400-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/atkinson-hyperlegible-700-latin.woff2') format('woff2');
}

:root {
  --bg: #F7F4EE;
  --surface: #FFFFFF;
  --ink: #2B2B28;
  --muted: #6B675F;
  --accent: #1F5D5B;
  --accent-dk: #163F3D;
  --border: #E3DFD3;
  --danger: #A63A32;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Atkinson Hyperlegible', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 19px;
  line-height: 1.5;
}

a { color: var(--accent); }
a:focus, button:focus, input:focus, select:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------
   Page publique d'envoi
   --------------------------------------------------------- */

.upload-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 20px 80px;
}

.upload-card {
  width: 100%;
  max-width: 480px;
}

.upload-card .logo-wrap {
  text-align: center;
  margin-bottom: 8px;
}

.upload-card .logo-wrap img {
  max-width: 220px;
  max-height: 120px;
  height: auto;
}

.upload-card h1 {
  text-align: center;
  font-size: 28px;
  margin: 20px 0 6px;
}

.upload-card .intro {
  text-align: center;
  color: var(--muted);
  font-size: 19px;
  margin: 0 0 32px;
  padding: 0 8px;
}

.form-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
}

.field { margin-bottom: 24px; }

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 19px;
}

.field .hint {
  display: block;
  color: var(--muted);
  font-size: 16px;
  margin-top: 6px;
}

.field input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 19px;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}

.file-picker {
  display: block;
  width: 100%;
  padding: 18px 16px;
  font-size: 19px;
  font-family: inherit;
  font-weight: 700;
  text-align: center;
  color: var(--accent-dk);
  background: var(--bg);
  border: 2px dashed var(--accent);
  border-radius: 10px;
  cursor: pointer;
}

/* Champ natif (« Choisir des fichiers ») caché derrière le cadre ci-dessus,
   qui l'ouvre. Invisible mais pas en display:none : sans photo choisie,
   Chrome refuserait alors l'envoi sans rien dire (champ obligatoire qu'il ne
   peut pas montrer). Placé sous le milieu du cadre, sa bulle « Sélectionnez
   un fichier » pointe sur « Choisir des photos ». */
.field { position: relative; }

.file-picker + input[type="file"] {
  position: absolute;
  left: 50%;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
}

/* Au clavier, c'est le champ caché qui a le focus : le cadre le montre. */
.field:has(input[type="file"]:focus-visible) .file-picker {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#file-count {
  display: block;
  margin-top: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 17px;
}

.submit-btn {
  width: 100%;
  padding: 18px;
  font-size: 21px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.submit-btn:hover, .submit-btn:active { background: var(--accent-dk); }

.upload-error {
  margin: 0 0 16px;
  color: var(--danger);
  font-size: 17px;
  font-weight: 700;
}

.upload-error[hidden] { display: none; }

/* Avancée de l'envoi (à la place du bouton, voir upload.js) */
.upload-progress[hidden], .submit-btn[hidden], .cancel-btn[hidden] { display: none; }

.upload-progress-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.upload-bar {
  height: 22px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}

.upload-bar-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease-out;
}

.upload-status {
  margin: 10px 0 0;
  text-align: center;
  font-size: 17px;
}

.upload-keep-open {
  margin: 4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
}

.upload-warning {
  margin: 16px 0 0;
  padding: 12px 14px;
  font-size: 17px;
  color: #6B4A00;
  background: #FFF4D6;
  border: 2px solid #E0B44A;
  border-radius: 10px;
}

.upload-warning[hidden] { display: none; }

.cancel-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  color: var(--danger);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.cancel-btn:hover, .cancel-btn:active { border-color: var(--danger); }

.honeypot { position: absolute; left: -9999px; top: -9999px; }

.result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
}

.result-box.ok { border-top: 6px solid var(--accent); }
.result-box.error { border-top: 6px solid var(--danger); }

.result-box h1 { font-size: 26px; margin-top: 0; }

.result-box p { color: var(--muted); font-size: 19px; }

.back-link {
  display: inline-block;
  margin-top: 20px;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 20px;
  border: 2px solid var(--accent);
  border-radius: 10px;
}

.error-list {
  text-align: left;
  color: var(--danger);
  font-size: 17px;
}

/* ---------------------------------------------------------
   Tableau de bord (admin)
   --------------------------------------------------------- */

body.dashboard {
  display: flex;
  min-height: 100vh;
  font-size: 17px;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--accent-dk);
  color: #fff;
  padding: 28px 20px;
}

.sidebar h2 {
  font-size: 19px;
  margin: 0 0 24px;
}

.sidebar ul { list-style: none; padding: 0; margin: 0; }

.sidebar li + li { margin-top: 4px; }

.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #EDEAE0;
  text-decoration: none;
}

.sidebar a:hover, .sidebar a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1000px;
}

.main h1 { font-size: 26px; margin-top: 0; }

.stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  min-width: 160px;
}

.stat .num {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent-dk);
  display: block;
}

.stat .label { color: var(--muted); font-size: 15px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.card h3 { margin-top: 0; font-size: 18px; }

table.submissions {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

table.submissions th, table.submissions td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}

table.submissions th { color: var(--muted); font-weight: 700; font-size: 14px; }

.btn-dl {
  display: inline-block;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
}

.btn-dl:hover { background: var(--accent-dk); }

.empty-msg { color: var(--muted); padding: 12px 0; }

.recent-list { list-style: none; padding: 0; margin: 0; }

.recent-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.recent-list li:last-child { border-bottom: none; }

.recent-list .name { font-weight: 700; }

.recent-list .meta { color: var(--muted); font-size: 14px; }

.actions-cell {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-view {
  display: inline-block;
  padding: 8px 16px;
  background: var(--surface);
  color: var(--accent-dk);
  border: 2px solid var(--accent);
  border-radius: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.btn-view:hover { background: var(--bg); }

/* ---------------------------------------------------------
   Modale d'aperçu photo
   --------------------------------------------------------- */

.viewer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 18, 0.82);
  z-index: 1000;
  padding: 24px;
  align-items: center;
  justify-content: center;
}

.viewer-overlay.open { display: flex; }

.viewer-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.viewer-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  z-index: 2;
}

.viewer-close:hover { color: var(--ink); }

.viewer-header {
  padding: 18px 50px 6px 20px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.viewer-header span:first-child {
  font-weight: 700;
  font-size: 17px;
}

.viewer-count {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.viewer-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  flex: 1;
  min-height: 0;
}

.viewer-media {
  flex: 1;
  min-height: 260px;
  max-height: 65vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
}

.viewer-media img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
}

.viewer-unsupported {
  display: none;
  text-align: center;
  padding: 30px 20px;
}

.viewer-unsupported p {
  color: var(--muted);
  margin-bottom: 16px;
}

.viewer-nav {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--accent-dk);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.viewer-nav:hover { background: var(--bg); border-color: var(--accent); }

.viewer-footer {
  padding: 14px 20px 20px;
  text-align: center;
}

@media (max-width: 700px) {
  body.dashboard { flex-direction: column; }
  .sidebar { width: auto; }
  .main { padding: 24px 20px; }

  .viewer-nav { width: 38px; height: 38px; font-size: 22px; }
  .viewer-box { max-height: 96vh; }
}

/* Information sur les données personnelles, sous le formulaire */
.privacy-note {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  margin: 20px 8px 0;
}

.privacy-note a { color: var(--accent); }
