:root {
    --wine-red: #722f37;
    --wine-dark: #4a1a20;
    --wine-light: #f5e6e8;
}

body {
    background-color: #f8f9fa;
}

.navbar-brand {
    font-weight: bold;
    color: #e8c4c4 !important;
}

.navbar.bg-dark {
    background-color: var(--wine-dark) !important;
}

.btn-wine {
    background-color: var(--wine-red);
    color: white;
    border: none;
}

.btn-wine:hover {
    background-color: var(--wine-dark);
    color: white;
}

.card {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: none;
}

/* ===== Fiche vin — emplacements ===== */
.emp-row { cursor: pointer; transition: background .15s, box-shadow .15s; }
.emp-row:hover { background: rgba(220,53,69,.07) !important; box-shadow: inset 3px 0 0 #dc3545; }
.emp-row:hover td:last-child i { transform: scale(1.25); transition: transform .15s; }

/* ===== Liste vins — cartes ===== */
.carte-vin { transition: transform .15s, box-shadow .15s; }
.carte-vin:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.12) !important; }
.carte-vin-photo { width:100%; aspect-ratio:3/4; background:#f5f0eb; display:flex; align-items:center; justify-content:center; overflow:hidden; border-radius:var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; }
.carte-vin-photo img { width:100%; height:100%; object-fit:contain; object-position:center; }
.carte-vin-placeholder span { font-size:3rem; opacity:.5; }

/* ===== Liste vins — recherche intelligente (dropdown & tags) ===== */
#searchDropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1050;
    background: #fff; border: 1px solid #dee2e6; border-radius: 10px;
    box-shadow: 0 10px 32px rgba(0,0,0,.13); max-height: 420px; overflow-y: auto;
    display: none;
}
.sdrop-group { border-bottom: 1px solid #f3f3f3; }
.sdrop-group:last-child { border-bottom: none; }
.sdrop-cat { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 9px 14px 4px; color: #bbb; }
.sdrop-item { display: flex; align-items: center; gap: 9px; padding: 7px 14px; cursor: pointer; transition: background .1s; }
.sdrop-item:hover, .sdrop-item.sdrop-selected { background: #f8f8f8; }
.sdrop-badge { font-size: .65rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
.sdrop-label { font-size: .875rem; color: #222; }
.sdrop-label mark { background: none; font-weight: 700; padding: 0; }

#activeTags:empty { display: none !important; }
.stag {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1.5px solid; border-radius: 20px;
    padding: 3px 9px 3px 11px; font-size: .8rem; font-weight: 500;
    transition: opacity .15s;
}
.stag-cat { opacity: .65; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.stag-val { font-weight: 600; }
.stag-rm { background: none; border: none; padding: 0; line-height: 1; font-size: 1.05rem; cursor: pointer; opacity: .55; margin-left: 1px; }
.stag-rm:hover { opacity: 1; }

/* ===== Plan de cave ===== */

/* Casiers côte à côte */
.cave-meubles-wrap { display: flex; flex-direction: row; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.cave-meuble-card  { flex: 0 0 auto; }

/* Grille */
.cave-rack      { display: flex; flex-direction: column; gap: 5px; }
.cave-row       { display: flex; align-items: center; gap: 5px; }
.cave-et-label  { width: 22px; text-align: right; font-size: .7rem; color: #999; flex-shrink: 0; }
.cave-col-head  { width: 54px; text-align: center; font-size: .7rem; color: #999; }
.cave-cell      { width: 54px; display: flex; flex-direction: column; gap: 0; align-items: flex-start; padding: 3px 0; }

/* Sphère */
.bouteille {
  width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; position: relative; flex-shrink: 0;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  animation: spherePop .4s cubic-bezier(.34,1.56,.64,1) both;
  background-image:
    radial-gradient(circle at 35% 32%, rgba(255,255,255,.50) 0%, transparent 58%),
    linear-gradient(to bottom, rgba(232,225,210,.92) 0%, rgba(232,225,210,.5) 16%, transparent 26%);
}
.bouteille-vide {
  cursor: default;
  background-color: #e0e0e0;
  background-image: radial-gradient(circle at 35% 32%, rgba(255,255,255,.6) 0%, transparent 60%);
  border: 2px dashed #ccc;
}
.bouteille:not(.bouteille-vide):hover {
  transform: translateY(-5px) scale(1.2);
  z-index: 10;
}
@keyframes spherePop {
  from { opacity: 0; transform: scale(.3); }
  to   { opacity: 1; transform: scale(1); }
}

/* Couleurs par type de vin */
.type-rouge        { background-color: #7b1c1c; box-shadow: 0 4px 10px rgba(123,28,28,.55); }
.type-blanc        { background-color: #c9a227; box-shadow: 0 4px 10px rgba(201,162,39,.55); }
.type-rosé         { background-color: #d9607a; box-shadow: 0 4px 10px rgba(217,96,122,.55); }
.type-champagne    { background-color: #c8a951; box-shadow: 0 4px 10px rgba(200,169,81,.55); }
.type-effervescent { background-color: #3da8a8; box-shadow: 0 4px 10px rgba(61,168,168,.55); }
.type-liquoreux    { background-color: #b8692e; box-shadow: 0 4px 10px rgba(184,105,46,.55); }
.type-autre        { background-color: #6b6b6b; box-shadow: 0 4px 10px rgba(107,107,107,.55); }

/* Anneau coloré = statut apogée */
.bouteille-apogee  { outline: 3px solid #22c55e; outline-offset: 2px; }
.bouteille-jeune   { outline: 3px solid #3b82f6; outline-offset: 2px; }
.bouteille-depasse { outline: 3px solid #ef4444; outline-offset: 2px; }
.bouteille-inconnu { outline: 3px solid #9ca3af; outline-offset: 2px; }

/* Rang arrière : décalé à droite + légèrement atténué */
.bouteille-arriere { margin-left: 20px; opacity: .80; filter: brightness(.88); }
.bouteille-arriere:not(.bouteille-vide):hover { opacity: 1; filter: brightness(1); }

/* Rang avant : remonte pour mordre légèrement sur l'arrière */
.bouteille-avant { margin-top: -14px; z-index: 1; }

/* Bouteille sélectionnée */
.bouteille-selected {
  transform: scale(1.22) !important;
  z-index: 5;
  box-shadow: 0 0 0 3px rgba(255,255,255,.75), 0 6px 18px rgba(0,0,0,.5) !important;
  opacity: 1 !important;
  filter: none !important;
}
.bouteille-highlight { animation: highlightPulse 1.6s ease-in-out 3; }
@keyframes highlightPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(255,255,255,.75), 0 6px 18px rgba(0,0,0,.5); }
  50%     { box-shadow: 0 0 0 10px rgba(255,255,255,.35), 0 0 30px rgba(255,255,255,.2); }
}

/* Légende */
.legende-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Popup */
.wine-popup {
  position: fixed; z-index: 9999; pointer-events: none;
  animation: popupIn .18s cubic-bezier(.34,1.4,.64,1);
}
@keyframes popupIn {
  from { opacity: 0; transform: scale(.92) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.wine-popup-inner {
  display: flex; gap: 0; background: #1a1a2e;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.08);
  min-width: 260px; max-width: 380px;
  pointer-events: auto;
}
.wine-popup-photo { flex-shrink: 0; width: 90px; background: #111; }
.wine-popup-photo img { width: 90px; height: 100%; object-fit: cover; display: block; }
.wine-popup-body  { padding: 14px 16px; flex: 1; color: #f0f0f0; }
.wine-popup-header { margin-bottom: 8px; }
.wine-popup-nom   { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.wine-popup-millesime { font-size: 1.6rem; font-weight: 800; color: #fff; opacity: .9; line-height: 1; margin-top: 2px; }
.wine-popup-infos { font-size: .78rem; color: #c0c0d0; line-height: 1.7; margin-bottom: 8px; }
.wine-popup-infos strong { color: #fff; }
.wine-popup-notes, .wine-popup-accords {
  font-size: .75rem; color: #a0a0b8; border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 6px; margin-top: 4px; line-height: 1.5;
}
.wine-popup-accords { color: #b8c4a0; }
.wine-popup-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; gap: 8px;
}
.wine-popup-link { font-size: .78rem; color: #f87171; text-decoration: none; font-weight: 600; }
.wine-popup-link:hover { color: #fca5a5; }
.wine-popup-prendre-btn {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  color: #f0f0f0; border-radius: 8px; padding: 3px 10px;
  font-size: .75rem; cursor: pointer; transition: background .15s;
}
.wine-popup-prendre-btn:hover { background: rgba(255,255,255,.22); }
.wine-popup-confirm {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 9px; margin-top: 8px;
}
.wine-popup-confirm-label { color: #b0b0c8; font-size: .73rem; margin-bottom: 6px; }
.wine-popup-confirm-btns  { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-confirm-garder  { background:#3b82f6; color:#fff; border:none; border-radius:6px; padding:3px 12px; font-size:.72rem; cursor:pointer; }
.btn-confirm-annuler { background:transparent; color:#9ca3af; border:none; font-size:.72rem; cursor:pointer; padding:3px 6px; }
.badge-apogee  { background: #22c55e; }
.badge-jeune   { background: #3b82f6; }
.badge-depasse { background: #ef4444; }
.badge-inconnu { background: #9ca3af; }
