/* =====================================================================
   LocalHub — fichier de design partagé
   Référence : page d'accueil (/static/index.html).
   Fond clair, une seule couleur d'accent chaude (orange), bordures fines,
   rayons modérés, ombres légères, polices système, mobile d'abord.
   Toutes les pages (accueil, boutique, espace vendeur, admin) chargent ce
   fichier. Les styles propres à une page restent dans la page, mais
   utilisent ces variables.
   ===================================================================== */

:root {
    /* Couleurs */
    --lh-orange: #c2410c;          /* accent : boutons principaux, liens (contraste AA sur blanc) */
    --lh-orange-hover: #9a3412;
    --lh-orange-bright: #f1641e;   /* décoratif uniquement : logo, icônes, grands titres */
    --lh-orange-soft: #fff4ec;     /* fond d'accent très clair */
    --lh-text: #222222;
    --lh-text-muted: #595959;
    --lh-bg: #ffffff;
    --lh-bg-soft: #f8f6f3;         /* gris chaud très clair */
    --lh-surface: #ffffff;
    --lh-border: #e6e1da;
    --lh-border-strong: #cfc8be;
    --lh-placeholder: #efebe6;
    --lh-placeholder-icon: #a39e97;

    --lh-success: #1e7a46;
    --lh-success-soft: #e8f5ee;
    --lh-warning: #8a5300;
    --lh-warning-soft: #fff5e0;
    --lh-danger: #b42318;
    --lh-danger-soft: #fdecea;
    --lh-info: #1d5fa8;
    --lh-info-soft: #e9f1fb;

    /* Formes */
    --lh-radius: 10px;
    --lh-radius-sm: 8px;
    --lh-radius-lg: 12px;
    --lh-radius-pill: 999px;
    --lh-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.04);
    --lh-shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.10);

    /* Typographie : polices système uniquement (connexions lentes) */
    --lh-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --lh-font-display: Georgia, "Times New Roman", serif;

    /* Espacements */
    --lh-space-1: 4px;
    --lh-space-2: 8px;
    --lh-space-3: 12px;
    --lh-space-4: 16px;
    --lh-space-5: 24px;
    --lh-space-6: 32px;
    --lh-space-7: 48px;

    --lh-tap: 44px;                 /* hauteur minimale d'un bouton */
    --lh-container: 1200px;
    --lh-sidebar: 248px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--lh-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--lh-text);
    background: var(--lh-bg);
    overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--lh-orange); }
a:hover { color: var(--lh-orange-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(194, 65, 12, 0.35); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--lh-space-2); }
p { margin: 0 0 var(--lh-space-3); }

