/* style.css — office.chefs-dor.fr (back-office)
   Style minimal, coherent avec le reste du repo (palette Chefs d'Or). */

:root {
  --bleu-marine: #1c3a5f;
  --or:          #c9a84c;
  --rouge:       #c0392b;
  --vert:        #27ae60;
  --fond:        #f5f3ee;
  --blanc:       #ffffff;
  --texte:       #1c3a5f;
  --texte-leger: #6b7280;
  --bordure:     #e5e2d8;
  --rayon:       14px;
  --ombre-card:  0 6px 18px rgba(28, 58, 95, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Google Sans', system-ui, -apple-system, sans-serif;
  background: var(--fond);
  color: var(--texte);
  min-height: 100vh;
  min-height: 100dvh; /* progressive enhancement : ignoree par les navigateurs
                         qui ne supportent pas dvh, evite que la barre d'URL
                         mobile pousse le contenu au-dela du viewport */
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* === Page de connexion =================================================== */

.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-card);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 4px; }
.auth-logo img { height: 112px; width: auto; }
.auth-titre {
  font-size: 22px;
  font-weight: 700;
  color: var(--bleu-marine);
  text-align: center;
  margin: 0;
}
.auth-sous-titre {
  font-size: 14px;
  color: var(--texte-leger);
  text-align: center;
  margin: -8px 0 0;
  line-height: 1.4;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-erreur {
  background: rgba(192, 57, 43, 0.08);
  border: 2px solid rgba(192, 57, 43, 0.30);
  color: var(--rouge);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}

/* === Champs ============================================================== */

.champ { display: flex; flex-direction: column; gap: 6px; }
.champ-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--texte-leger);
}
.champ input[type="email"],
.champ input[type="text"],
.champ input[type="password"],
.champ input[type="tel"],
.champ input[type="number"],
.champ input[type="date"] {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 2px solid var(--bordure);
  border-radius: 10px;
  background: var(--blanc);
  color: var(--texte);
}
.champ input:focus {
  outline: none;
  border-color: var(--or);
}

/* === Boutons ============================================================= */

.btn-primaire[hidden],
.btn-secondaire[hidden],
.btn-danger[hidden] { display: none !important; }

.btn-primaire,
.btn-secondaire {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  /* Force la meme box height entre <button> et <a> (inline-block default
     vs inline rendait des hauteurs differentes pour 2 boutons cote-a-cote). */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.12s, background 0.12s;
}
.btn-primaire {
  background: var(--bleu-marine);
  color: var(--blanc);
}
.btn-primaire:hover { background: #14304f; }
.btn-primaire:active { transform: scale(0.98); }
.btn-secondaire {
  background: var(--blanc);
  color: var(--bleu-marine);
  border-color: var(--bordure);
}
.btn-secondaire:hover { border-color: var(--or); }

/* === Header admin (post-connexion) ====================================== */

.page-admin { background: var(--fond); }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: var(--blanc);
  border-bottom: 1px solid var(--bordure);
}
.admin-logo { display: flex; align-items: center; }
.admin-logo img { height: 56px; width: auto; }
.admin-user {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.admin-user-nom {
  font-weight: 700;
  font-size: 14px;
}
.admin-user-role {
  font-size: 12px;
  color: var(--texte-leger);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.admin-logout { margin: 0; }

/* Menu burger (mobile uniquement, cf. @media plus bas). Sur desktop on
   masque la case a cocher invisible, le bouton burger et le lien Profil
   explicite (redondant avec le nom-lien). */
.burger-toggle { display: none; }
.burger { display: none; }
.admin-user-profil { display: none; }

/* === Dashboard =========================================================== */

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
  /* Flex column pour que .admin-back puisse passer en tete (order: -1)
     sans toucher l'ordre du HTML page par page. */
  display: flex;
  flex-direction: column;
}
.admin-titre {
  font-size: 26px;
  font-weight: 700;
  color: var(--bleu-marine);
  margin: 0 0 24px;
}
.admin-modules {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .admin-modules { grid-template-columns: repeat(2, 1fr); }
}
.admin-module {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-card);
  padding: 15px 20px;
  border: 2px solid transparent;
  transition: border-color 0.12s, transform 0.12s;
}
.admin-module:hover { border-color: var(--or); }
.admin-module:active { transform: scale(0.98); }
.admin-module-emoji { font-size: 36px; line-height: 1; margin-bottom: 4px; }
.admin-module-titre { font-size: 18px; font-weight: 700; color: var(--bleu-marine); }
.admin-module-soustitre { font-size: 13px; color: var(--texte-leger); }

