/* pages.css — catalog listing, product detail, order modal, confirmation */

.page-head { background: linear-gradient(160deg, var(--c-bg-alt), var(--c-bg)); padding: 48px 0; border-bottom: 1px solid var(--c-border); }
.page-head h1 { font-size: 2.4rem; }
.page-head p { color: var(--c-muted); margin-top: 10px; max-width: 560px; }
.breadcrumb { font-size: .85rem; color: var(--c-muted); margin-bottom: 14px; }
.breadcrumb a:hover { color: var(--c-primary); }

/* toolbar: category pills + search */
.catalog-toolbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin: 32px 0 28px; }
.cat-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pill {
  border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text);
  padding: 8px 16px; border-radius: 999px; font-size: .85rem; font-weight: 500; cursor: pointer; transition: all .18s;
}
.cat-pill:hover { border-color: var(--c-primary); color: var(--c-primary); }
.cat-pill.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.search-box { position: relative; }
.search-box input {
  border: 1px solid var(--c-border); background: var(--c-surface); border-radius: 999px;
  padding: 11px 18px 11px 42px; font: inherit; font-size: .9rem; min-width: 260px; color: var(--c-text);
}
.search-box input:focus { outline: none; border-color: var(--c-primary); }
.search-box svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--c-muted); }
.result-count { color: var(--c-muted); font-size: .85rem; margin-bottom: 18px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--c-muted); }

/* product detail */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding: 48px 0 72px; align-items: start; }
.detail-media { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 24px; overflow: hidden; aspect-ratio: 1/1; box-shadow: var(--shadow-sm); }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-cat { display: inline-block; background: var(--c-primary-soft); color: var(--c-primary-dark); font-size: .78rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; }
.detail h1 { font-size: 2.1rem; margin-bottom: 12px; }
.detail-price { font-size: 1.8rem; font-weight: 700; color: var(--c-primary); font-family: var(--f-body); margin-bottom: 20px; }
.detail-desc { color: var(--c-text); margin-bottom: 26px; }
.detail-desc h3 { font-family: var(--f-body); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 8px; }
.qty-row { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.qty-label { font-weight: 600; font-size: .9rem; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--c-border); border-radius: 999px; overflow: hidden; background: #fff; }
.qty-stepper button { width: 40px; height: 42px; border: 0; background: transparent; font-size: 1.2rem; cursor: pointer; color: var(--c-primary); }
.qty-stepper input { width: 48px; text-align: center; border: 0; font: inherit; font-weight: 600; }
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.detail-note { display: flex; gap: 10px; align-items: center; color: var(--c-muted); font-size: .85rem; margin-top: 16px; }
.detail-note svg { width: 20px; height: 20px; flex: none; color: var(--c-primary); }
.detail-assure { list-style: none; padding: 24px 0 0; margin: 26px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; border-top: 1px solid var(--c-border); }
.detail-assure li { display: flex; align-items: center; gap: 12px; font-size: .88rem; color: var(--c-text); }
.detail-assure .ai { width: 40px; height: 40px; border-radius: 50%; background: var(--c-primary-soft); color: var(--c-primary); display: grid; place-items: center; flex: none; }
.detail-assure .ai svg { width: 19px; height: 19px; }
@media (max-width: 820px) { .detail-assure { grid-template-columns: 1fr; } }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(31,42,36,.55); backdrop-filter: blur(2px); z-index: 60; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--c-surface); border-radius: 22px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow-md); }
.modal-head { padding: 24px 26px 12px; }
.modal-head h3 { font-size: 1.4rem; }
.modal-head p { color: var(--c-muted); font-size: .9rem; margin-top: 6px; }
.modal-body { padding: 8px 26px 24px; }
.modal-summary { display: flex; gap: 14px; align-items: center; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 14px; padding: 12px; margin-bottom: 18px; }
.modal-summary img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.modal-summary .m-name { font-weight: 600; font-size: .9rem; }
.modal-summary .m-total { color: var(--c-primary); font-weight: 700; margin-left: auto; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--c-heading); }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--c-border); border-radius: 12px; padding: 11px 14px;
  font: inherit; font-size: .92rem; background: #fff; color: var(--c-text);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.field textarea { resize: vertical; min-height: 70px; }
.field .err { color: #c0392b; font-size: .78rem; margin-top: 4px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid textarea { border-color: #c0392b; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 12px; margin-top: 8px; }
.modal-close { float: right; background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--c-muted); line-height: 1; }

/* confirmation */
.confirm-wrap { max-width: 620px; margin: 0 auto; padding: 72px 0; text-align: center; }
.confirm-check { width: 84px; height: 84px; border-radius: 50%; background: var(--c-primary-soft); color: var(--c-primary); display: grid; place-items: center; margin: 0 auto 24px; }
.confirm-check svg { width: 42px; height: 42px; }
.confirm-wrap h1 { font-size: 2.2rem; margin-bottom: 12px; }
.confirm-wrap > p { color: var(--c-muted); margin-bottom: 28px; }
.confirm-ref { display: inline-block; background: var(--c-bg-alt); border: 1px dashed var(--c-primary); border-radius: 12px; padding: 12px 24px; font-weight: 700; color: var(--c-primary-dark); letter-spacing: .05em; margin-bottom: 28px; }
.confirm-summary { text-align: left; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 16px; padding: 22px; margin-bottom: 28px; box-shadow: var(--shadow-sm); }
.confirm-summary h4 { font-family: var(--f-body); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 14px; }
.summary-line { display: flex; justify-content: space-between; padding: 7px 0; font-size: .94rem; border-bottom: 1px solid var(--c-border); }
.summary-line:last-child { border-bottom: 0; font-weight: 700; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.status-nouvelle { background: #eaf2ff; color: #2563a5; }
.status-confirmee { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.status-livree { background: #e6f6ec; color: #1f7a44; }
.status-annulee { background: #fdecec; color: #c0392b; }

@media (max-width: 820px) {
  .detail { grid-template-columns: 1fr; gap: 28px; }
  .catalog-toolbar { flex-direction: column; align-items: stretch; }
  .search-box input { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
}

/* --- Gestion de stock (fiche produit) --- */
.stock-out { display:inline-block; margin-left:12px; padding:4px 10px; border-radius:999px;
  background:#fdecec; color:#c0392b; font-size:.76rem; font-weight:700; }
.stock-low { display:inline-block; margin-left:12px; padding:4px 10px; border-radius:999px;
  background:#fdf3e3; color:#9a6a1e; font-size:.76rem; font-weight:600; }
.qty-stepper button:disabled, .qty-stepper input:disabled { opacity:.45; cursor:not-allowed; }
#add-cart:disabled { opacity:.5; cursor:not-allowed; }
