/* ==========================================================================
   COMPTE, CONNEXION, COMMANDE — pensés mobile d'abord.
   ========================================================================== */

/* ---------- Bouton compte dans la barre de nav ---------- */
.nav-account { display: flex; align-items: center; }

.nav-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 0.7rem;
  border-radius: 100px;
  color: var(--cream);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.nav-account-btn:hover { background: rgba(255,255,255,0.12); }
.navbar.scrolled .nav-account-btn { color: var(--black); }
.navbar.scrolled .nav-account-btn:hover { background: var(--cream); }

.nav-account-name { max-width: 8ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .nav-account-name { display: none; } }

/* ---------- Fenêtres modales (connexion, commande) ---------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.auth-overlay.is-open { opacity: 1; pointer-events: auto; }

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: auto;
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2rem 1.6rem 1.75rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.auth-overlay.is-open .auth-modal { transform: none; }

.checkout-modal { max-width: 480px; }

.auth-close {
  position: absolute;
  top: 0.85rem; right: 0.85rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-text);
  transition: var(--transition);
}
.auth-close:hover { background: var(--cream); color: var(--black); }

.auth-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding-right: 2rem;
}

.auth-note {
  font-size: 0.83rem;
  color: var(--gray-text);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.auth-inline-link {
  color: var(--gold);
  font-weight: 600;
  font-size: inherit;
  text-decoration: underline;
  padding: 0;
}

/* ---------- Champs ---------- */
.auth-field { margin-bottom: 1rem; }

.auth-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.auth-field label em {
  font-style: normal;
  font-weight: 400;
  color: var(--gray-text);
  margin-left: 0.3rem;
}
.auth-field label span { color: var(--gold); }

.auth-field input,
.auth-field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 16px;          /* évite le zoom automatique sur iOS */
  outline: none;
  transition: var(--transition);
}
.auth-field input:focus,
.auth-field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,144,26,0.15);
}
.auth-field input:disabled { background: var(--gray-light); color: var(--gray-text); }
.auth-field textarea { resize: vertical; line-height: 1.6; }

.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 2.6rem; }
.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--gray-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}
.auth-password-toggle:hover { color: var(--black); background: var(--gray-light); }
.auth-password-toggle svg { display: block; }

.auth-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.25rem 0 1rem;
  font-size: 0.83rem;
  cursor: pointer;
}
.auth-check input { width: 18px; height: 18px; accent-color: var(--gold); }

.auth-error {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #FDEDEA;
  color: #C0392B;
  font-size: 0.83rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.auth-submit,
.co-submit {
  width: 100%;
  justify-content: center;
  min-height: 48px;
}

.auth-switch {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--cream-dark);
}
.auth-switch button {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-text);
  padding: 0.35rem;
}
.auth-switch button:hover { color: var(--gold); }

/* ---------- Récapitulatif de commande ---------- */
.co-recap {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--cream);
  margin-bottom: 1.4rem;
  font-size: 0.86rem;
}

.co-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
}
.co-line em { font-style: normal; color: var(--gray-text); }
.co-line-sub { color: var(--gray-text); font-size: 0.8rem; }

.co-total {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--cream-dark);
  font-weight: 700;
  color: var(--gold);
}

/* ---------- Page compte ---------- */
.account-guest {
  max-width: 540px;
  margin: 0 auto;
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--cream);
  border-radius: var(--radius-xl);
}
.account-guest h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}
.account-guest p { color: var(--gray-text); line-height: 1.7; font-size: 0.92rem; }

.account-guest-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.75rem 0 1rem;
}
.account-guest-alt a {
  font-size: 0.85rem;
  color: var(--gray-text);
  text-decoration: underline;
}

.account-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 2rem;
  align-items: start;
}

.account-card {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.account-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.account-save { width: 100%; justify-content: center; min-height: 46px; }

.account-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--cream-dark);
}
.account-links a,
.account-links button {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-text);
  padding: 0.35rem 0;
}
.account-links a:hover, .account-links button:hover { color: var(--gold); }

/* ---------- Commandes ---------- */
.orders-list { display: flex; flex-direction: column; gap: 1rem; }

.orders-loading,
.orders-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--gray-text);
  background: var(--cream);
  border-radius: var(--radius-lg);
}
.orders-empty .btn { margin-top: 1rem; }

.order-card {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--cream-dark);
}

.order-ref {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
}
.order-date { font-size: 0.78rem; color: var(--gray-text); }

.order-status {
  padding: 0.2rem 0.7rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.order-status.is-new  { background: #FFF6E5; color: #B7791F; }
.order-status.is-ok   { background: #E8F5E9; color: #2E7D32; }
.order-status.is-work { background: #E7F0FD; color: #1B5FAA; }
.order-status.is-done { background: var(--gray-light); color: var(--gray-text); }
.order-status.is-off  { background: #FDEDEA; color: #C0392B; }

.order-items { font-size: 0.85rem; }
.order-items li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
}
.order-items em { font-style: normal; color: var(--gray-text); }

.order-boxes {
  font-size: 0.78rem;
  color: var(--gray-text);
  margin-top: 0.4rem;
}

.order-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--cream-dark);
  font-size: 0.9rem;
}
.order-foot strong { color: var(--gold); font-size: 1rem; }

/* ---------- Bandeau hors ligne ---------- */
.offline-notice {
  position: fixed;
  left: 1rem; right: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 3000;
  max-width: 460px;
  margin: 0 auto;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--black);
  color: var(--white);
  font-size: 0.83rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
}
.offline-notice a { color: var(--gold-light); font-weight: 600; text-decoration: underline; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .account-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

@media (max-width: 560px) {
  .auth-modal {
    max-width: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 1.75rem 1.15rem 1.5rem;
    margin-bottom: 0;
  }
  .auth-overlay { padding: 0; align-items: flex-end; }
  .account-guest-actions .btn { flex: 1 1 100%; justify-content: center; }
  .order-head { flex-direction: column; gap: 0.5rem; }
}