/* === Pages liste / form (Utilisateurs, Commandes, Avis...) ============== */

.admin-titre-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.admin-titre-row .admin-titre { margin: 0; }

.bandeau-succes-admin {
  margin: 0 0 16px;
  padding: 12px 18px;
  background: rgba(39, 174, 96, 0.12);
  color: var(--vert);
  border: 2px solid rgba(39, 174, 96, 0.40);
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}

.bandeau-warning-admin {
  margin: 0 0 16px;
  padding: 12px 18px;
  background: rgba(201, 168, 76, 0.18);
  color: #846b1a;
  border: 2px solid rgba(201, 168, 76, 0.45);
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}

/* Callout informatif pleine largeur sous le titre d'une page. */
.admin-callout {
  margin: 0 0 18px;
  padding: 16px 20px;
  background: rgba(108, 155, 224, 0.10);
  border-left: 4px solid #6c9be0;
  border-radius: 10px;
  color: var(--texte);
  font-size: 14px;
  line-height: 1.5;
}

.admin-filtres {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.admin-filtres input[type="search"],
.admin-filtres input[type="date"],
.admin-filtres input[type="number"],
.admin-filtres select {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 2px solid var(--bordure);
  border-radius: 8px;
  background: var(--blanc);
  color: var(--texte);
}
.admin-filtres input[type="search"] { min-width: 220px; }

/* Toggle "Filtrer v" — masque par defaut (desktop). Sur mobile, le
   bandeau apparait et le formulaire est replie tant qu'on n'a pas
   coche la checkbox (cf. @media plus bas). */
.filtres-toggle { display: none; }
.admin-filtres-summary { display: none; }

/* Carte d une ligne produit dans le bloc d edition d une commande
   (commande_produits.php + commande_creer.php). Le fond bleu pale
   distingue les lignes du panier des autres elements. */
.commande-ligne-card {
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(108, 155, 224, 0.10);
}
/* Fond blanc explicite sur les controles a l interieur de la carte pour
   ressortir au-dessus du tint bleu pale du fond. */
.commande-ligne-card input,
.commande-ligne-card .qte-val,
.commande-ligne-card .qte-btn {
  background: var(--blanc);
}

.admin-table-wrap {
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-card);
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table thead {
  background: rgba(28, 58, 95, 0.04);
}
.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--bordure);
}
.admin-table th {
  font-weight: 700;
  color: var(--texte-leger);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.4px;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: rgba(201, 168, 76, 0.06); }
/* Catalogue produits de reassort_edit : header colle en haut quand le
   bloc scrolle (max-height pose sur .admin-table-wrap inline). */
#tableProduits thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--blanc);
  box-shadow: inset 0 -1px 0 var(--bordure);
}
.admin-row-inactif { opacity: 0.5; }
.admin-cell-mute { color: var(--texte-leger); font-size: 12px; }
.admin-table-vide { text-align: center; padding: 24px !important; color: var(--texte-leger); }

.admin-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.admin-pill-on  { background: rgba(39, 174, 96, 0.15);  color: var(--vert); }
.admin-pill-off { background: rgba(192, 57, 43, 0.12);  color: var(--rouge); }

.btn-mini {
  display: inline-block;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  border: 2px solid var(--bordure);
  background: var(--blanc);
  color: var(--bleu-marine);
}
.btn-mini:hover { border-color: var(--or); }

.btn-danger {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--rouge);
  color: var(--blanc);
  cursor: pointer;
}
.btn-danger:hover { background: #a52f24; }

/* Variante compacte du bouton danger (meme silhouette que .btn-mini). */
.btn-mini-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--rouge);
  color: var(--blanc);
  cursor: pointer;
  line-height: 1.2;
}
.btn-mini-danger:hover { background: #a52f24; }
.btn-mini-danger[disabled] { opacity: 0.4; pointer-events: none; }

.admin-back {
  /* Bouton retour rendu juste sous le titre de la page sur toutes les
     pages office (.admin-main est flex-direction:column ; le titre a
     order:-2 -- en tete --, admin-back a order:-1 -- juste apres). */
  order: -1;
  margin: 0 0 14px;
  font-size: 14px;
}
.admin-titre,
.admin-titre-row { order: -2; }
.admin-back a { color: var(--bleu-marine); font-weight: 700; }
.admin-back a:hover { color: var(--or); }

/* === Form (creation/modification) ====================================== */

.admin-main-form { max-width: 720px; }
.admin-form {
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.admin-form select {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 2px solid var(--bordure);
  border-radius: 10px;
  background: var(--blanc);
  color: var(--texte);
}
.admin-form select:focus { outline: none; border-color: var(--or); }
.champ-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding-top: 24px;
}
.champ-checkbox input { width: 18px; height: 18px; }

/* Groupe de cases a cocher (affectation boutiques, droits back-office) */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 12px 14px;
  border: 2px solid var(--bordure);
  border-radius: 10px;
  background: var(--blanc);
}
.checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.checkbox-item input { width: 18px; height: 18px; }
.checkbox-item input:disabled { cursor: not-allowed; }
.checkbox-item input:disabled + span { color: var(--texte-leger); }
/* Case "speciale" (Chefs d'Or groupe / Super admin) : flex-basis full
   pour qu'elle prenne sa propre ligne en haut + un fond doux pour la
   distinguer comme une "case parent" qui pilote les autres. */
