/* ==========================================================================
   Baraza Tech — Boutique et panier
   Utilise les variables de style.css (thème clair / sombre).
   ========================================================================== */
.container--wide { max-width: 1440px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shop { padding-top: 40px; }
.shop__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.shop__head h1 { font-size: clamp(28px, 3.4vw, 36px); line-height: 1.15; margin: 8px 0 12px; }
.shop__lead { color: var(--muted); max-width: 760px; font-size: 15px; }
.shop__cart-btn { flex-shrink: 0; position: relative; }

.shop__toolbar { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-bottom: 12px; }
.shop__search, .shop__sort {
    display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--muted);
}
.shop__search:focus-within, .shop__sort:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.shop__search input, .shop__sort select {
    flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.shop__sort select { cursor: pointer; padding-right: 4px; }
.shop__sort select option { background: var(--surface); color: var(--text); }

.shop__filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 24px; }
.chip {
    height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.chip:hover { border-color: var(--primary-line); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.shop__count { margin-left: auto; color: var(--muted); font-size: 13px; }

/* ---------- Grille des produits ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.shop-card {
    display: flex; flex-direction: column; overflow: hidden; position: relative;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.shop-card[hidden] { display: none; }
.shop-card:hover { border-color: var(--primary-line); box-shadow: var(--shadow); }
.shop-card--popular { border-color: var(--primary); }
.shop-card__media { position: relative; aspect-ratio: 16 / 9; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.shop-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-card__media--icon, .shop-card__media--plain { display: grid; place-items: center;
    background: radial-gradient(circle at 30% 20%, var(--primary-soft), transparent 70%), var(--bg-alt); }
.shop-card__media .card__icon { margin: 0; width: 64px; height: 64px; }
.shop-card__media .badge { top: 12px; left: 12px; transform: none; }
.shop-card__monogram { font-size: 34px; font-weight: 800; letter-spacing: .04em; color: var(--primary); opacity: .75; }
.shop-card__body { display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 8px; flex: 1; }
.shop-card__kind { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.shop-card h3 { font-size: 17px; line-height: 1.3; }
.shop-card__text { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.shop-card__price { margin-top: auto; padding-top: 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; color: var(--muted); font-size: 13px; }
.shop-card__price strong { font-size: 22px; color: var(--text); font-weight: 700; }
.shop-card__price small { flex-basis: 100%; font-size: 12.5px; }
.shop-card__actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px 16px; }
.shop-card__actions .btn { flex: 1 1 auto; min-height: 40px; padding: 0 12px; border-radius: 8px; font-size: 14px; gap: 8px; }
.shop-card__actions [data-add] { flex-basis: 100%; }
.shop-card__actions .is-added { background: var(--success); border-color: var(--success); }
.shop-card__actions .is-in-cart { background: transparent; color: var(--primary); border-color: var(--primary); box-shadow: none; }

.shop__status { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 24px; color: var(--muted); }
.shop-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--primary-soft); border-top-color: var(--primary); animation: shop-spin .8s linear infinite; }
@keyframes shop-spin { to { transform: rotate(360deg); } }
.shop__empty { display: grid; justify-items: center; gap: 12px; padding: 48px 16px; color: var(--muted); text-align: center; }

/* ---------- Bouton panier de l'en-tête ---------- */
.cart-btn { position: relative; text-decoration: none; color: var(--text); }
.cart-btn__count {
    position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    display: grid; place-items: center; background: var(--primary); color: var(--primary-text); font-size: 11px; font-weight: 700;
}
.cart-btn__count[hidden] { display: none; }
.shop__cart-btn .cart-btn__count { position: static; margin-left: 4px; }

/* ---------- Tiroir du panier ---------- */
.cart { position: fixed; inset: 0; z-index: 80; }
.cart[hidden] { display: none; }
.cart__backdrop { position: absolute; inset: 0; background: rgba(3, 8, 20, .55); opacity: 0; transition: opacity 200ms ease; }
.cart__panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column;
    background: var(--bg); border-left: 1px solid var(--border); box-shadow: -20px 0 60px -30px rgba(0, 0, 0, .6);
    transform: translateX(100%); transition: transform 220ms ease;
}
.cart.is-open .cart__backdrop { opacity: 1; }
.cart.is-open .cart__panel { transform: none; }
body.cart-open { overflow: hidden; }
.cart__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cart__head h2 { font-size: 19px; }
.cart__scroll { flex: 1; overflow-y: auto; padding: 16px 20px 24px; scrollbar-width: thin; }
.cart__lines { display: grid; gap: 10px; }
.cart__empty { display: grid; justify-items: start; gap: 12px; color: var(--muted); padding: 8px 0; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.cart-line__info { display: grid; gap: 2px; min-width: 0; }
.cart-line__info strong { font-size: 14px; overflow-wrap: anywhere; }
.cart-line__info small { color: var(--muted); font-size: 12.5px; }
.cart-line__qty { display: inline-flex; align-items: center; gap: 6px; }
.cart-line__qty span { min-width: 20px; text-align: center; font-weight: 600; }
.icon-btn--sm { width: 32px; height: 32px; border-radius: 8px; font-size: 16px; }
.icon-btn--sm:disabled { opacity: .45; cursor: not-allowed; }
.cart-line__remove { color: var(--danger); }
.cart__totals { display: grid; gap: 8px; margin-top: 16px; }
.cart-total { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.cart-total strong { font-size: 16px; }
.cart__note { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.cart [hidden], .checkout [hidden] { display: none !important; }
.checkout { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.checkout h3 { font-size: 17px; margin-bottom: 12px; }
.checkout__body { display: grid; gap: 10px; }
.checkout__body .btn { min-height: 46px; border-radius: 8px; font-size: 14px; }
.btn--new-client { color: var(--primary); background: transparent; border: 1px solid var(--border); }
.btn--new-client:hover { border-color: var(--primary); background: var(--primary-soft); }
.checkout__hint, .checkout__account { color: var(--muted); font-size: 14px; }
.checkout__or { height: 1px; background: var(--border); margin: 4px 0; }
.checkout__form { display: grid; gap: 14px; }
.checkout__form .field textarea { min-height: 64px; }
.checkout__form .check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.checkout__error { color: var(--danger); font-size: 13.5px; }
.checkout__secure { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 12.5px; }
.checkout__secure svg { flex-shrink: 0; margin-top: 1px; }
.checkout__done { display: grid; gap: 12px; padding: 14px; border-radius: 10px; background: var(--success-bg); color: var(--success-text); }

@media (max-width: 720px) {
    .shop__head { flex-direction: column; align-items: stretch; }
    .shop__toolbar { grid-template-columns: 1fr; }
    .shop__count { margin-left: 0; flex-basis: 100%; }
    .shop-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .cart__panel, .cart__backdrop { transition: none; }
    .shop-spinner { animation-duration: 2s; }
}
