/*
  Fichier : commande.css

  Rôle :
  Gérer l'apparence de la popup de commande.

  Entrées :
  - Classes HTML définies dans commande.html
  - États ajoutés par commande.js (ex. .is-open)

  Sorties :
  - Mise en forme de la modale, du formulaire et des contrôles de quantité
*/

.commande-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.commande-modal.is-open {
  display: block;
}

.commande-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 30, 0.58);
  backdrop-filter: blur(3px);
}

.commande-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: 1rem auto;
  background: #f8f4ec;
  color: #1f2430;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(194, 164, 109, 0.22);
}

.commande-modal__content {
  overflow-y: auto;
  max-height: calc(100vh - 2rem);
  padding: 2rem;
}

.commande-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #002191;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.commande-modal__close:hover {
  transform: scale(1.04);
}

.commande-modal__header {
  margin-bottom: 2rem;
  padding-right: 3.5rem;
}

.commande-modal__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c2a46d;
  font-weight: 600;
}

.commande-modal__title {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  line-height: 1.1;
  color: #002191;
}

.commande-modal__intro {
  margin: 1rem 0 0;
  max-width: 58ch;
  color: #495164;
  line-height: 1.7;
}

.commande-form {
  display: grid;
  gap: 1.5rem;
}

.commande-form__section {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(194, 164, 109, 0.18);
  border-radius: 20px;
  padding: 1.25rem;
}

.commande-form__section-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: #002191;
}

.commande-form__grid {
  display: grid;
  gap: 1rem;
}

.commande-form__grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.commande-field {
  display: grid;
  gap: 0.45rem;
}

.commande-field label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #243047;
}

.commande-field input,
.commande-field textarea {
  width: 100%;
  border: 1px solid rgba(0, 33, 145, 0.14);
  background: #ffffff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font: inherit;
  color: #1f2430;
}

.commande-field input:focus,
.commande-field textarea:focus {
  outline: none;
  border-color: rgba(0, 33, 145, 0.45);
  box-shadow: 0 0 0 4px rgba(0, 33, 145, 0.08);
}

.commande-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.commande-choice__option {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid rgba(0, 33, 145, 0.12);
  border-radius: 999px;
  cursor: pointer;
  color: #243047;
}

.commande-choice__option input {
  margin: 0;
}

.commande-livraison {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

.commande-livraison[hidden] {
  display: none !important;
}

.commande-cuvees {
  display: grid;
  gap: 0.8rem;
}

.commande-cuvee {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  background: #fff;
  border: 1px solid rgba(0, 33, 145, 0.08);
  border-radius: 16px;
}

.commande-cuvee__name {
  font-weight: 600;
  color: #243047;
}

.commande-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.commande-qty__btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: #002191;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.commande-qty__btn:hover {
  transform: translateY(-1px);
}

.commande-qty__input {
  width: 72px;
  text-align: center;
  border: 1px solid rgba(0, 33, 145, 0.12);
  border-radius: 12px;
  padding: 0.65rem 0.5rem;
  font: inherit;
  background: #fff;
  color: #1f2430;
}

.commande-form__footer {
  display: grid;
  gap: 1rem;
}

.commande-form__note {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #5c6475;
}

.commande-form__error {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.95rem;
  color: #b42318;
}

.commande-form__submit {
  justify-self: start;
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1.5rem;
  background: linear-gradient(135deg, #002191, #1633b8);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0, 33, 145, 0.2);
}

.commande-form__submit:hover {
  transform: translateY(-1px);
}

body.commande-modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .commande-modal__dialog {
    width: min(100vw - 1rem, 100%);
    max-height: calc(100vh - 1rem);
    margin: 0.5rem auto;
    border-radius: 20px;
  }

  .commande-modal__content {
    max-height: calc(100vh - 1rem);
    padding: 1.2rem;
  }

  .commande-form__grid--two {
    grid-template-columns: 1fr;
  }

  .commande-cuvee {
    flex-direction: column;
    align-items: stretch;
  }

  .commande-qty {
    justify-content: flex-end;
  }

  .commande-form__submit {
    width: 100%;
    justify-self: stretch;
  }
}


/* =========================
   AIDE DE CHAMP FORMULAIRE COMMANDE
   ========================= */

.commande-field__hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.35;
}

/* =========================
   CENTRAGE GLOBAL BAS COMMANDE
   ========================= */

.commande-form__footer {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.commande-form__note {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.commande-form__error {
  width: 100%;
  text-align: center;
}

.commande-form__submit {
  align-self: center;
  margin-left: auto;
  margin-right: auto;
}

.commande-form .form-privacy-note {
  grid-column: 1 / -1;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}