.lh-container { width: 100%; max-width: var(--lh-container); margin: 0 auto; padding: 0 var(--lh-space-4); }
.lh-muted { color: var(--lh-text-muted); }
.lh-display { font-family: var(--lh-font-display); }
.lh-section { padding: var(--lh-space-6) 0; }
.lh-section-title { font-family: var(--lh-font-display); font-size: clamp(1.35rem, 3vw, 1.9rem); margin-bottom: var(--lh-space-1); }
.lh-section-sub { color: var(--lh-text-muted); margin-bottom: var(--lh-space-5); }
.lh-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- En-tête ---------- */
.lh-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, 0.97); border-bottom: 1px solid var(--lh-border); }
.lh-header__inner { display: flex; align-items: center; gap: var(--lh-space-4); min-height: 64px; }
.lh-logo { font-family: var(--lh-font-display); font-size: 1.6rem; font-weight: 700; color: var(--lh-orange-bright); text-decoration: none; white-space: nowrap; letter-spacing: -0.01em; }
.lh-logo:hover { color: var(--lh-orange); }
.lh-logo span { color: var(--lh-text); }
.lh-search { flex: 1; display: flex; max-width: 640px; border: 2px solid var(--lh-text); border-radius: var(--lh-radius-pill); overflow: hidden; background: var(--lh-bg); }
.lh-search input { flex: 1; min-width: 0; border: 0; padding: 10px 18px; outline: none; background: transparent; min-height: var(--lh-tap); }
.lh-search button { border: 0; background: var(--lh-orange); color: #fff; padding: 0 18px; min-width: var(--lh-tap); }
.lh-search button:hover { background: var(--lh-orange-hover); }
.lh-nav { display: flex; gap: var(--lh-space-2); align-items: center; margin-left: auto; }

/* ---------- Boutons ---------- */
.lh-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--lh-space-2);
    min-height: var(--lh-tap); padding: 10px 20px;
    border-radius: var(--lh-radius-pill); border: 1px solid transparent;
    font-weight: 600; font-size: 0.95rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
    background: var(--lh-bg-soft); color: var(--lh-text);
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.lh-btn:hover { background: #efebe6; color: var(--lh-text); }
.lh-btn:disabled, .lh-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.lh-btn--primary { background: var(--lh-orange); color: #fff; }
.lh-btn--primary:hover { background: var(--lh-orange-hover); color: #fff; }
.lh-btn--dark { background: var(--lh-text); color: #fff; }
.lh-btn--dark:hover { background: #000; color: #fff; }
.lh-btn--secondary { background: var(--lh-bg); border-color: var(--lh-border-strong); color: var(--lh-text); }
.lh-btn--secondary:hover { background: var(--lh-bg-soft); border-color: var(--lh-text); }
.lh-btn--ghost { background: transparent; }
.lh-btn--ghost:hover { background: var(--lh-bg-soft); }
.lh-btn--danger { background: var(--lh-bg); border-color: #e7b4ae; color: var(--lh-danger); }
.lh-btn--danger:hover { background: var(--lh-danger-soft); color: var(--lh-danger); }
.lh-btn--success { background: var(--lh-success); color: #fff; }
.lh-btn--success:hover { background: #165c35; color: #fff; }
.lh-btn--block { width: 100%; }
.lh-btn--sm { min-height: 36px; padding: 6px 14px; font-size: 0.875rem; }
.lh-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--lh-tap); height: var(--lh-tap); border-radius: 50%; border: 1px solid var(--lh-border); background: var(--lh-bg); color: var(--lh-text); }
.lh-icon-btn:hover { background: var(--lh-bg-soft); }

/* ---------- Cartes ---------- */
.lh-card { background: var(--lh-surface); border: 1px solid var(--lh-border); border-radius: var(--lh-radius-lg); padding: var(--lh-space-4); }
.lh-card--flush { padding: 0; overflow: hidden; }
.lh-card__title { font-size: 1.05rem; font-weight: 700; margin-bottom: var(--lh-space-3); }

/* ---------- Grille produits : 2 colonnes téléphone, 3 tablette, 4 ordinateur ---------- */
.lh-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lh-space-3); }
@media (min-width: 640px) { .lh-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--lh-space-4); } }
@media (min-width: 1024px) { .lh-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--lh-space-5); } }

.lh-product { display: flex; flex-direction: column; min-width: 0; background: var(--lh-surface); border-radius: var(--lh-radius-lg); text-decoration: none; color: inherit; }
.lh-product__media { position: relative; aspect-ratio: 1 / 1; border-radius: var(--lh-radius-lg); overflow: hidden; background: var(--lh-placeholder); cursor: pointer; }
.lh-product__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.lh-product:hover .lh-product__media img { transform: scale(1.03); }
.lh-product__fav { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.95); color: var(--lh-text); box-shadow: var(--lh-shadow); display: flex; align-items: center; justify-content: center; }
.lh-product__fav.is-active { color: var(--lh-danger); }
.lh-product__body { padding: var(--lh-space-2) 2px 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.lh-product__name { font-size: 0.95rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; cursor: pointer; }
.lh-product__price { font-weight: 700; font-size: 1.05rem; }
.lh-product__stock { font-size: 0.8rem; color: var(--lh-success); }
.lh-product__stock--low { color: var(--lh-warning); }
.lh-product__stock--out { color: var(--lh-danger); }
.lh-product__actions { margin-top: var(--lh-space-2); }

/* Placeholder neutre (produit ou image absente) : icône grise, jamais d'émoji */
.lh-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--lh-placeholder); color: var(--lh-placeholder-icon); }
.lh-placeholder svg { width: 38%; max-width: 72px; height: auto; }

