/* ========= Variables ========= */
:root{
  --navy:#0b1d3a;
  --ink:#1f2740;
  --muted:#667085;
  --line:#e6e9ef;
  --bg:#f5f7fb;
  --shadow: 0 10px 26px rgba(0,0,0,.06);

  --accent-1:#2b7ac6;  /* Islands */
  --accent-2:#2e8b57;  /* Highlands */
  --accent-3:#b95a00;  /* Speyside */
  --accent-4:#d4b100;  /* Lowlands */
  --accent-5:#6c3eb5;  /* Campbeltown */
  --accent-6:#f0a43c;  /* Islay */
  --accent-7:#ef709b;  /* Autres */
}

/* ========= Base ========= */
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{ font-family:'Source Sans Pro', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background:var(--bg); color:var(--ink); }
a{ color:var(--navy); text-decoration:none; }
a:hover{ text-decoration:underline; }
.container{ max-width:1180px; margin:0 auto; padding:10px 16px; }
.shadow{ box-shadow:var(--shadow); }

/* ========= Icônes via CSS mask ========= */
.ico{ display:inline-block; width:18px; height:18px; background: currentColor; }
.ico.burger{ -webkit-mask:url('../icons/burger.svg') no-repeat center/contain; mask:url('../icons/burger.svg') no-repeat center/contain; }
.ico.logout{ -webkit-mask:url('../icons/logout.svg') no-repeat center/contain; mask:url('../icons/logout.svg') no-repeat center/contain; }
.ico.stats{ -webkit-mask:url('../icons/stats.svg') no-repeat center/contain; mask:url('../icons/stats.svg') no-repeat center/contain; }
.ico.glass{ width:16px;height:16px; -webkit-mask:url('../icons/glass.svg') no-repeat center/contain; mask:url('../icons/glass.svg') no-repeat center/contain; }

/* Icônes d'onglets (régions) */
.ico-tab{ display:inline-block; width:18px; height:18px; background: currentColor; }
.ico-tab.all        { -webkit-mask:url('../icons/globe.svg') no-repeat center/contain;       mask:url('../icons/globe.svg') no-repeat center/contain; }
.ico-tab.islands    { -webkit-mask:url('../icons/islands.svg') no-repeat center/contain;     mask:url('../icons/islands.svg') no-repeat center/contain; }
.ico-tab.highlands  { -webkit-mask:url('../icons/highlands.svg') no-repeat center/contain;   mask:url('../icons/highlands.svg') no-repeat center/contain; }
.ico-tab.speyside   { -webkit-mask:url('../icons/drop.svg') no-repeat center/contain;        mask:url('../icons/drop.svg') no-repeat center/contain; }
.ico-tab.lowlands   { -webkit-mask:url('../icons/lowlands.svg') no-repeat center/contain;    mask:url('../icons/lowlands.svg') no-repeat center/contain; }
.ico-tab.campbeltown{ -webkit-mask:url('../icons/anchor.svg') no-repeat center/contain;      mask:url('../icons/anchor.svg') no-repeat center/contain; }
.ico-tab.islay      { -webkit-mask:url('../icons/smoke.svg') no-repeat center/contain;       mask:url('../icons/smoke.svg') no-repeat center/contain; }
.ico-tab.others     { -webkit-mask:url('../icons/globe.svg') no-repeat center/contain;       mask:url('../icons/globe.svg') no-repeat center/contain; }