.checkbox-item-special {
  flex-basis: 100%;
  background: rgba(201, 168, 76, 0.10);
  border: 1px solid rgba(201, 168, 76, 0.35);
  font-weight: 700;
}
/* Barre d'actions du formulaire : simple flex en bas naturel
   (plus sticky — l'utilisateur scrolle jusqu'a la fin du form). */
.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* === Detail (sections + dl) ============================================ */

.admin-bloc {
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-card);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.admin-bloc-titre {
  font-size: 14px;
  font-weight: 700;
  color: var(--texte-leger);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 14px;
}
.admin-dl {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 14px;
}
.admin-dl dt { color: var(--texte-leger); font-weight: 600; }
.admin-dl dd { margin: 0; color: var(--texte); }

/* === Dashboard : blocs "a venir" ======================================= */
.admin-dashboard-avenir { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; margin-top: 28px; }
.admin-bloc-avenir { margin-bottom: 0; }
.admin-avenir-liste { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.admin-avenir-item { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.025); color: var(--texte); text-decoration: none; transition: background 0.1s; }
.admin-avenir-item:hover { background: rgba(201, 168, 76, 0.10); }
.admin-avenir-quand { font-weight: 700; color: var(--bleu-marine); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-avenir-corps { min-width: 0; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.admin-avenir-corps strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-avenir-corps .admin-cell-mute { font-size: 12px; }
.admin-avenir-boutique { display: block; }
.admin-bloc-pied { margin: 4px 0 0; font-size: 13px; }
.admin-bloc-pied a { color: var(--or); text-decoration: none; font-weight: 600; }
.admin-bloc-pied a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .admin-avenir-item { grid-template-columns: 1fr auto; }
  .admin-avenir-quand { grid-column: 1 / -1; font-size: 12px; }
}

/* Statuts (badges colores) — alignes sur la palette de /orders/. */
.admin-statut.st-nouvelle  { background: rgba(201, 168, 76, 0.18);  color: #846b1a; }
.admin-statut.st-confirmee { background: rgba(108, 155, 224, 0.18); color: #2d4d76; }
.admin-statut.st-prep      { background: rgba(212, 121, 107, 0.18); color: #783e35; }
.admin-statut.st-prete     { background: rgba(108, 155, 224, 0.18); color: #2d4d76; }
.admin-statut.st-remise    { background: rgba(39, 174, 96, 0.18);   color: #1d6e3d; }
.admin-statut.st-annulee   { background: rgba(192, 57, 43, 0.16);   color: #7d2218; }

/* === Notes (etoiles colorees) ========================================== */

.admin-note { font-weight: 700; letter-spacing: 1px; }
.admin-note.note-basse   { color: var(--rouge); }
.admin-note.note-moyenne { color: var(--or);    }
.admin-note.note-haute   { color: var(--vert);  }

/* === Mobile ============================================================== */

@media (max-width: 700px) {
  .admin-form-row { grid-template-columns: 1fr; }
  .admin-dl { grid-template-columns: 1fr; gap: 2px 0; }
  .admin-dl dt { margin-top: 8px; }
}
@media (max-width: 600px) {
  /* Page de login : on tient sans scroll dans le viewport, carte centree.
     Le logo Chefs d'Or est conserve, version reduite. */
  .auth-logo img { height: 80px; }
  .page-auth { padding: 16px; }
  .auth-card { padding: 20px 18px; gap: 12px; }

  /* Header admin : logo a gauche, burger a droite. */
  .admin-header { padding: 8px 16px; }
  .admin-logo img { height: 40px; }

  /* Burger (label clickable autour de la checkbox cachee). */
  .burger {
    display: flex; flex-direction: column; justify-content: space-around;
    width: 40px; height: 40px; padding: 8px;
    background: transparent; border: 2px solid var(--bordure);
    border-radius: 8px; cursor: pointer;
  }
  .burger:hover { border-color: var(--or); }
  .burger > span {
    display: block; height: 2px; background: var(--bleu-marine);
    border-radius: 2px;
  }

  /* .admin-user replie par defaut sur mobile, deroule via :checked. */
  .admin-user { display: none; }
  .burger-toggle:checked ~ .admin-user {
    display: flex; flex-direction: column; align-items: stretch; gap: 10px;
    position: absolute; top: 60px; right: 12px;
    background: var(--blanc); border: 1px solid var(--bordure);
    border-radius: 10px; padding: 14px; box-shadow: var(--ombre-card);
    min-width: 220px; z-index: 100;
  }
  /* Dans le menu deroulant : nom comme bandeau de tete, lien Profil + logout. */
  .burger-toggle:checked ~ .admin-user .admin-user-info {
    pointer-events: none; align-items: flex-start;
    padding: 0 0 8px; border-bottom: 1px solid var(--bordure);
  }
  .admin-user-profil {
    display: block; padding: 6px 0;
    color: var(--bleu-marine); font-weight: 600; font-size: 15px;
    text-decoration: none;
  }
  .admin-user-profil:hover { color: var(--or); }
  /* "Se deconnecter" dans le menu burger : strictement le meme rendu
     que "Profil" (display:block + meme typographie). On reset les styles
     herites de .btn-secondaire (inline-flex centre, border-radius, etc.). */
  .admin-logout button {
    display: block;
    width: 100%;
    padding: 6px 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: inherit;
    color: var(--bleu-marine);
    text-align: left;
    cursor: pointer;
  }
  .admin-logout button:hover {
    background: transparent;
    color: var(--or);
  }

  .admin-main { padding: 20px 16px; }

  /* Bandeau "Filtrer v" : visible sur mobile, plie le formulaire derriere. */
  .admin-filtres-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; padding: 10px 14px; margin-bottom: 12px;
    background: var(--blanc);
    border: 2px solid var(--bordure);
    border-radius: 10px;
    font-family: inherit; font-size: 15px; font-weight: 700;
    color: var(--bleu-marine);
    cursor: pointer;
  }
  .admin-filtres-summary:hover { border-color: var(--or); }
  .admin-filtres-chevron { transition: transform 0.15s; font-size: 12px; }
  .filtres-toggle:checked ~ .admin-filtres-summary .admin-filtres-chevron {
    transform: rotate(180deg);
  }
  /* Forms de filtres avec toggle frere : caches par defaut, deroules via
     :checked. Les forms sans toggle (ex. selecteur boutique de
     commande_creer.php) ne sont pas affectes. */
  .filtres-toggle ~ .admin-filtres { display: none; }
  .filtres-toggle:checked ~ .admin-filtres {
    display: flex; flex-direction: column; align-items: stretch;
  }
  .admin-filtres input[type="search"] { min-width: 0; }
  /* Cartes modules : 2 par ligne sur mobile (comme le multi-colonnes
     desktop), avec un emoji un peu plus petit. */
  .admin-modules { grid-template-columns: 1fr 1fr; gap: 12px; }
  .admin-module-emoji { font-size: 28px; }

  /* Catalogue produits de reassort_edit : on masque la colonne Categorie
     pour eviter un scroll horizontal sur les petits ecrans. */
  #tableProduits th:nth-child(2),
  #tableProduits td:nth-child(2) { display: none; }
}

/* Spinner quantité : boutons −/+ de part et d'autre d'un input numérique. */
.qte-spinner { display: inline-flex; align-items: center; gap: 6px; }
.qte-spinner .qte-btn {
  flex: none; width: 36px; height: 36px; border: 2px solid var(--bordure);
  border-radius: 8px; background: #fff; color: var(--bleu-marine);
  font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.qte-spinner .qte-btn:hover { border-color: var(--or); }
.qte-spinner .qte-btn:active { transform: scale(0.94); }
.qte-spinner .qte-input {
  width: 52px; text-align: center; font-weight: 700; font-family: inherit;
  font-size: 15px; padding: 6px 6px; border: 2px solid var(--bordure);
  border-radius: 8px;
}
/* Quantité en lecture seule (pilotée uniquement par les boutons −/+). */
.qte-spinner .qte-val {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; height: 36px; padding: 0 6px;
  border: 2px solid var(--bordure); border-radius: 8px;
  font-size: 15px; font-weight: 700; color: var(--bleu-marine);
}

/* Lignes de tableau cliquables (cf. lib/header.php pour le JS). */
.admin-table tbody tr[data-href] { cursor: pointer; }
.admin-table tbody tr[data-href]:hover { background: rgba(201, 168, 76, 0.08); }
