/* ============================================
   Aldo — Design System
   Thème sombre inspiré du vin
   ============================================ */

/* --- Variables --- */
:root {
  --bg-primary: #0d0a0e;
  --bg-secondary: #1a1520;
  --bg-card: #221c2a;
  --bg-card-hover: #2d2538;
  --bg-input: #1a1520;
  --accent: #9b2335;
  --accent-light: #c9485b;
  --accent-glow: rgba(155, 35, 53, 0.3);
  --gold: #d4a853;
  --gold-light: #e8c97a;
  --text-primary: #f0e6f0;
  --text-secondary: #9a8fa6;
  --text-muted: #6b5f7a;
  --rouge: #9b2335;
  --blanc: #e8d88c;
  --rose: #d4788a;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --border: rgba(255, 255, 255, 0.06);
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f5f0eb;
  --bg-secondary: #ede6dd;
  --bg-card: #ffffff;
  --bg-card-hover: #f9f5f0;
  --bg-input: #f5f0eb;
  --text-primary: #2c1810;
  --text-secondary: #5a4a3f;
  --text-muted: #8a7a6f;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --accent-glow: rgba(155, 35, 53, 0.15);
  --gold-light: #b8860b;
  --blanc: #7a5c00;
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow: hidden;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0;
  backdrop-filter: blur(20px);
}

.nav-brand {
  display: none;
}

.nav-links {
  display: flex;
  gap: 0;
  width: 100%;
  justify-content: space-around;
}

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 16px;
  border-radius: var(--radius);
  transition: var(--transition);
}

.nav-link .nav-icon {
  font-size: 22px;
}

.nav-link.active {
  color: var(--accent-light);
}

.nav-link:hover {
  color: var(--text-primary);
}

/* --- Desktop nav --- */
@media (min-width: 768px) {
  .nav {
    position: fixed;
    top: 0;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid var(--border);
    justify-content: flex-start;
    padding: 0 24px;
    height: 60px;
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 40px;
  }

  .nav-logo {
    font-size: 28px;
  }

  .nav-title {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .nav-links {
    width: auto;
    gap: 4px;
    justify-content: flex-start;
  }

  .nav-link {
    flex-direction: row;
    gap: 8px;
    font-size: 14px;
    padding: 8px 16px;
  }

  .nav-link .nav-icon {
    font-size: 18px;
  }
}

/* --- Views --- */
.view {
  display: none;
  height: 100dvh;
  padding-bottom: 80px; /* nav mobile */
  overflow-y: auto;
}

.view.active {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.view-settings.active,
.view-ideas.active,
.view-history.active {
  display: block;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .view {
    padding-bottom: 0;
    padding-top: 60px; /* nav desktop */
  }
}

/* ============================================
   CHAT VIEW
   ============================================ */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

.chat-bubble.aldo {
  align-self: flex-start;
}

.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--bg-card);
}

.chat-bubble.user .chat-avatar {
  background: var(--accent);
}

.chat-content {
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border-top-left-radius: 4px;
  line-height: 1.5;
  font-size: 14px;
}

.chat-bubble.user .chat-content {
  background: var(--accent);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: 4px;
}

.chat-content p {
  margin-bottom: 6px;
}

.chat-content p:last-child {
  margin-bottom: 0;
}

.chat-content img {
  max-width: 200px;
  border-radius: 8px;
  margin-top: 8px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Drop overlay */
.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(13, 10, 14, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drop-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drop-overlay-content {
  text-align: center;
  padding: 40px;
  border: 3px dashed var(--accent);
  border-radius: var(--radius-lg);
  animation: dropPulse 2s ease-in-out infinite;
}

@keyframes dropPulse {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: var(--gold); }
}

.drop-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: dropBounce 1s ease-in-out infinite;
}

@keyframes dropBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.drop-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.drop-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.view-chat {
  position: relative;
}

/* Preview grid multi-fichiers */
.preview-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.preview-item {
  position: relative;
  width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.preview-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.preview-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  color: var(--accent-light);
  font-size: 14px;
  font-weight: 700;
}

