/* DealSwiss — feuille de style responsive */
:root {
  --red: #d52b1e;          /* rouge suisse */
  --red-dark: #b02418;
  --dark: #1f2329;
  --grey: #6b7280;
  --light: #f5f6f8;
  --border: #e2e5ea;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0, 0, 0, .07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--dark);
  background: var(--light);
  line-height: 1.55;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main.container { min-height: 60vh; padding-top: 24px; padding-bottom: 48px; }

/* ---------- En-tête ---------- */
.site-header { background: #fff; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.logo { font-size: 1.5rem; font-weight: 800; color: var(--dark); letter-spacing: -.5px; }
.logo span { color: var(--red); }
.logo:hover { text-decoration: none; }

.search-bar { flex: 1; display: flex; max-width: 520px; }
.search-bar input {
  flex: 1; padding: 9px 14px; border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius); font-size: 1rem; min-width: 0;
}
.search-bar button {
  border: 1px solid var(--red); background: var(--red); color: #fff;
  padding: 0 16px; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer;
}
.cart-link { color: var(--dark); font-weight: 600; white-space: nowrap; }
.cart-badge {
  background: var(--red); color: #fff; border-radius: 999px;
  padding: 1px 8px; font-size: .8rem; margin-left: 2px;
}
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

/* ---------- Navigation catégories ---------- */
.main-nav { border-top: 1px solid var(--border); background: #fff; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.nav-item { position: relative; }
.nav-item > a { display: block; padding: 10px 14px; color: var(--dark); font-weight: 600; }
.nav-item > a:hover { color: var(--red); text-decoration: none; }
.dropdown {
  display: none; position: absolute; top: 100%; left: 0; min-width: 210px;
  background: #fff; border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow); list-style: none; margin: 0; padding: 6px 0; z-index: 60;
}
.nav-item:hover .dropdown { display: block; }
.dropdown a { display: block; padding: 8px 16px; color: var(--dark); }
.dropdown a:hover { background: var(--light); text-decoration: none; }

/* ---------- Accueil ---------- */
.hero {
  background: linear-gradient(120deg, var(--red), var(--red-dark));
  color: #fff; border-radius: var(--radius); padding: 40px 28px; margin-bottom: 32px;
}
.hero h1 { margin: 0 0 8px; }
.hero p { margin: 0; opacity: .92; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 32px; }
.category-card {
  background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; color: var(--dark);
}
.category-card:hover { text-decoration: none; outline: 2px solid var(--red); }
.category-name { font-weight: 700; }
.category-subs { font-size: .85rem; color: var(--grey); }

/* ---------- Grille articles ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.product-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.card-link { color: var(--dark); display: block; }
.card-link:hover { text-decoration: none; }
.card-image { aspect-ratio: 1 / 1; background: #fff; display: flex; align-items: center; justify-content: center; }
.card-image img { max-height: 100%; object-fit: contain; }
.card-title { font-size: .95rem; margin: 10px 12px 4px; min-height: 2.6em; }
.card-bottom { margin: auto 12px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-price { font-weight: 800; color: var(--red); }
.out-of-stock { color: var(--grey); font-size: .82rem; }

/* ---------- Boutons & formulaires ---------- */
.btn {
  display: inline-block; padding: 9px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: #fff; color: var(--dark);
  font-weight: 600; cursor: pointer; font-size: .95rem;
}
.btn:hover { background: var(--light); text-decoration: none; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-small { padding: 6px 12px; font-size: .85rem; }
.btn-large { padding: 13px 28px; font-size: 1.05rem; }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }

label { display: block; margin-bottom: 12px; font-weight: 600; font-size: .92rem; }
input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1rem; margin-top: 4px; background: #fff;
}
textarea { min-height: 120px; resize: vertical; }

.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.alert-error { background: #fdecea; border: 1px solid #f5c6c2; color: #8a1f16; }
.alert-success { background: #e8f6ec; border: 1px solid #bfe5cb; color: #1d6b35; }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------- Fil d'Ariane & puces ---------- */
.breadcrumb { font-size: .88rem; color: var(--grey); margin-bottom: 16px; }
.subcat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 16px; font-weight: 600; color: var(--dark); font-size: .9rem;
}
.chip:hover { border-color: var(--red); color: var(--red); text-decoration: none; }

/* ---------- Page article ---------- */
.product-page { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.gallery-main { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gallery-main img { max-height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumb { width: 64px; height: 64px; object-fit: cover; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; }
.thumb.active { border-color: var(--red); }
.product-number { color: var(--grey); font-size: .88rem; }
.product-price { font-size: 1.9rem; font-weight: 800; color: var(--red); margin: 8px 0 0; }
.vat-note { color: var(--grey); font-size: .85rem; margin-top: 2px; }
.stock-status.in { color: #1d6b35; font-weight: 600; }
.stock-status.out { color: var(--red); font-weight: 600; }
.add-to-cart-form { display: flex; align-items: flex-end; gap: 12px; margin: 16px 0 24px; }
.add-to-cart-form label { margin: 0; }
.add-to-cart-form input { width: 90px; }
.product-specs { border-collapse: collapse; margin-top: 12px; }
.product-specs th, .product-specs td { text-align: left; padding: 6px 16px 6px 0; border-bottom: 1px solid var(--border); }
.product-specs th { color: var(--grey); font-weight: 600; }

/* ---------- Recherche ---------- */
.search-layout { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.filters { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: sticky; top: 130px; }
.filters h2 { margin-top: 0; }
.filter-label { margin-bottom: 14px; }
.filter-check { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.filter-check input { width: auto; margin: 0; }
.result-count { color: var(--grey); }

/* ---------- Panier ---------- */
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cart-table th, .cart-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.cart-product { display: flex; align-items: center; gap: 12px; }
.cart-thumb { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.qty-input { width: 80px; }
.cart-total-label { text-align: right; font-weight: 700; }
.cart-total { font-size: 1.2rem; font-weight: 800; color: var(--red); }
.btn-remove { background: none; border: none; color: var(--grey); font-size: 1.1rem; cursor: pointer; }
.btn-remove:hover { color: var(--red); }
.cart-actions { display: flex; justify-content: space-between; margin-top: 18px; gap: 12px; flex-wrap: wrap; }

/* ---------- Commande ---------- */
.checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.checkout-form, .order-summary { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.form-row { display: grid; grid-template-columns: 120px 1fr; gap: 14px; }
.payment-note { background: var(--light); border-radius: 8px; padding: 12px 14px; color: var(--grey); }
.order-summary ul { list-style: none; padding: 0; margin: 0 0 12px; }
.order-summary li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .93rem; }
.summary-total { font-size: 1.15rem; }
.order-confirm { background: #fff; border-radius: var(--radius); padding: 40px; text-align: center; box-shadow: var(--shadow); }

.empty-message { background: #fff; border-radius: var(--radius); padding: 28px; text-align: center; color: var(--grey); box-shadow: var(--shadow); }

/* ---------- Pied de page ---------- */
.site-footer { background: var(--dark); color: #cfd3da; margin-top: 40px; }
.site-footer a { color: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; padding: 28px 16px; flex-wrap: wrap; }

/* ---------- Admin ---------- */
.admin-body { background: var(--light); }
.admin-header { background: var(--dark); color: #fff; }
.admin-header .container { display: flex; align-items: center; gap: 20px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.admin-header a { color: #cfd3da; font-weight: 600; }
.admin-header a:hover, .admin-header a.active { color: #fff; text-decoration: none; }
.admin-title { font-weight: 800; color: #fff !important; font-size: 1.1rem; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: .93rem; }
.admin-table th { background: var(--light); }
.admin-card { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 1.8rem; font-weight: 800; color: var(--red); }
.photo-list { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-item { position: relative; }
.photo-item img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.login-box { max-width: 380px; margin: 60px auto; background: #fff; border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.inline-form { display: inline; }
.table-actions { white-space: nowrap; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge-ok { background: #e8f6ec; color: #1d6b35; }
.badge-warn { background: #fdf3e0; color: #92600a; }
.badge-off { background: #eee; color: var(--grey); }
.best-price { background: #e8f6ec; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .product-page, .checkout-layout, .admin-grid-2 { grid-template-columns: 1fr; }
  .search-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
}

@media (max-width: 680px) {
  .header-inner { flex-wrap: wrap; }
  .search-bar { order: 3; flex-basis: 100%; max-width: none; }
  .nav-toggle { display: block; }
  .main-nav { display: none; }
  .main-nav.open { display: block; }
  .nav-list { flex-direction: column; }
  .dropdown { display: block; position: static; border: none; box-shadow: none; padding-left: 16px; }

  /* Tableaux empilés sur mobile */
  .cart-table thead { display: none; }
  .cart-table tr { display: block; border-bottom: 2px solid var(--border); padding: 8px 0; }
  .cart-table td { display: flex; justify-content: space-between; align-items: center; border: none; padding: 6px 14px; }
  .cart-table td[data-label]::before { content: attr(data-label); font-weight: 600; color: var(--grey); margin-right: 12px; }
  .cart-product { flex-direction: row; justify-content: flex-start !important; }
  .form-row { grid-template-columns: 1fr; }
}
