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

:root {
  --bg:      #111;
  --bg2:     #1a1a1a;
  --bg3:     #222;
  --red:     #eb0e0e;
  --text:    #e8e8e8;
  --muted:   #888;
  --border:  #333;
}

body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', Arial, sans-serif; font-size: 15px; line-height: 1.5; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--red); }

/* Header */
#header {
  background: var(--bg); border-bottom: 2px solid var(--red);
  padding: 0 24px; display: flex; align-items: center;
  justify-content: space-between; height: 60px;
  position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.logo span { color: var(--red); }

/* Nav */
#nav { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 24px; display: flex; flex-wrap: wrap; }
.nav-item { position: relative; }
.nav-link {
  display: block; padding: 12px 16px; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text);
  border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.nav-link:hover, .nav-link.active { color: var(--red); border-bottom-color: var(--red); }
.dropdown {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--bg3); border: 1px solid var(--border);
  min-width: 200px; z-index: 200; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.nav-item:hover .dropdown { display: block; }
.dropdown-brand { padding: 8px 0; border-bottom: 1px solid var(--border); }
.dropdown-brand:last-child { border-bottom: none; }
.dropdown-brand-name { padding: 6px 16px; font-size: 11px; font-weight: 700; color: var(--red); text-transform: uppercase; }
.dropdown-model { display: block; padding: 5px 24px; font-size: 13px; color: var(--text); }
.dropdown-model:hover { color: var(--red); background: rgba(235,14,14,.06); }

/* Main */
#main { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

/* Grille */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; transition: border-color .15s, transform .15s; cursor: pointer; display: block;
}
.card:hover { border-color: var(--red); transform: translateY(-2px); }
.card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--bg3); display: block; }
.card-placeholder { width: 100%; aspect-ratio: 4/3; background: var(--bg3); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.card-body { padding: 14px; }
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-price { font-size: 18px; font-weight: 700; color: var(--red); margin-bottom: 8px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 3px; background: rgba(235,14,14,.15); color: var(--red); text-transform: uppercase; }

/* Fiche produit */
.product-layout { display: grid; grid-template-columns: 1fr 380px; gap: 40px; align-items: start; }
.gallery-main { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; background: var(--bg3); display: block; }
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gallery-thumb { width: 70px; height: 52px; object-fit: cover; border-radius: 4px; border: 2px solid transparent; cursor: pointer; opacity: .65; transition: opacity .15s, border-color .15s; }
.gallery-thumb.active, .gallery-thumb:hover { border-color: var(--red); opacity: 1; }
.product-info { position: sticky; top: 80px; }
.product-title { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.product-price { font-size: 32px; font-weight: 700; color: var(--red); margin-bottom: 20px; }
.product-desc { color: var(--muted); font-size: 14px; line-height: 1.7; margin-bottom: 24px; white-space: pre-wrap; }
.btn-buy { display: block; width: 100%; padding: 14px; background: var(--red); color: #fff; font-size: 16px; font-weight: 700; text-align: center; border-radius: 5px; border: none; cursor: pointer; transition: background .15s; }
.btn-buy:hover { background: #c50c0c; color: #fff; }

/* Lightbox */
#lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.93); z-index: 1000; justify-content: center; align-items: center; cursor: zoom-out; }
#lightbox.open { display: flex; }
#lightbox img { max-width: 95vw; max-height: 92vh; object-fit: contain; border-radius: 4px; }
#lb-close { position: absolute; top: 16px; right: 24px; font-size: 32px; color: #fff; cursor: pointer; line-height: 1; }

/* Breadcrumb */
.breadcrumb { margin-bottom: 24px; font-size: 13px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb span { margin: 0 6px; }

/* Vide */
.empty { text-align: center; padding: 80px 0; color: var(--muted); }
.empty p { font-size: 18px; margin-bottom: 8px; }

/* Admin */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 16px; margin-bottom: 16px; display: flex; gap: 16px; align-items: flex-start; }
.admin-thumb { width: 100px; height: 75px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--bg3); }
.admin-info { flex: 1; }
.admin-info h3 { font-size: 14px; margin-bottom: 4px; }
.admin-price { color: var(--red); font-weight: 700; }
.admin-meta { color: var(--muted); font-size: 12px; }
.admin-extras { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.extra-wrap { position: relative; }
.extra-wrap img { width: 70px; height: 52px; object-fit: cover; border-radius: 4px; display: block; }
.extra-del { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.upload-row { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input[type="file"] { color: var(--muted); font-size: 13px; }
.btn { display: inline-block; padding: 8px 16px; border-radius: 4px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: #c50c0c; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--red); color: var(--red); }
.login-box { max-width: 340px; margin: 80px auto; padding: 32px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; }
.login-box h2 { margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.form-group input { width: 100%; padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: 14px; }
.form-group input:focus { outline: none; border-color: var(--red); }
.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
.alert-error   { background: rgba(235,14,14,.12); color: #ff6b6b; border: 1px solid rgba(235,14,14,.3); }
.alert-success { background: rgba(0,200,0,.1);    color: #4caf50; border: 1px solid rgba(0,200,0,.2); }

@media (max-width: 768px) {
  .product-layout { grid-template-columns: 1fr; }
  .product-info { position: static; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .nav-link { padding: 10px; font-size: 12px; }
}