/* ---------- Formulaires ---------- */
.lh-field { margin-bottom: var(--lh-space-3); }
.lh-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: var(--lh-space-1); }
.lh-input, .lh-select, .lh-textarea {
    width: 100%; min-height: var(--lh-tap); padding: 10px 14px;
    border: 1px solid var(--lh-border-strong); border-radius: var(--lh-radius-sm);
    background: var(--lh-bg); color: var(--lh-text);
}
.lh-textarea { min-height: 96px; resize: vertical; }
.lh-input:focus, .lh-select:focus, .lh-textarea:focus { outline: none; border-color: var(--lh-orange); box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.15); }
.lh-help { font-size: 0.85rem; color: var(--lh-text-muted); margin-top: var(--lh-space-1); }
.lh-error-text { font-size: 0.875rem; color: var(--lh-danger); margin-top: var(--lh-space-1); min-height: 1.2em; }

/* Choix (paiement, filtres) */
.lh-chips { display: flex; gap: var(--lh-space-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.lh-chips::-webkit-scrollbar { display: none; }
.lh-chip { flex: 0 0 auto; min-height: 40px; padding: 8px 16px; border-radius: var(--lh-radius-pill); border: 1px solid var(--lh-border-strong); background: var(--lh-bg); color: var(--lh-text); font-size: 0.9rem; white-space: nowrap; }
.lh-chip:hover { border-color: var(--lh-text); }
.lh-chip.active, .lh-chip.selected, .lh-chip[aria-pressed="true"] { background: var(--lh-text); border-color: var(--lh-text); color: #fff; }

/* ---------- Badges et statuts ---------- */
.lh-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--lh-radius-pill); font-size: 0.78rem; font-weight: 600; background: var(--lh-bg-soft); color: var(--lh-text); border: 1px solid var(--lh-border); white-space: nowrap; }
.lh-badge--success { background: var(--lh-success-soft); color: var(--lh-success); border-color: transparent; }
.lh-badge--warning { background: var(--lh-warning-soft); color: var(--lh-warning); border-color: transparent; }
.lh-badge--danger { background: var(--lh-danger-soft); color: var(--lh-danger); border-color: transparent; }
.lh-badge--info { background: var(--lh-info-soft); color: var(--lh-info); border-color: transparent; }
.lh-badge--accent { background: var(--lh-orange-soft); color: var(--lh-orange); border-color: transparent; }

/* ---------- États : chargement, vide, erreur ---------- */
.lh-state { text-align: center; padding: var(--lh-space-6) var(--lh-space-4); color: var(--lh-text-muted); }
.lh-state__icon { font-size: 1.8rem; color: var(--lh-placeholder-icon); margin-bottom: var(--lh-space-2); }
.lh-state__title { font-weight: 700; color: var(--lh-text); margin-bottom: var(--lh-space-1); }
.lh-state--error .lh-state__icon, .lh-state--error .lh-state__title { color: var(--lh-danger); }
.lh-spinner { width: 36px; height: 36px; margin: 0 auto var(--lh-space-3); border: 3px solid var(--lh-border); border-top-color: var(--lh-orange); border-radius: 50%; animation: lh-spin 0.9s linear infinite; }
@keyframes lh-spin { to { transform: rotate(360deg); } }
.lh-alert { padding: var(--lh-space-3) var(--lh-space-4); border-radius: var(--lh-radius); border: 1px solid var(--lh-border); background: var(--lh-bg-soft); margin-bottom: var(--lh-space-4); }
.lh-alert--error { background: var(--lh-danger-soft); border-color: #f2c4bf; color: var(--lh-danger); }
.lh-alert--success { background: var(--lh-success-soft); border-color: #bfe3cf; color: var(--lh-success); }
.lh-alert--info { background: var(--lh-info-soft); border-color: #c6dbf3; color: var(--lh-info); }

/* ---------- Fenêtres (panier, fiche produit, formulaires) ---------- */
.lh-modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: flex-end; justify-content: center; background: rgba(34, 34, 34, 0.45); }
.lh-modal.open { display: flex; }
.lh-modal__panel { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--lh-bg); border-radius: var(--lh-radius-lg) var(--lh-radius-lg) 0 0; padding: var(--lh-space-5) var(--lh-space-4); box-shadow: var(--lh-shadow-lg); }
.lh-modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--lh-space-3); margin-bottom: var(--lh-space-4); }
.lh-modal__head h3 { margin: 0; font-size: 1.2rem; }
@media (min-width: 640px) { .lh-modal { align-items: center; padding: var(--lh-space-4); } .lh-modal__panel { border-radius: var(--lh-radius-lg); } }

