/*
 * L'historique des commandes, dans l'habillage des pages du compte.
 *
 * Cette page venait de GESTC avec son propre univers — tuiles denses, rythme
 * different du reste. A cote de « Mon profil » et « Mes adresses », elle
 * n'avait plus l'air d'appartenir au meme site. Elle reprend donc leur
 * idiome : le creme du fond, les cartes blanches a filet beige, les titres en
 * Playfair, la largeur de lecture.
 *
 * Les noms de classes ne changent pas : c'est l'habillage qui bouge, pas le
 * composant. La palette est celle de _page_simple.php — si elle y change, elle
 * change ici.
 */

.orders-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  color: #2b2019;
}

/* ---------------------------------------------------------------- en-tete */

.orders-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 28px;
}
.orders-head h1 {
  font-family: 'Playfair Display', serif; font-weight: 500; font-size: 34px;
  margin: 0 0 6px; color: #2b2019;
}
.orders-head h1 em { font-style: italic; color: #b4633a; }
.orders-head .sub { color: #6b5a4c; font-size: 14.5px; }

.orders-cta { display: flex; align-items: center; gap: 10px; }
.orders-cta a {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  padding: 9px 18px; border-radius: 999px; white-space: nowrap;
}
.orders-cta a.secondary { color: #6b5a4c; border: 1px solid #e6ded4; background: #fff; }
.orders-cta a.secondary:hover { color: #b4633a; border-color: #d9c9b6; }
.orders-cta a.primary { color: #fff; background: #b4633a; }
.orders-cta a.primary:hover { background: #9d5230; }
.orders-cta svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------- les chiffres
   Quatre nombres, pas quatre affiches : une bordure fine suffit a les poser,
   et le total commande, seul, merite d'etre distingue. */

.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 26px;
}
.kpi {
  background: #fff; border: 1px solid #e6ded4; border-radius: 14px;
  padding: 18px 20px;
}
.kpi.featured { border-color: #d9b9a2; }
.kpi-label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: #9a8676; margin-bottom: 8px;
}
.kpi-value {
  font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 500;
  line-height: 1.1; color: #2b2019; font-variant-numeric: tabular-nums;
}
.kpi-value small { font-size: 14px; color: #6b5a4c; margin-left: 6px; font-family: inherit; }
.kpi-trend { font-size: 12.5px; color: #6b5a4c; margin-top: 8px; }
.kpi-trend .up { color: #4a7c52; font-weight: 600; }

/* ---------------------------------------------------------------- filtres */

.orders-filters {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.status-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.status-tabs button {
  font: inherit; font-size: 13.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid #e6ded4; background: #fff; color: #6b5a4c;
}
.status-tabs button:hover { color: #b4633a; border-color: #d9c9b6; }
.status-tabs button.active { background: #b4633a; border-color: #b4633a; color: #fff; font-weight: 600; }
.status-tabs .count { font-size: 11.5px; opacity: .75; font-variant-numeric: tabular-nums; }

.filter-search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid #e6ded4; background: #fff;
  border-radius: 999px; padding: 7px 14px;
}
.filter-search input {
  font: inherit; font-size: 13.5px; border: 0; outline: 0;
  background: transparent; color: #2b2019; min-width: 12rem;
}
.filter-search input::placeholder { color: #a99684; }
.filter-search svg { width: 15px; height: 15px; color: #9a8676; }

/* Le filtre par annee : la meme forme que les pastilles, avec un chevron
   dessine en fond — « appearance: none » retire celui du systeme. */
.filtre-annee {
  font: inherit; font-size: 13.5px; color: #6b5a4c; cursor: pointer;
  padding: 7px 34px 7px 14px; border-radius: 999px;
  border: 1px solid #e6ded4; background-color: #fff;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b5a4c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
.filtre-annee:hover { color: #b4633a; border-color: #d9c9b6; }
.filtre-annee:focus-visible { outline: 2px solid #b4633a; outline-offset: 2px; }

/* --------------------------------------------------------- la liste
   Une commande est une carte, comme un bloc de « Mes adresses ». */

.orders-list { display: flex; flex-direction: column; gap: 12px; }

.order-row-main {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e6ded4; border-radius: 14px;
  padding: 18px 20px; cursor: pointer;
}
.order-row-main:hover { border-color: #d9c9b6; }

.order-num-block { min-width: 8rem; }
.order-num-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #9a8676; }
.order-num { font-weight: 650; font-size: 15px; font-variant-numeric: tabular-nums; }
.order-num .hash { color: #a99684; }
.order-date { font-size: 12.5px; color: #6b5a4c; margin-top: 2px; }

.order-status-block { min-width: 9rem; }
.order-status-block .label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  background: #f3ece3; color: #6b5a4c;
}
.order-status-block .label .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.status-meta { font-size: 12px; color: #9a8676; margin-top: 5px; }

.order-thumbs-block { display: flex; align-items: center; gap: 8px; }
.order-thumbs { display: flex; }
.order-thumb {
  width: 38px; height: 38px; border-radius: 10px; object-fit: cover;
  border: 2px solid #fff; background: #f3ece3; margin-left: -8px;
}
.order-thumb:first-child { margin-left: 0; }
.order-thumbs-block .more { font-size: 12.5px; color: #6b5a4c; }

/* « 12 references » et « 28 articles » se touchaient, faute d'espace entre
   les deux balises. */
.order-items-meta { display: flex; flex-direction: column; gap: 2px; }
.order-items-meta strong { font-weight: 650; font-size: 13.5px; color: #2b2019; }
.order-items-meta small { font-size: 12.5px; color: #9a8676; }

.spacer { flex: 1; }

.order-total-block { text-align: right; }
.order-total-value {
  font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.order-total-meta { font-size: 12px; color: #9a8676; }

/* ------------------------------------------------------- le detail deplie */

.order-expanded {
  background: #fff; border: 1px solid #e6ded4; border-top: 0;
  border-radius: 0 0 14px 14px; padding: 4px 20px 20px; margin-top: -12px;
}
.expand-block { padding: 16px 0; border-top: 1px solid #f0e8de; }
.expand-block .t {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: #9a8676; margin-bottom: 10px;
}
.expand-items { display: flex; flex-direction: column; gap: 10px; }
.expand-item { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.expand-item .ref { color: #9a8676; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.expand-item .q { color: #6b5a4c; font-variant-numeric: tabular-nums; }

/*
 * Deux classes servent deux fois. « .t » est l'intertitre d'un bloc deplie,
 * mais dans une ligne d'article c'est la vignette du produit. « .n » est le
 * nom du destinataire dans le bloc d'adresse, et la pile nom + reference dans
 * une ligne d'article. Les regles ci-dessus valent pour les premiers, celles
 * qui suivent reprennent la main pour les seconds.
 */
.order-expanded .text { font-size: 14px; line-height: 1.55; color: #6b5a4c; margin: 0 0 4px; }
.order-expanded .n { font-weight: 650; color: #2b2019; font-size: 14px; }

.expand-item .t {
  width: 40px; height: 40px; border-radius: 10px; overflow: hidden;
  background: #f3ece3; flex: none;
  margin: 0; font-size: inherit; letter-spacing: normal; text-transform: none;
}
.expand-item .t img { width: 100%; height: 100%; object-fit: cover; display: block; }
.expand-item .n {
  display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0;
  font-weight: 400;
}
.expand-item .n .name { font-weight: 550; color: #2b2019; }

.timeline-mini { display: flex; flex-wrap: wrap; gap: 18px; }
.timeline-mini .icon { color: #b4633a; }
.timeline-mini .when { font-size: 12.5px; color: #6b5a4c; }
.timeline-mini .marker { width: 8px; height: 8px; border-radius: 999px; background: #b4633a; }
.timeline-mini-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #9a8676; }
.timeline-mini-step.done { color: #4a7c52; }
.timeline-mini-step.current { color: #b4633a; font-weight: 600; }

.order-actions-block { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.order-action {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid #e6ded4; background: #fff; color: #6b5a4c;
}
.order-action:hover { color: #b4633a; border-color: #d9c9b6; }
.order-action.primary { background: #b4633a; border-color: #b4633a; color: #fff; }
.order-action.primary:hover { background: #9d5230; }
.order-action svg { width: 15px; height: 15px; }

/* Le chevron qui deplie une commande : rond comme les autres boutons, et il
   pivote une fois ouvert — sans ça rien ne dit qu'on peut refermer. */
.expand-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none; cursor: pointer;
  border: 1px solid #e6ded4; border-radius: 999px;
  background: #fff; color: #6b5a4c;
  transition: transform .2s ease, border-color .2s ease;
}
.expand-toggle:hover { color: #b4633a; border-color: #d9c9b6; }
.expand-toggle.open { transform: rotate(180deg); }

/* L'etat d'une commande : vert ce qui est arrive, terracotta ce qui avance,
   gris ce qui dort. */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  background: #f3ece3; color: #6b5a4c;
}
.status-pill.delivered { background: #e8f0e6; color: #4a7c52; }
.status-pill.shipped,
.status-pill.processing { background: #f6e8de; color: #b4633a; }
.status-pill.draft { background: #f0ece7; color: #9a8676; }

/* Un brouillon n'est pas une commande : il se tient en retrait. */
.order-row.draft .order-row-main { border-style: dashed; background: #fdfbf8; }

/* ------------------------------------------------------------ pied de liste
   « .load-more » est le conteneur, pas le bouton : la regle doit viser le
   bouton, sinon il garde l'habillage par defaut du navigateur. */

.load-more { display: flex; justify-content: center; margin-top: 22px; }
.load-more button {
  font: inherit; font-size: 14px; cursor: pointer;
  padding: 10px 24px; border-radius: 999px;
  border: 1px solid #e6ded4; background: #fff; color: #6b5a4c;
}
.load-more button:hover { color: #b4633a; border-color: #d9c9b6; }

.orders-shell .foot {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid #e6ded4;
  color: #9a8676; font-size: 12.5px; text-align: center;
}

@media (max-width: 720px) {
  .orders-shell { padding: 24px 16px 48px; }
  .order-row-main { gap: 12px; }
  .order-total-block { text-align: left; }
}
