/* ============================================================
   HOPLA — Design System 2026
   ============================================================ */

:root {
  /* Couleurs : noir/blanc dominants, accents ultra-sobres */
  --ink: #0a0a0a;
  --ink-2: #18181b;
  --ink-3: #3f3f46;
  --ink-soft: #71717a;
  --ink-faint: #a1a1aa;
  --line: #e4e4e7;
  --line-2: #f4f4f5;
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-hover: #f4f4f5;

  /* Accents sobres pour badges de statut uniquement */
  --accent: #0a0a0a;
  --success: #047857;
  --success-bg: #ecfdf5;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --info: #1d4ed8;
  --info-bg: #eff6ff;

  /* Ombres subtiles */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);

  /* Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Typo */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Transitions */
  --t-fast: 120ms ease;
  --t: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-slow: 320ms cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Variables de thème (par défaut = identique à l'admin) */
  --theme-bg: #ffffff;
  --theme-surface: #fafafa;
  --theme-ink: #0a0a0a;
  --theme-accent: #0a0a0a;
}

/* Appliquer le thème sur la boutique publique */
.themed {
  background: var(--theme-bg) !important;
  color: var(--theme-ink) !important;
}
.themed .shop-nav,
.themed .shop-footer { background: var(--theme-bg); }
.themed .shop-name { color: var(--theme-ink); }
.themed .shop-hero h1 { color: var(--theme-ink); }
.themed .product-card-premium .media { background: var(--theme-surface); }
.themed .product-card-premium .meta { background: var(--theme-bg); }
.themed .product-card-premium .name,
.themed .product-card-premium .price { color: var(--theme-ink); }
.themed .cat-filter.active,
.themed .btn-primary:not(.plan-cta) {
  background: var(--theme-accent);
  border-color: var(--theme-accent);
}
.themed .cart-btn .cart-count { background: var(--theme-accent); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  color-scheme: light;
  background: var(--bg);
}

html, body {
  background: var(--bg) !important;
  color: var(--ink) !important;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
}

/* ---------- Typo ---------- */
h1, h2, h3, h4 {
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

h1 { font-size: 40px; letter-spacing: -0.03em; }
h2 { font-size: 28px; }
h3 { font-size: 20px; }
h4 { font-size: 16px; }

p { color: var(--ink-3); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Logo Hopla ---------- */
.hopla-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.03em;
  line-height: 1;
  transition: opacity var(--t-fast);
}
.hopla-logo:hover { opacity: 0.7; }

.hopla-logo .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--bg);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.hopla-logo .mark::after {
  content: 'H';
}
.hopla-logo .word { color: var(--ink); }

.hopla-logo.compact .word { display: none; }
.hopla-logo.compact { gap: 0; }

.hopla-logo.large { font-size: 28px; gap: 12px; }
.hopla-logo.large .mark { width: 36px; height: 36px; font-size: 20px; border-radius: 8px; }

.hopla-logo.xl { font-size: 44px; gap: 14px; }
.hopla-logo.xl .mark { width: 52px; height: 52px; font-size: 28px; border-radius: 10px; }

/* ---------- Layout ---------- */
.container { max-width: 680px; margin: 0 auto; padding: 24px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ---------- Boutons ---------- */
.btn-primary,
.btn-ghost,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  line-height: 1.2;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover:not(:disabled) {
  background: var(--ink-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--ink-faint);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-primary .arrow,
.btn-ghost .arrow,
.btn-secondary .arrow { transition: transform var(--t-fast); font-weight: 600; }
.btn-primary:hover .arrow,
.btn-secondary:hover .arrow { transform: translateX(3px); }

/* Loader inline bouton */
.loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 60vh;
  color: var(--ink-soft);
  font-size: 14px;
}
.loader-page .loader {
  width: 22px; height: 22px;
  border-width: 2px;
  color: var(--ink);
}

/* ---------- Navigation (landing) ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

/* ---------- Formulaires ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="date"],
.field input[type="password"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}
.field textarea { resize: vertical; min-height: 88px; }
.field .hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 6px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.form-actions .spacer { flex: 1; }

.form-header {
  margin-bottom: 22px;
}
.form-header .eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-weight: 600;
}
.form-header h2 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--bg-hover); color: var(--ink-3); }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--t);
}
.modal-backdrop.active { display: flex; opacity: 1; }

/* Bloquer le scroll de la page quand un modal est ouvert */
body.modal-open { overflow: hidden; }

.modal {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  transform: translateY(10px);
  transition: transform var(--t);
}
.modal-backdrop.active .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  cursor: pointer;
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transition: all var(--t);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.empty-state h3 { font-size: 18px; margin-bottom: 6px; color: var(--ink); }
.empty-state p { color: var(--ink-soft); font-size: 14px; margin-bottom: 18px; }

/* ---------- Cards produits : BOUTIQUE PUBLIQUE ---------- */
.products-grid-premium {
  display: grid;
  /* Mobile : toujours 2 colonnes */
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 12px;
}
@media (min-width: 680px) {
  .products-grid-premium {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px 20px;
  }
}
@media (min-width: 1000px) {
  .products-grid-premium {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px 28px;
  }
}
@media (min-width: 1280px) {
  .products-grid-premium {
    grid-template-columns: repeat(4, 1fr);
    gap: 48px 32px;
  }
}

/* Mobile : ajustements pour garder les cartes lisibles en 2 colonnes */
@media (max-width: 679px) {
  .product-card-premium .meta {
    padding: 10px 12px 12px;
  }
  .product-card-premium .name {
    font-size: 13px;
    line-height: 1.3;
  }
  .product-card-premium .price {
    font-size: 14px;
  }
  .product-card-premium .sub {
    display: none; /* pas de place sur mobile en 2 col */
  }
  .product-card-premium .stars-inline {
    font-size: 11px;
    margin-top: 2px;
  }
  .product-card-premium .badge-corner {
    padding: 3px 8px;
    font-size: 10px;
    top: 6px;
    left: 6px;
  }
}

.product-card-premium {
  position: relative;
  cursor: pointer;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--t);
  display: flex;
  flex-direction: column;
}
.product-card-premium:hover {
  border-color: var(--ink-faint);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.product-card-premium .media {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-subtle);
  background-image:
    linear-gradient(135deg, #fafafa 0%, #f4f4f5 50%, #e4e4e7 100%);
  margin-bottom: 0;
}
.product-card-premium .media::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'><rect width='18' height='18' x='3' y='3' rx='2' ry='2'/><circle cx='9' cy='9' r='2'/><path d='m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21'/></svg>") center no-repeat;
  opacity: 0.5;
}
.product-card-premium .media .img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1;
}
.product-card-premium:hover .img { transform: scale(1.04); }

