/* Page "Nouvelle commande"
   À charger APRÈS styleHeaderFooter.css (variables de couleurs et header/footer). */

main {
    width: min(1120px, 100% - 2.5rem);
    margin: 2.5rem auto 4rem;
}

main h1 {
    display: flex;
    align-items: center;
    gap: .9rem;
    font-size: clamp(2rem, 4.5vw, 3rem);
    line-height: 1.1;
    letter-spacing: -.02em;
    margin: 0 0 1.6rem;
}

/* petite alvéole jaune devant le titre */
main h1::before {
    content: "";
    flex: none;
    width: 1.1em;
    aspect-ratio: 1 / 1.1547;
    background: var(--miel);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

/* ---------- Formulaire = grande carte ---------- */
.form_passer_commande {
    background: #fff;
    border-radius: 28px;
    padding: clamp(1.4rem, 3vw, 2.6rem);
    box-shadow: 0 10px 0 var(--miel), 0 22px 40px rgba(74, 46, 11, .12);
}

.form_passer_commande label {
    font-weight: 600;
}

.form_passer_commande input[type="text"],
.form_passer_commande select {
    font: inherit;
    color: var(--brun);
    width: min(100%, 420px);
    margin-top: .35rem;
    padding: .7rem 1rem;
    background: var(--creme);
    border: 2px solid var(--miel-clair);
    border-radius: 14px;
    transition: border-color .2s, box-shadow .2s;
}

/* ligne "ville" : liste + "ou" + champ libre côte à côte quand il y a la place */
.form_passer_commande select { width: min(100%, 240px); }
.form_passer_commande #ville-text { width: min(100%, 260px); }
.form_passer_commande label[for="ville-select"] { margin: 0 .5rem; font-weight: 500; }

.form_passer_commande input:focus,
.form_passer_commande select:focus {
    outline: none;
    border-color: var(--miel);
    box-shadow: 0 0 0 4px rgba(244, 180, 26, .3);
}

/* ---------- Onglets (types de miel) ---------- */
.tabs { margin-top: 1rem; }

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 1.4rem;
}

.tab-button {
    font: inherit;
    font-weight: 700;
    color: var(--brun);
    background: var(--miel-pale);
    border: 2px solid var(--miel-clair);
    border-radius: 999px;
    padding: .6rem 1.4rem;
    cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s;
}

.tab-button:hover { background: var(--miel-clair); }

.tab-button.active {
    background: var(--brun);
    border-color: var(--brun);
    color: var(--miel-clair);
    box-shadow: 0 4px 0 var(--miel);
}

.tab-button:focus-visible { outline: 3px solid var(--brun); outline-offset: 3px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-content > label {
    display: block;
    background: var(--miel-pale);
    border-left: 6px solid var(--miel);
    border-radius: 0 14px 14px 0;
    padding: .9rem 1.2rem;
    margin-bottom: 1.4rem;
    font-weight: 400;
}

/* ---------- Produits ---------- */
.produits-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.4rem;
}

.produit-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 2px solid var(--miel-clair);
    border-radius: 20px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}

.produit-card:hover,
.produit-card:focus-within {
    transform: translateY(-4px);
    border-color: var(--miel);
    box-shadow: 0 10px 0 var(--miel-clair);
}

.produit-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: var(--miel-pale);
}

.produit-info {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 1rem 1.1rem 1.2rem;
}

.produit-nom { font-weight: 700; line-height: 1.3; }

.produit-prix {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--miel-fonce);
}

.produit-quantite {
    font: inherit;
    font-weight: 700;
    text-align: center;
    color: var(--brun);
    width: 5.5rem;
    margin-top: .3rem;
    padding: .5rem;
    background: var(--creme);
    border: 2px solid var(--miel-clair);
    border-radius: 12px;
}

.produit-quantite:focus {
    outline: none;
    border-color: var(--miel);
    box-shadow: 0 0 0 4px rgba(244, 180, 26, .3);
}

/* ---------- Total + bouton ---------- */
.form-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-top: 2rem;
    padding: 1.4rem 1.8rem;
    background: var(--brun);
    color: var(--creme);
    border-radius: 22px;
}

.form-footer strong { font-size: clamp(1.3rem, 2.5vw, 1.8rem); }
#montant-total { color: var(--miel); }

#btn-commande {
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brun);
    background: var(--miel);
    border: 0;
    border-radius: 999px;
    padding: 1rem 2.2rem;
    cursor: pointer;
    box-shadow: 0 6px 0 var(--miel-fonce);
    transition: transform .2s, box-shadow .2s, background .2s;
}

#btn-commande:hover:not(:disabled) {
    background: var(--miel-clair);
    transform: translateY(-2px);
    box-shadow: 0 8px 0 var(--miel-fonce);
}

#btn-commande:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--miel-fonce); }

#btn-commande:disabled {
    background: #8a7350;
    color: #d9cdb4;
    box-shadow: none;
    cursor: not-allowed;
}

#btn-commande:focus-visible { outline: 3px solid var(--creme); outline-offset: 3px; }

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
    main { margin-top: 1.5rem; }
    .form_passer_commande { border-radius: 22px; }
    .tab-buttons { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .4rem; }
    .tab-button { white-space: nowrap; }
    .produits-container { grid-template-columns: repeat(2, 1fr); gap: .9rem; }
    .form-footer { flex-direction: column; text-align: center; }
    #btn-commande { width: 100%; }
}

@media (max-width: 420px) {
    .produits-container { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }