:root {
  --or: #c9a84c;
  --or-dark: #8b6914;
  --bleu: #1a1a2e;
  --bleu-clair: #16213e;
  --blanc: #fafafa;
  --gris: #f5f5f5;
  --texte: #2c2c2c;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', sans-serif; color: var(--texte); background: var(--blanc); }

/* NAV */
nav { background: var(--bleu); padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 64px; position: sticky; top: 0; z-index: 100; }
nav .logo { color: var(--or); font-weight: 700; font-size: 1.2rem; text-decoration: none; letter-spacing: 1px; }
nav ul { list-style: none; display: flex; gap: 2rem; }
nav ul a { color: #ccc; text-decoration: none; font-size: 0.9rem; transition: color .2s; }
nav ul a:hover { color: var(--or); }
.cart-icon { position: relative; color: #ccc; font-size: 1.4rem; cursor: pointer; }
#cart-badge { position: absolute; top: -8px; right: -10px; background: var(--or); color: var(--bleu); font-size: 0.7rem; font-weight: 700; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }

/* HERO */
.hero { background: linear-gradient(135deg, var(--bleu) 60%, var(--bleu-clair)); color: white; padding: 5rem 2rem; text-align: center; }
.hero h1 { font-size: 2.5rem; color: var(--or); margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; color: #ccc; max-width: 600px; margin: 0 auto 2rem; }
.btn { display: inline-block; padding: .75rem 2rem; border-radius: var(--radius); font-weight: 600; cursor: pointer; text-decoration: none; transition: all .2s; border: none; font-size: 1rem; }
.btn-or { background: var(--or); color: var(--bleu); }
.btn-or:hover { background: var(--or-dark); color: white; }
.btn-outline { border: 2px solid var(--or); color: var(--or); background: transparent; }
.btn-outline:hover { background: var(--or); color: var(--bleu); }

/* CATALOGUE */
.section { padding: 4rem 2rem; max-width: 1200px; margin: 0 auto; }
.section-title { font-size: 1.8rem; color: var(--bleu); margin-bottom: 2rem; text-align: center; position: relative; }
.section-title::after { content: ''; display: block; width: 60px; height: 3px; background: var(--or); margin: .5rem auto 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }
.card { background: white; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.card img { width: 100%; height: 200px; object-fit: cover; }
.card-body { padding: 1.2rem; }
.card-body h3 { font-size: 1rem; margin-bottom: .5rem; color: var(--bleu); }
.card-body p { font-size: .85rem; color: #666; margin-bottom: 1rem; line-height: 1.5; }
.card-footer { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-top: 1px solid #eee; }
.prix { font-size: 1.2rem; font-weight: 700; color: var(--or-dark); }
.badge-perso { background: var(--or); color: var(--bleu); font-size: .7rem; font-weight: 700; padding: .2rem .6rem; border-radius: 20px; }

/* CONFIGURATEUR */
.configurateur { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
#cachet-preview { border: 2px solid #eee; border-radius: 50%; display: block; margin: 0 auto; background: #f5f0e8; }
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .4rem; font-size: .9rem; color: var(--bleu); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: .65rem 1rem; border: 1.5px solid #ddd; border-radius: var(--radius); font-size: .95rem; transition: border-color .2s; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--or); }
.radio-group { display: flex; gap: 1rem; }
.radio-group label { display: flex; align-items: center; gap: .5rem; font-weight: 400; cursor: pointer; padding: .5rem 1rem; border: 1.5px solid #ddd; border-radius: var(--radius); transition: all .2s; }
.radio-group input:checked + span { color: var(--or-dark); }
.radio-group label:has(input:checked) { border-color: var(--or); background: #fdf8ec; }

/* FOOTER */
footer { background: var(--bleu); color: #aaa; text-align: center; padding: 2rem; font-size: .85rem; margin-top: 4rem; }
footer a { color: var(--or); text-decoration: none; }

@media (max-width: 768px) {
  .configurateur { grid-template-columns: 1fr; }
  nav ul { display: none; }
  .hero h1 { font-size: 1.8rem; }
}

/* ===== Menu mobile (burger) ===== */
.burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
  margin-left: auto;
  margin-right: 1rem;
}
.burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--marine, #1B2A44);
  transition: transform .25s, opacity .25s;
}
.burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .burger { display: flex; }
  nav ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    gap: 0;
    padding: .4rem 0;
    border-bottom: 1px solid var(--ligne, #E1E4E9);
    box-shadow: 0 6px 18px rgba(27,42,68,.10);
  }
  nav ul.open { display: flex; }
  nav ul li { width: 100%; }
  nav ul a {
    display: block;
    padding: .95rem 1.5rem;
    border-bottom: 1px solid #f2f3f5;
  }
  nav ul li:last-child a { border-bottom: none; }
}

/* Renfort visibilite menu mobile */
@media (max-width: 768px) {
  .burger {
    background: var(--marine, #1B2A44);
    border-radius: 6px;
    padding: 10px 9px;
    gap: 4px;
  }
  .burger span {
    background: var(--or, #C9A24B);
    width: 22px;
    height: 2.5px;
  }
  nav ul {
    background: var(--marine, #1B2A44);
    border-top: 2px solid var(--or, #C9A24B);
    padding: .3rem 0;
  }
  nav ul a {
    color: #fff !important;
    font-size: 1rem;
    padding: 1.05rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  nav ul a:active { background: rgba(255,255,255,.08); }
}

/* Empeche tout debordement horizontal */
html, body { overflow-x: hidden; max-width: 100%; }
img, canvas, table { max-width: 100%; }

@media (max-width: 768px) {
  .section { padding: 2.5rem 1rem; }
  .panier-wrap, .checkout-wrap, .produit-wrap, .contact-wrap, .admin-wrap { padding-left: 0; padding-right: 0; }
}

/* ===== Back-office responsive ===== */
@media (max-width: 768px) {
  .admin-nav {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    padding: .8rem 1rem;
    gap: .5rem;
  }
  .admin-nav > div {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1rem;
    width: 100%;
  }
  .admin-nav a { margin-left: 0 !important; font-size: .85rem; padding: .25rem 0; }
  .admin-wrap { padding: 0 1rem; margin: 1.2rem auto; }

  /* Tableaux transformes en cartes */
  table { display: block; box-shadow: none; background: transparent; }
  thead { display: none; }
  tbody, tr, td { display: block; width: 100%; }
  tr {
    background: #fff;
    border: 1px solid var(--ligne, #E1E4E9);
    border-radius: 8px;
    padding: .8rem 1rem;
    margin-bottom: .9rem;
    box-shadow: 0 2px 8px rgba(27,42,68,.06);
  }
  tr:hover { background: #fff; }
  td {
    padding: .45rem 0;
    border-bottom: 1px solid #f4f5f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    text-align: right;
  }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--marine, #1B2A44);
    font-size: .8rem;
    text-align: left;
    flex-shrink: 0;
  }
  .bat-select, .btn-edit { width: auto; max-width: 60%; }

  /* Tabs et stats */
  .tabs { flex-direction: column; gap: .5rem; }
  .tab { text-align: center; }
  .stats-grid, .actions-grid { grid-template-columns: 1fr; gap: 1rem; }

  /* Modale d'edition */
  .modal-content { margin: 1rem; padding: 1.2rem; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

/* Correction chevauchement nav admin sur mobile */
@media (max-width: 768px) {
  .admin-nav {
    position: relative;
    z-index: 20;
    padding-bottom: 1rem;
  }
  .admin-nav > div {
    margin-top: .3rem;
    padding-top: .5rem;
    border-top: 1px solid rgba(255,255,255,.15);
  }
  .admin-nav a {
    display: inline-block;
    padding: .35rem .6rem;
    background: rgba(255,255,255,.07);
    border-radius: 4px;
  }
  .admin-wrap { margin-top: 1.5rem; position: relative; z-index: 1; }
  .admin-wrap h1 { font-size: 1.3rem; margin-bottom: 1.2rem; }
}

/* Force la hauteur auto de la nav admin sur mobile */
@media (max-width: 768px) {
  .admin-nav {
    height: auto !important;
    min-height: 0 !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: .8rem 1rem 1rem !important;
  }
}