/* ========= Header ========= */
.main-header{ background:#fff; position:sticky; top:0; z-index:1000; box-shadow:0 1px 0 rgba(0,0,0,.05); }
.header-bar{ display:flex; align-items:center; gap:12px; padding:12px 0; position:relative; }
.brand{ display:inline-flex; align-items:center; justify-content:center; padding:8px; }
.brand img{ height:40px; display:block; }
.topnav{ margin-left:auto; }
.topnav ul{ display:flex; gap:26px; list-style:none; margin:0; padding:0; align-items:center; }
.topnav a{ font-weight:700; color:#1f2740; }
.topnav a.active{ text-decoration:underline; text-underline-offset:8px; }
.header-actions{ display:flex; align-items:center; gap:10px; margin-left:auto; }
.icon-link{ color:var(--ink); padding:8px; border-radius:10px; border:1px solid transparent; display:inline-flex; align-items:center; justify-content:center; }
.icon-link:hover{ border-color:var(--line); }

/* Burger */
.nav-toggle{
  display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; border:none; background:#fff;
  color:#1f2740; border:1px solid #e7e9f0; border-radius:12px; cursor:pointer;
  z-index:3000;
}

/* Desktop: cacher burger, montrer nav */
@media (min-width:1025px){
  .nav-toggle{ display:none !important; }
  .topnav{ display:block !important; }
  .header-actions{ display:flex !important; }
}

/* Mobile: cacher nav desktop */
@media (max-width:1024px){
  .topnav, .header-actions{ display:none !important; }
  .header-bar{ justify-content:center; }
  .brand{ margin:0 auto; }
  .nav-toggle{
    position:absolute !important; left:12px !important;
    top:50% !important; transform:translateY(-50%) !important;
  }
}

/* Tiroir mobile */
.mobile-drawer{
  position:fixed !important; top:0 !important; left:0 !important; bottom:0 !important;
  width:280px !important; max-width:86vw !important; background:#fff !important;
  transform:translateX(-100%) !important; transition:transform .2s ease !important;
  z-index:4000 !important; padding:16px !important; overflow-y:auto !important;
  box-shadow:4px 0 20px rgba(0,0,0,.12) !important;
}
.mobile-drawer nav ul{ list-style:none !important; margin:0 !important; padding:0 !important; }
.mobile-drawer nav a{ display:flex !important; align-items:center !important; gap:10px !important; padding:10px 8px !important; border-radius:10px !important; color:#111 !important; text-decoration:none !important; }
.drawer-sep{ height:1px; background:#eee; margin:6px 0; }

.drawer-backdrop{
  position:fixed !important; inset:0 !important; background:rgba(0,0,0,.35) !important;
  opacity:0 !important; pointer-events:none !important; transition:opacity .2s ease !important;
  z-index:3500 !important;
}

/* État ouvert (via JS qui ajoute la classe sur <html>) */
html.nav-open .mobile-drawer{ transform:translateX(0) !important; }
html.nav-open .drawer-backdrop{ opacity:1 !important; pointer-events:auto !important; }
html.nav-open .nav-toggle{ opacity:0 !important; pointer-events:none !important; }
html.nav-open, html.nav-open body{ overflow:hidden !important; }

/* ========= Tabs régions ========= */
.region-tabs{ display:flex; flex-wrap:wrap; gap:12px; margin:14px 0; }
.tab{
  background:#fff; border:2px solid #e9edf3; border-radius:24px; height:44px;
  padding:0 14px; display:inline-flex; align-items:center; gap:10px; font-weight:700; color:#26334d;
  box-shadow:0 3px 16px rgba(0,0,0,.04); cursor:pointer;
}
.tab.active{ outline:2px solid #0b0b0b; outline-offset:-2px; }
.tab.region-1.active{ color:var(--accent-1); }
.tab.region-2.active{ color:var(--accent-2); }
.tab.region-3.active{ color:var(--accent-3); }
.tab.region-4.active{ color:var(--accent-4); }
.tab.region-5.active{ color:var(--accent-5); }
.tab.region-6.active{ color:var(--accent-6); }
.tab.region-7.active{ color:var(--accent-7); }

/* Select mobile */
.region-select-mobile{ display:none; }
@media (max-width:820px){
  .region-tabs{ display:none; }
  .region-select-mobile{ display:block; margin:10px 0; }
  .region-select-mobile select{ width:100%; height:44px; border-radius:12px; border:1px solid var(--line); background:#fff; padding:0 10px; }
}

/* ========= Barre outils ========= */
.tools-bar{
  display:flex; flex-wrap:wrap; align-items:center; gap:12px;
  justify-content:flex-start; margin:12px 0;
}
.tools-left{ display:flex; gap:10px; }

@media (max-width:600px){
  #searchForm{ flex:1 1 100%; }
}

#searchForm{ flex:1; max-width:250px; }
#searchInput{ width:250px; height:44px; border-radius:12px; border:1px solid var(--line); background:#fff; padding:0 12px; }
#wlSearchInput{ width:250px; height:44px; border-radius:12px; border:1px solid var(--line); background:#fff; padding:0 12px; }

/* ========= Boutons ========= */
.btn{ display:inline-flex; align-items:center; justify-content:center; padding:10px 14px; border-radius:12px; border:2px solid transparent; font-weight:700; cursor:pointer; text-decoration:none; }
.btn-primary{ background:var(--navy); border-color:var(--navy); color:#fff; }
.btn-outline{ background:#fff; border-color:var(--navy); color:var(--navy); }
.btn-danger{ background:#b42318; border-color:#b42318; color:#fff; }
.btn:hover{ box-shadow:0 6px 16px rgba(0,0,0,.06); text-decoration:none; }

/* ========= Grilles cartes ========= */
.cards-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:16px;
}
@media (max-width: 1000px){ .cards-grid{ gap:14px; } }
@media (max-width: 880px){ .cards-grid{ grid-template-columns: 1fr; } }

/* Grille spécifique pour notes/bibliothèque */
.cards-grid.notes{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:18px;
}
@media (max-width:1200px){ .cards-grid.notes{ grid-template-columns: repeat(2, minmax(0,1fr)); gap:16px; } }
@media (max-width:900px){ .cards-grid.notes{ grid-template-columns: 1fr; gap:14px; } }

/* ========= Carte whisky (dashboard/wishlist) ========= */
.card.whisky-card{
  background:#fff; border:1px solid var(--line); border-radius:20px;
  box-shadow: 0 6px 18px rgba(0,0,0,.04); padding:16px;
  display:grid; grid-template-columns: 140px 1fr 40px;
  gap:16px; align-items:start;
}
.whisky-card.region-1{ border-color: var(--accent-1); }
.whisky-card.region-2{ border-color: var(--accent-2); }
.whisky-card.region-3{ border-color: var(--accent-3); }
.whisky-card.region-4{ border-color: var(--accent-4); }
.whisky-card.region-5{ border-color: var(--accent-5); }
.whisky-card.region-6{ border-color: var(--accent-6); }
.whisky-card.region-7{ border-color: var(--accent-7); }

.whisky-card .pic{ width:140px; height:auto; border-radius:12px; object-fit:cover; background:#f4f6fa; }
.whisky-card .title{ font-weight:800; font-size:22px; margin:0 0 2px; }
.whisky-card .whisky-name{ font-family:'Abril Fatface', serif; font-style:italic; font-size:26px; line-height:1.1; margin:0 0 8px; }
.whisky-card p{ margin:8px 0 10px; }
.whisky-card .meta{ display:flex; align-items:center; gap:8px; color:var(--muted); }
.whisky-card .stars{ font-size:16px; letter-spacing:1px; }
.whisky-card .added-at{ margin-top:6px; color:#98A2B3; font-size:13px; }

/* Bouton éditer */
.whisky-card .edit{
  align-self:start; justify-self:end; width:36px; height:36px;
  display:inline-grid; place-items:center;
  border:1px solid var(--line); border-radius:12px; background:#fff;
}
.whisky-card .edit:hover{ box-shadow:0 2px 10px rgba(0,0,0,.06); }

/* Mobile : carte en pile */
@media (max-width:640px){
  .card.whisky-card{
    grid-template-columns: 1fr; grid-template-rows: auto auto;
    position: relative; text-align:left;
  }
  .whisky-card .pic{
    width: 60%; max-width: 220px; justify-self: center; margin-bottom: 8px;
  }
  .whisky-card .edit{
    position:absolute; top:12px; right:12px;
  }
}

/* Couleur du nom selon région */
.whisky-card.islands      .whisky-name { color: #2b7ac6; }
.whisky-card.highlands    .whisky-name { color: #2e8b57; }
.whisky-card.speyside     .whisky-name { color: #b95a00; }
.whisky-card.lowlands     .whisky-name { color: #a17800; }
.whisky-card.campbeltown  .whisky-name { color: #6c3eb5; }
.whisky-card.islay        .whisky-name { color: #6b4e16; }
.whisky-card.autres       .whisky-name { color: #9a1b4a; }

/* ========= Carte popular (bibliothèque) ========= */
.card.whisky-card.popular{
  position: relative; display:block; background:#fff;
  border:1px solid var(--line); border-radius:16px;
  box-shadow:0 6px 18px rgba(0,0,0,.04);
  padding:18px 18px 16px; overflow:hidden;
}

/* Bouton modifier en haut-droite */
.card.whisky-card.popular .edit-link{
  position:absolute; top:12px; right:12px;
  width:40px; height:40px; display:inline-grid; place-items:center;
  border:1px solid var(--line); border-radius:12px;
  background:#fff; color:var(--ink); text-decoration:none;
}
.card.whisky-card.popular .edit-link:hover{
  box-shadow:0 2px 10px rgba(0,0,0,.08);
}

/* Titres */
.card.whisky-card.popular .title{
  margin:0 0 4px; font-weight:800; color:var(--ink);
  font-size:clamp(15px, 2vw, 18px); line-height:1.2;
  padding-right:50px; word-break:break-word;
}

.card.whisky-card.popular .whisky-name{
  font-family:'Source Sans Pro', system-ui, sans-serif;
  font-weight:800;
  margin:0 0 12px; line-height:1.2;
  font-size:clamp(20px, 2.6vw, 28px);
  word-break:break-word; overflow-wrap:break-word;
}

/* Ligne style + alcool */
.card.whisky-card.popular .meta-line{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin:0 0 12px; flex-wrap:wrap;
}

.card.whisky-card.popular .style-info{
  color:var(--muted); font-weight:600; font-size:14px;
  flex:1 1 auto; min-width:0;
}

/* Badge alcool */
.alcohol-badge{
  display:inline-flex; align-items:center; justify-content:center;
  height:28px; padding:0 12px; border-radius:999px;
  background:linear-gradient(135deg, #f3f6ff 0%, #e8ecff 100%);
  border:1px solid #d4daf7; color:#2c3b8f;
  font-weight:800; font-size:13px; white-space:nowrap;
  flex-shrink:0;
}

/* Bouton Voir plus */
.card.whisky-card.popular .toggle-details{
  width:100%; display:inline-flex; align-items:center; justify-content:center;
  gap:8px; height:40px; border:1px solid var(--line);
  background:#fff; border-radius:10px; cursor:pointer; font-weight:700;
}
.card.whisky-card.popular .toggle-details .chev{
  transition: transform .2s ease;
}
.card.whisky-card.popular .toggle-details[aria-expanded="true"] .chev{
  transform: rotate(180deg);
}

/* Détails */
.card.whisky-card.popular .details{
  margin-top:12px; border-top:1px dashed var(--line); padding-top:12px;
}
.card.whisky-card.popular .columns{
  display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:14px;
}
@media (max-width:900px){
  .card.whisky-card.popular .columns{ grid-template-columns: 1fr; }
}
.card.whisky-card.popular .col h4{
  margin:0 0 6px; font-size:13px; letter-spacing:.3px;
  text-transform:uppercase; color:#667085;
}
.card.whisky-card.popular .col p{ margin:0; }

.card.whisky-card.popular .extra{ margin-top:12px; }
.card.whisky-card.popular .anecdote{ margin:0 0 8px; white-space:pre-wrap; }
.card.whisky-card.popular .price-line{ font-weight:800; color:#2c3b8f; }

@media (max-width:900px){
  .card.whisky-card.popular .whisky-name{
    font-size:clamp(18px, 5vw, 24px);
  }
  .card.whisky-card.popular .meta-line{
    flex-direction:column; align-items:flex-start;
  }
  .alcohol-badge{
    align-self:flex-start;
  }
}

/* ========= Formulaires ========= */
.page-narrow{ max-width: 820px; }
.page-title{ font-size: 22px; margin: 10px 0 18px; }
.page-body{ padding-bottom:40px; }

.form-card{
  background:#fff; border-radius:18px; padding:18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
}
.field{ margin-bottom:14px; }
.field label{ display:block; font-weight:600; margin-bottom:6px; }
.field .err{ color:#c0392b; font-size:12px; margin-top:6px; }
.field .hint{ color:#667085; font-size:12px; margin-top:4px; }
.req{ color:#e67e22; }

.form-card input[type="text"],
.form-card input[type="url"],
.form-card input[type="number"],
.form-card input[type="file"],
.form-card select,
.form-card textarea{
  width:100%; padding:12px 14px; border:1px solid #e6e9f2;
  border-radius:12px; outline:none; font-family:inherit;
}
.form-card textarea{ resize:vertical; }
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus{
  border-color:var(--navy);
}

.fieldset{ border:1px solid #eef1f6; border-radius:14px; padding:12px; }
.fieldset legend{ padding:0 6px; font-weight:700; color:#1f2740; }

.checkbox input{ margin-right:10px; transform: translateY(1px); }

.form-actions{ display:flex; gap:10px; justify-content:flex-end; padding-top:8px; }

.grid-2{ display:grid; grid-template-columns:1fr; gap:12px; }
@media(min-width:720px){ .grid-2{ grid-template-columns:1fr 1fr; } }

.pager{ text-align:center; margin:16px 0 40px; }

/* ========= Statistiques ========= */
.stats-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(240px,1fr)); gap:16px; margin:20px 0; }
.stat-card{ background:#fff; border:1px solid var(--line); border-radius:14px; padding:16px; box-shadow:0 4px 16px rgba(0,0,0,.04); }
.stat-title{ font-weight:700; color:var(--muted); margin-bottom:8px; }
.stat-value{ font-size:32px; font-weight:800; color:var(--navy); }
.stat-body{ margin-top:8px; }
.stat-list{ list-style:none; margin:0; padding:0; }
.stat-list li{ padding:6px 0; border-bottom:1px solid #f0f2f5; }
.stat-list li:last-child{ border:none; }
.muted{ color:var(--muted); }