.preview-name {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  border: none;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.preview-remove:hover {
  transform: scale(1.15);
}

.btn-analyze {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.btn-analyze:hover {
  background: var(--accent-light);
}

/* Upload preview area */
.chat-upload-preview {
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border-radius: var(--radius);
}

/* Chat input */
.chat-input-area {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.chat-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 12px 18px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}

.chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.btn-attach {
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: var(--transition);
}

.btn-attach:hover {
  background: var(--bg-card);
}

.btn-send {
  background: var(--accent);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-send:hover {
  background: var(--accent-light);
  transform: scale(1.05);
}

/* Upload preview */
.chat-upload-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border-radius: var(--radius);
  position: relative;
}

.chat-upload-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

.upload-options {
  display: flex;
  gap: 12px;
}

.upload-type {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.upload-type input:checked + span {
  color: var(--gold);
  font-weight: 600;
}

.btn-remove-preview {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

/* ============================================
   CAVE VIEW
   ============================================ */

.view-cave {
  padding: 16px;
  padding-bottom: 80px;
  overflow-y: auto;
}

.cave-header {
  margin-bottom: 20px;
}

.cave-header h1 {
  font-size: 28px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cave-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.cave-search {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}

.cave-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.cave-search::placeholder {
  color: var(--text-muted);
}

/* Bottle grid */
.cave-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .cave-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .cave-grid { grid-template-columns: repeat(3, 1fr); }
}

.bottle-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.bottle-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.bottle-card.rouge::before { background: var(--rouge); }
.bottle-card.blanc::before { background: var(--blanc); }
.bottle-card.rosé::before,
.bottle-card.rose::before { background: var(--rose); }

.bottle-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.bottle-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.bottle-details {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.bottle-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bottle-qty {
  font-size: 13px;
  color: var(--text-muted);
}

.bottle-badge {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.badge-peak { background: rgba(76, 175, 80, 0.2); color: var(--success); }
.badge-ending { background: rgba(255, 152, 0, 0.2); color: var(--warning); }
.badge-past { background: rgba(244, 67, 54, 0.2); color: var(--danger); }
.badge-approaching { background: rgba(212, 168, 83, 0.2); color: var(--gold); }

/* Bottle label photos */
.bottle-card-img {
  width: calc(100% + 32px);
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -16px -16px 12px -16px;
}

.bottle-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  font-size: 32px;
  color: var(--text-muted);
}

.bottle-detail-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.bottle-detail-placeholder {
  width: 100%;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 40px;
  color: var(--text-muted);
  gap: 8px;
}

.btn-add-photo {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
}

.cave-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.cave-empty .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

/* ============================================
   DASHBOARD VIEW
   ============================================ */

.view-dashboard {
  padding: 16px;
  overflow-y: auto;
}

.view-dashboard h1 {
  font-size: 28px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .stats-row { grid-template-columns: repeat(6, 1fr); }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.dash-card h2 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

/* Graphiques en barres horizontales */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 90px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-track {
  flex: 1;
  height: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
  min-width: 2px;
}

.chart-bar-fill.rouge { background: linear-gradient(90deg, var(--rouge), #c93050); }
.chart-bar-fill.blanc { background: linear-gradient(90deg, #b8a840, var(--blanc)); }
.chart-bar-fill.rosé,
.chart-bar-fill.rose { background: linear-gradient(90deg, #c06080, var(--rose)); }
.chart-bar-fill.default { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.chart-bar-fill.gold { background: linear-gradient(90deg, #a08030, var(--gold)); }

.chart-bar-value {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

/* Stat card plus-value/moins-value */
.stat-gain { color: var(--success) !important; -webkit-text-fill-color: var(--success) !important; }
.stat-loss { color: var(--danger) !important; -webkit-text-fill-color: var(--danger) !important; }

/* Top value items */
.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.top-rank {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  min-width: 28px;
  text-align: center;
}

.top-info {
  flex: 1;
  min-width: 0;
}

.top-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-detail {
  font-size: 11px;
  color: var(--text-muted);
}

.top-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
}

/* Recent items */
.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
}

.recent-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.recent-color.rouge { background: var(--rouge); }
.recent-color.blanc { background: var(--blanc); }
.recent-color.rosé,
.recent-color.rose { background: var(--rose); }

.recent-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dash-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.apogee-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.apogee-item .apogee-icon {
  font-size: 18px;
}

.meteo-temp {
  font-size: 48px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.meteo-desc {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.meteo-suggestion {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: var(--transition);
}

.btn-cancel {
  background: var(--bg-card);
  color: var(--text-secondary);
}

.btn-confirm {
  background: var(--accent);
  color: white;
  flex: 1;
}

.btn-confirm:hover {
  background: var(--accent-light);
}

.btn-drink {
  background: var(--accent);
  color: white;
  width: 100%;
  margin-top: 16px;
}

/* Modal detail fields */
.detail-field {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.detail-label {
  color: var(--text-muted);
}

.detail-value {
  font-weight: 500;
  text-align: right;
}

/* ============================================
   UTILITIES
   ============================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-card-hover);
  border-radius: 3px;
}

/* Confirm modal editable fields */
.confirm-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.confirm-field label {
  min-width: 100px;
  font-size: 13px;
  color: var(--text-muted);
}

.confirm-field input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
}

.confirm-field input:focus {
  border-color: var(--accent);
}

/* Onboarding overlay */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.onboarding-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.onboarding-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.onboarding-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.onboarding-step-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.onboarding-step strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.onboarding-step p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Language selector */
.lang-selector {
  position: relative;
}

.lang-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.lang-btn:hover {
  background: var(--bg-card);
}

.lang-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 0;
  min-width: 160px;
  box-shadow: var(--shadow);
  z-index: 200;
}

.lang-dropdown.open {
  display: block;
}

.lang-dropdown a {
  display: block;
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.lang-dropdown a:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.lang-dropdown a.active {
  color: var(--accent-light);
  font-weight: 600;
}

@media (min-width: 768px) {
  .lang-dropdown {
    bottom: auto;
    top: 100%;
  }
}

/* ============================================
   HISTORY VIEW
   ============================================ */

.view-history {
  padding: 16px;
  overflow-y: auto;
}

.view-history h1 {
  font-size: 28px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.history-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tasting-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.2s;
}

.tasting-card:hover {
  transform: translateY(-2px);
}

.tasting-unrated {
  border-left: 3px solid var(--gold);
}

.tasting-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.tasting-wine {
  font-size: 16px;
}

.tasting-vintage {
  color: var(--text-muted);
  font-weight: normal;
}

.tasting-stars {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.tasting-unrated-badge {
  font-size: 12px;
  color: var(--gold);
  background: rgba(212, 168, 83, 0.15);
  padding: 2px 10px;
  border-radius: 12px;
}

.tasting-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.tasting-tags {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.tasting-guests {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.tasting-comment {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 6px;
}

.btn-rate-now {
  background: var(--gold);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  font-family: var(--font);
  transition: background 0.2s;
}

.btn-rate-now:hover {
  background: var(--gold-light);
}

/* Rating modal */
.modal-rating {
  max-width: 500px;
}

.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guest-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text-primary);
}

/* Monthly Recap */
.recap-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.recap-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.recap-nav-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: var(--font);
}

.recap-nav-btn:hover { background: var(--bg-card-hover); }

.recap-month {
  font-size: 20px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--text-primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  min-width: 200px;
  text-align: center;
}

.recap-content { font-size: 14px; line-height: 1.8; }

.recap-stat {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.recap-group { margin-bottom: 16px; }

.recap-group-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.recap-wine {
  padding: 4px 0;
  color: var(--text-secondary);
}

.recap-trends {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.recap-trend {
  padding: 4px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.recap-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
}

/* ============================================
   Feature Board - Ideas
   ============================================ */
.ideas-submit-btn { margin-bottom: 16px; width: 100%; }
.ideas-filters { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; }
.ideas-list { display: flex; flex-direction: column; gap: 12px; }
.idea-card { display: flex; gap: 12px; background: var(--bg-card); border-radius: var(--radius); padding: 16px; border: 1px solid var(--border); transition: var(--transition); }
.idea-card:hover { background: var(--bg-card-hover); }
.idea-vote-col { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.idea-vote-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 2px solid var(--border); border-radius: var(--radius); padding: 8px 12px; cursor: pointer; color: var(--text-secondary); transition: var(--transition); }
.idea-vote-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.idea-vote-btn.voted { border-color: var(--accent); color: var(--accent-light); background: var(--accent-glow); }
.idea-vote-arrow { font-size: 14px; }
.idea-vote-count { font-size: 16px; font-weight: 700; }
.idea-content { flex: 1; min-width: 0; }
.idea-title { font-weight: 600; font-size: 15px; color: var(--text-primary); margin-bottom: 4px; }
.idea-description { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.4; }
.idea-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.idea-status-badge { font-size: 11px; padding: 2px 8px; border-radius: 12px; font-weight: 600; }
.idea-status-proposed { background: rgba(155, 35, 53, 0.15); color: var(--accent-light); }
.idea-status-in_progress { background: rgba(255, 152, 0, 0.15); color: var(--warning); }
.idea-status-done { background: rgba(76, 175, 80, 0.15); color: var(--success); }
.idea-date { font-size: 11px; color: var(--text-muted); }
.idea-admin { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.idea-admin label { font-size: 12px; color: var(--text-muted); }
.idea-admin select { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; font-size: 12px; }
#idea-description { width: 100%; min-height: 100px; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; font-family: var(--font); font-size: 14px; resize: vertical; margin-bottom: 12px; }
#idea-description:focus { outline: none; border-color: var(--accent); }
.idea-similar-box { background: rgba(255, 152, 0, 0.1); border: 1px solid rgba(255, 152, 0, 0.3); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.idea-similar-box strong { color: var(--warning); }
.idea-similar-box p { margin: 8px 0; font-size: 13px; color: var(--text-secondary); }
.ideas-badge { position: absolute; top: -4px; right: -4px; background: var(--accent); color: white; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; cursor: pointer; }
.nav-link { position: relative; }
.notif-panel-content { max-height: 60vh; overflow-y: auto; }
.notif-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.notif-item:hover { background: var(--bg-card-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; margin-left: 8px; }

/* ============================================
   Cave Filters — Refined Wine-Commerce Style
   ============================================ */

/* Toolbar: search + filter toggle + sort + count */
.cave-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.cave-search-wrap {
  flex: 1;
  position: relative;
}
.cave-search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.4;
  pointer-events: none;
}
.cave-search-wrap .cave-search {
  width: 100%;
  padding-left: 36px;
}
.cave-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.cave-filter-toggle:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.filter-active-count {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.cave-sort-select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.cave-sort-select:focus { outline: none; border-color: var(--accent); }
.cave-count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Collapsible filter panel */
.cave-filters {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  opacity: 0;
  margin-bottom: 0;
}
.cave-filters.open {
  max-height: 400px;
  opacity: 1;
  margin-bottom: 16px;
}
.cave-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Filter section */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Filter chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-glow);
}
.filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

/* Color dots */
.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.1);
}
.dot-rouge { background: var(--rouge); }
.dot-blanc { background: #f0e6a0; }
.dot-rose { background: var(--rose); }

/* Filter dropdown */
.filter-dropdown {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  width: 100%;
  cursor: pointer;
}
.filter-dropdown:focus { outline: none; border-color: var(--accent); }

/* Price range */
.price-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.price-slider {
  flex: 1;
  min-width: 40px;
  accent-color: var(--accent);
  height: 4px;
}
.price-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: center;
}
.price-sep { color: var(--text-muted); font-size: 11px; }
.price-unit { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Mobile responsive */
@media (max-width: 600px) {
  .cave-toolbar { flex-wrap: wrap; }
  .cave-search-wrap { width: 100%; order: -1; }
  .cave-filters-grid { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .cave-sort-select { flex: 1; }
}

/* Contact form hint */
.contact-hint { font-size: 12px; color: var(--text-muted); font-style: italic; margin: 8px 0 4px; line-height: 1.4; }

/* Onboarding Checklist */
.onboarding-checklist { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); max-width: 400px; width: calc(100% - 32px); }
.checklist-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.checklist-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.checklist-close { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 2px 6px; }
.checklist-close:hover { color: var(--text-primary); }
.checklist-steps { display: flex; flex-direction: column; gap: 6px; }
.checklist-step { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--text-secondary); text-decoration: none; cursor: pointer; transition: var(--transition); }
.checklist-step::before { content: "☐"; font-size: 16px; flex-shrink: 0; }
.checklist-step:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.checklist-step.done { color: var(--success); pointer-events: none; }
.checklist-step.done::before { content: "☑"; }
@media (max-width: 600px) {
  .onboarding-checklist { top: auto; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); left: 8px; right: 8px; transform: none; width: auto; z-index: 101; }
}