.product-card-premium .meta {
  padding: 14px 16px 16px;
  background: var(--bg);
}
.product-card-premium .meta-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.product-card-premium .name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-card-premium .price {
  font-size: 16px;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.product-card-premium .sub {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-premium .sub:empty { display: none; }

.product-card-premium .stars-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.product-card-premium .stars-inline .stars {
  color: #f59e0b;
  letter-spacing: 0;
  font-size: 12px;
}

.product-card-premium .badge-corner {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--bg);
  color: var(--ink);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  z-index: 2;
  border-radius: 100px;
  box-shadow: var(--shadow);
}

.product-card-premium.out-of-stock { opacity: 0.55; }
.product-card-premium.out-of-stock .img { filter: grayscale(1); }

/* ---------- Cards produits : DASHBOARD ---------- */
.products-grid-dashboard {
  display: grid;
  /* Mobile + tablette (tant que la sidebar est masquée) : 2 colonnes */
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 861px) {
  .products-grid-dashboard {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
  }
}

/* Mobile : ajustements cartes dashboard */
@media (max-width: 860px) {
  .product-card-dashboard .info { padding: 10px 12px; }
  .product-card-dashboard .name { font-size: 13px; }
  .product-card-dashboard .price { font-size: 13px; }
  .product-card-dashboard .tags-row { font-size: 11px; }
  .add-product-card-premium { font-size: 13px; padding: 12px; }
}

.product-card-dashboard {
  position: relative;
  cursor: pointer;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--t);
}
.product-card-dashboard:hover {
  border-color: var(--ink-faint);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.product-card-dashboard .media {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-subtle);
  background-image: linear-gradient(135deg, #fafafa, #f4f4f5);
}
.product-card-dashboard .media::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'><rect width='18' height='18' x='3' y='3' rx='2' ry='2'/><circle cx='9' cy='9' r='2'/><path d='m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21'/></svg>") center no-repeat;
  opacity: 0.5;
}
.product-card-dashboard .img {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1;
}
.product-card-dashboard:hover .img { transform: scale(1.04); }

.product-card-dashboard .info {
  padding: 12px 14px;
}
.product-card-dashboard .meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.product-card-dashboard .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.product-card-dashboard .price {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.product-card-dashboard .tags-row {
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.product-card-dashboard .stock-tag.low { color: var(--warning); font-weight: 500; }
.product-card-dashboard .stock-tag.out { color: var(--danger); font-weight: 500; }

.product-card-dashboard.hidden-product { opacity: 0.55; }
.product-card-dashboard .hidden-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  font-weight: 600;
  z-index: 2;
  border-radius: 4px;
}

.add-product-card-premium {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: var(--bg-subtle);
  border: 1.5px dashed var(--line);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  border-radius: var(--radius-md);
  text-align: center;
  padding: 16px;
}
.add-product-card-premium:hover {
  border-color: var(--ink);
  background: var(--bg-hover);
  color: var(--ink);
}
.add-product-card-premium.locked {
  border-style: solid;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
}

.products-grid-dashboard .hidden-section-title {
  grid-column: 1 / -1;
  padding: 16px 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 12px;
}
.hidden-section-title strong { color: var(--ink); font-weight: 600; }
.hidden-section-title a { color: var(--ink); cursor: pointer; text-decoration: underline; }
