/* =====================================================================
   Panier, commande et suivi des commandes (vitrine + administration)
   ===================================================================== */

/* Bouton panier dans l'en-tête */
.header-cart { position: relative; flex: none; background: var(--black); border-color: var(--black); color: #fff; }
.header-cart:hover { background: var(--night); border-color: var(--night); }
.header-cart.is-active { box-shadow: 0 0 0 3px rgba(94, 225, 238, .45); }
.header-cart .ico { color: var(--gold); }
.cart-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #06122e; font-size: .78rem; font-weight: 800; display: inline-grid; place-items: center; }

/* Messages sur les pages de la vitrine */
.shop-flash { padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.shop-flash .alert a { font-weight: 700; color: inherit; text-decoration: underline; }

/* Panier */
.cart-layout, .checkout-layout, .order-layout { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.cart-list { padding: 6px 20px; border-radius: 20px; }
.cart-line { display: grid; grid-template-columns: 76px 1fr auto auto; gap: 16px; align-items: center; padding: 16px 0; }
.cart-line + .cart-line { border-top: 1px solid var(--border); }
.cart-thumb img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.cart-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cart-name { font-weight: 700; color: var(--text) !important; }
.price-confirm { color: var(--gold-dark); font-size: .82rem; font-weight: 600; }
.cart-qty { display: flex; align-items: center; gap: 8px; }
.cart-qty input { width: 70px; text-align: center; padding: 7px; }
.cart-remove { color: var(--danger) !important; font-size: .85rem; }
.cart-total { min-width: 110px; text-align: right; color: var(--primary-dark); }

/* Récapitulatif */
.cart-summary { padding: 22px; border-radius: 20px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 150px; }
.cart-summary h2 { font-size: 1.15rem; margin: 0; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; font-size: .95rem; }
.sum-total { border-top: 1px solid var(--border); padding-top: 12px; font-size: 1.1rem; }
.sum-total strong { color: var(--primary-dark); }
.sum-pay { font-size: .82rem; margin: 0; }
.sum-items { list-style: none; margin: 0; padding: 0 0 10px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border); font-size: .92rem; }
.sum-items li { display: flex; justify-content: space-between; gap: 10px; }

/* Validation de commande */
.checkout-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.checkout-step { padding: 20px 22px; border-radius: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.checkout-step legend { float: left; width: 100%; display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.checkout-step legend + * { clear: both; }
.step-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--black); color: var(--gold); font-size: .9rem; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.choice:hover { border-color: #c9cfdb; }
.choice:has(input:checked) { border-color: var(--night); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--night); }
.choice input { flex: none; }
.choice .pay-icon { width: 38px; height: 38px; border-radius: 10px; }
.choice .pay-icon svg { width: 20px; height: 20px; }
.choice-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.choice-body small { font-size: .82rem; }
.choice-price { font-weight: 700; white-space: nowrap; color: var(--primary-dark); }
.choice-warning { color: var(--danger); font-weight: 600; }
.choice.is-disabled { opacity: .55; cursor: not-allowed; }

/* Confirmation / suivi de commande */
.order-num { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .02em; }
body.shop .page-head .order-num { color: var(--gold-light); }
.order-pay { padding: 24px; border-radius: 20px; }
.order-pay h2 { margin-bottom: 14px; }
.order-pay-method { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 14px; background: var(--gold-soft); border: 1px solid #b9e9ef; margin-bottom: 14px; }
.order-pay-method p { margin: 4px 0 0; }
.order-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.order-keep { font-size: .85rem; margin: 0; }
.order-who { border-top: 1px solid var(--border); padding-top: 12px; font-size: .92rem; }

/* Statuts de commande */
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.status-nouvelle { background: var(--gold-soft); color: var(--gold-dark); box-shadow: inset 0 0 0 1px #a9e4ec; }
.status-confirmee { background: var(--primary-soft); color: var(--night); }
.status-payee { background: var(--success-soft); color: var(--success); }
.status-expediee { background: #e6f1fb; color: #1d5fa3; }
.status-livree { background: #e8e8ec; color: #2c2f36; }
.status-annulee { background: var(--danger-soft); color: var(--danger); }

/* Fiche article : ajout au panier */
.buy-box { display: flex; flex-direction: column; gap: 12px; }
.buy-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; margin-bottom: 12px; }
.buy-out { margin: 0; color: var(--danger); }
.buy-help { margin: 0; font-size: .88rem; }
.pay-howto { margin-top: -6px; margin-bottom: 18px; }

/* Administration */
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--gold); color: #06122e; font-size: .75rem; font-weight: 800; }
.admin-side nav a.active .nav-badge { background: var(--black); color: var(--gold); }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
a.stat { color: var(--text); }
a.stat:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.stat-gold { border-left-color: var(--gold); }
.status-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.status-tabs a { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: .9rem; }
.status-tabs a:hover { text-decoration: none; border-color: var(--night); }
.status-tabs a.active { background: var(--night); border-color: var(--night); color: #fff; }
.status-tabs span { opacity: .65; margin-left: 4px; }
.order-admin { align-items: start; }
.order-items { margin: 8px 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.order-totals { display: flex; flex-direction: column; gap: 6px; margin-left: auto; max-width: 360px; }
.order-totals > div { display: flex; justify-content: space-between; gap: 16px; }
.order-grand { border-top: 1px solid var(--border); padding-top: 8px; font-size: 1.1rem; }
.order-dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 12px; }
.order-dl dt { color: var(--muted); font-weight: 600; font-size: .88rem; }
.order-dl dd { margin: 0; }
.alert-list li > a { color: var(--text); }

/* ----- Tablettes ----- */
@media (max-width: 1024px) {
  .cart-layout, .checkout-layout, .order-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}
/* ----- Téléphones ----- */
@media (max-width: 680px) {
  .header-cart { order: 2; padding: 0 12px; height: 42px; }
  .header-cart-label { display: none; }
  .cart-line { grid-template-columns: 64px 1fr; gap: 10px 12px; }
  .cart-thumb img { width: 64px; height: 64px; }
  .cart-qty { grid-column: 1 / 2; grid-row: 2; flex-wrap: wrap; }
  .cart-qty .btn { display: none; }
  .cart-total { grid-column: 2; grid-row: 2; align-self: center; }
  .checkout-step { padding: 16px; }
  .choice { padding: 10px 12px; gap: 10px; }
  .choice .pay-icon { display: none; }
  .buy-row { grid-template-columns: 90px 1fr; }
  .orders-table td::before { content: attr(data-label) " : "; color: var(--muted); font-size: .85rem; }
  .orders-table tr { grid-template-columns: 1fr; }
}
.orders-table td[data-label="Commande"] strong, .orders-table td[data-label="Total"] { white-space: nowrap; }

/* ===== Journal d'activite (administration) ===== */
.journal-warn { text-decoration: none; }
.journal-warn:hover { text-decoration: none; filter: brightness(.98); }
.journal-table td { vertical-align: top; font-size: .92rem; }
.journal-day td { background: var(--surface-2); font-weight: 700; font-size: .82rem; color: var(--muted); text-transform: none; padding: 8px 14px; }
.journal-time, .journal-ip { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.journal-ip { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.journal-msg { width: 55%; }
.journal-table tr.is-warn td { background: #fff7f6; }
.jwarn { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 8px; border-radius: 50%; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 800; vertical-align: 1px; }
.jtype { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: #3a3f4a; }
.jtype-connexion { background: var(--primary-soft); color: var(--night); }
.jtype-securite { background: var(--danger-soft); color: var(--danger); }
.jtype-commandes { background: var(--gold-soft); color: var(--gold-dark); }
.jtype-articles, .jtype-categories { background: #e6f1fb; color: #1d5fa3; }
.jtype-paiements, .jtype-livraison { background: var(--success-soft); color: var(--success); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
@media (max-width: 680px) {
  .journal-table tr { grid-template-columns: 1fr; }
  .journal-table td::before { content: none; }
  .journal-day td { padding: 8px 0; }
  .journal-msg { width: auto; }
}