/* ---------- Tableaux ---------- */
.lh-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--lh-border); border-radius: var(--lh-radius-lg); background: var(--lh-surface); }
.lh-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.lh-table th, .lh-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--lh-border); vertical-align: middle; }
.lh-table th { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--lh-text-muted); background: var(--lh-bg-soft); }
.lh-table tr:last-child td { border-bottom: 0; }

/* ---------- Cartes de statistiques ---------- */
.lh-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lh-space-3); margin-bottom: var(--lh-space-5); }
@media (min-width: 900px) { .lh-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--lh-space-4); } }
.lh-stat { background: var(--lh-surface); border: 1px solid var(--lh-border); border-radius: var(--lh-radius-lg); padding: var(--lh-space-4); min-width: 0; }
.lh-stat__label { font-size: 0.85rem; color: var(--lh-text-muted); margin-bottom: var(--lh-space-1); }
.lh-stat__value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.lh-stat__hint { font-size: 0.8rem; color: var(--lh-text-muted); margin-top: var(--lh-space-1); }

/* ---------- Pied de page ---------- */
.lh-footer { background: var(--lh-bg-soft); border-top: 1px solid var(--lh-border); color: var(--lh-text-muted); padding: var(--lh-space-6) 0 var(--lh-space-5); margin-top: var(--lh-space-6); font-size: 0.92rem; }
.lh-footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--lh-space-5); margin-bottom: var(--lh-space-5); }
.lh-footer h5 { color: var(--lh-text); font-size: 0.95rem; margin: 0 0 var(--lh-space-3); }
.lh-footer ul { list-style: none; margin: 0; padding: 0; }
.lh-footer li { margin-bottom: var(--lh-space-2); }
.lh-footer a { color: var(--lh-text-muted); text-decoration: none; }
.lh-footer a:hover { color: var(--lh-text); text-decoration: underline; }
.lh-footer__bottom { border-top: 1px solid var(--lh-border); padding-top: var(--lh-space-4); text-align: center; font-size: 0.85rem; }

/* ---------- Pages de connexion / inscription ---------- */
.lh-auth { min-height: 100vh; display: flex; flex-direction: column; background: var(--lh-bg-soft); }
.lh-auth__main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: var(--lh-space-6) var(--lh-space-4); }
.lh-auth__card { width: 100%; max-width: 420px; background: var(--lh-bg); border: 1px solid var(--lh-border); border-radius: var(--lh-radius-lg); padding: var(--lh-space-5); box-shadow: var(--lh-shadow); }
.lh-auth__card h1 { font-family: var(--lh-font-display); font-size: 1.6rem; text-align: center; }
.lh-auth__sub { text-align: center; color: var(--lh-text-muted); margin-bottom: var(--lh-space-5); }
.lh-auth__foot { text-align: center; margin-top: var(--lh-space-4); color: var(--lh-text-muted); }

/* ---------- Espace vendeur / admin : menu latéral clair ---------- */
.lh-app { display: flex; min-height: 100vh; background: var(--lh-bg-soft); }
.lh-sidebar { width: var(--lh-sidebar); flex-shrink: 0; background: var(--lh-bg); border-right: 1px solid var(--lh-border); position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 900; transition: transform .2s ease; display: flex; flex-direction: column; }
.lh-sidebar__head { padding: var(--lh-space-4) var(--lh-space-4) var(--lh-space-3); border-bottom: 1px solid var(--lh-border); }
.lh-sidebar__head small { display: block; color: var(--lh-text-muted); font-size: 0.8rem; margin-top: 2px; }
.lh-sidebar__nav { padding: var(--lh-space-2); flex: 1; }
.lh-sidebar__foot { padding: var(--lh-space-2); border-top: 1px solid var(--lh-border); }
.lh-nav-item, .lh-sidebar .nav-item {
    display: flex; align-items: center; gap: var(--lh-space-3);
    min-height: var(--lh-tap); padding: 8px 12px; margin-bottom: 2px;
    border-radius: var(--lh-radius-sm); color: var(--lh-text); text-decoration: none; cursor: pointer;
    font-size: 0.95rem; border: 0; background: transparent; width: 100%; text-align: left;
}
.lh-nav-item i, .lh-sidebar .nav-item i { width: 20px; text-align: center; color: var(--lh-text-muted); }
.lh-nav-item:hover, .lh-sidebar .nav-item:hover { background: var(--lh-bg-soft); color: var(--lh-text); }
.lh-nav-item.active, .lh-sidebar .nav-item.active { background: var(--lh-orange-soft); color: var(--lh-orange); font-weight: 600; }
.lh-nav-item.active i, .lh-sidebar .nav-item.active i { color: var(--lh-orange); }
.lh-main { flex: 1; min-width: 0; margin-left: var(--lh-sidebar); }
.lh-topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--lh-space-3); min-height: 64px; padding: var(--lh-space-2) var(--lh-space-5); background: var(--lh-bg); border-bottom: 1px solid var(--lh-border); }
.lh-topbar__title { flex: 1; min-width: 0; }
.lh-topbar__title h1 { font-size: 1.1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-topbar__title p { margin: 0; font-size: 0.82rem; color: var(--lh-text-muted); }
.lh-burger { display: none; }
.lh-page { padding: var(--lh-space-5); max-width: 1280px; }
.lh-page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--lh-space-3); margin-bottom: var(--lh-space-5); }
.lh-page-head h2 { font-size: 1.35rem; margin: 0; }
.lh-backdrop { display: none; }
@media (max-width: 900px) {
    .lh-sidebar { transform: translateX(-100%); box-shadow: var(--lh-shadow-lg); }
    .lh-sidebar.open { transform: translateX(0); }
    .lh-main { margin-left: 0; }
    .lh-burger { display: inline-flex; }
    .lh-topbar { padding: var(--lh-space-2) var(--lh-space-4); }
    .lh-page { padding: var(--lh-space-4); }
    .lh-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(34, 34, 34, 0.35); z-index: 850; }
}

/* ---------- Mobile : petites largeurs (360 px) ---------- */
/* Les tableaux des pages vendeur et admin défilent dans leur carte au lieu d'élargir la page */
.lh-page .card, .lh-page .lh-card, .lh-page .chart-card { overflow-x: auto; }
.lh-page { overflow-x: hidden; }

@media (max-width: 760px) {
    .lh-header__inner { flex-wrap: wrap; padding: var(--lh-space-2) 0; }
    .lh-search { order: 3; flex-basis: 100%; max-width: none; }
    .lh-nav .lh-hide-mobile { display: none; }
}
@media (max-width: 400px) {
    .lh-btn { padding: 10px 14px; }
    .lh-logo { font-size: 1.4rem; }
}
