/* CellarTrack — Wine Cellar Inventory Styles */
:root {
  --bg: #1a1012;
  --bg-card: #241618;
  --bg-card-hover: #2e1c1f;
  --bg-input: #1e1315;
  --border: #3d2a2d;
  --border-light: #4e383c;
  --text: #f0e6e8;
  --text-muted: #a89094;
  --text-dim: #7a6065;
  --accent: #c0392b;
  --accent-hover: #e74c3c;
  --accent-dark: #922b21;
  --gold: #d4a853;
  --gold-dim: #a67c3d;
  --green: #27ae60;
  --green-dim: #1e8449;
  --orange: #e67e22;
  --red: #e74c3c;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  --transition: 0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

.skip-link {
  position: absolute; top: -100%; left: 1rem;
  background: var(--accent); color: #fff;
  padding: 0.5rem 1rem; border-radius: var(--radius);
  z-index: 1000; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
}
.logo {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--text); font-weight: 700; font-size: 1.25rem;
}
.logo:hover { color: var(--text); }
.logo-accent { color: var(--accent); }
.main-nav { display: flex; gap: 1.5rem; }
.main-nav a {
  color: var(--text-muted); font-weight: 500; font-size: 0.95rem;
  padding: 0.25rem 0; border-bottom: 2px solid transparent;
}
.main-nav a:hover { color: var(--text); border-bottom-color: var(--accent); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  padding-top: 2rem;
  padding-bottom: 3rem;
  flex: 1;
}

/* Sidebar */
.sidebar {
  display: flex; flex-direction: column; gap: 1rem;
  position: sticky; top: 5rem; align-self: start;
  max-height: calc(100vh - 6rem); overflow-y: auto;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 0.25rem;
}
.stat-value {
  font-size: 1.5rem; font-weight: 700; color: var(--gold);
}
.sidebar-actions {
  display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.6rem 1.2rem; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all var(--transition);
  font-family: var(--font);
}
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-outline {
  background: transparent; color: var(--text-muted);
  border-color: var(--border-light);
}
.btn-outline:hover { color: var(--text); border-color: var(--text-muted); }
.btn-danger {
  background: transparent; color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-add { width: 100%; margin-top: 0.5rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* Sections */
.section-title {
  font-size: 1.35rem; font-weight: 700; margin-bottom: 1rem;
  color: var(--text);
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem;
}

/* Form */
.add-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
  font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
}
.required { color: var(--accent); }
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font);
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.15);
}
.form-group textarea { resize: vertical; }

/* Filter bar */
.filter-bar { display: flex; gap: 0.5rem; }
.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font);
}
.filter-select:focus { outline: none; border-color: var(--accent); }

/* Inventory list */
.inventory-section { margin-bottom: 2rem; }
.inventory-list { display: flex; flex-direction: column; gap: 0.75rem; }

.wine-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
}
.wine-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}
.wine-card-left { min-width: 0; }
.wine-card-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem;
}
.wine-name {
  font-weight: 700; font-size: 1.05rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wine-meta {
  font-size: 0.85rem; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem;
}
.wine-meta span { display: inline-flex; align-items: center; gap: 0.2rem; }
.wine-qty {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 99px; padding: 0.15rem 0.6rem;
  font-size: 0.8rem; font-weight: 600; color: var(--gold);
}
.status-badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 99px; font-size: 0.75rem; font-weight: 600;
  white-space: nowrap;
}
.status-ready { background: rgba(39,174,96,0.15); color: var(--green); }
.status-soon { background: rgba(230,126,34,0.15); color: var(--orange); }
.status-young { background: rgba(52,152,219,0.15); color: #3498db; }
.status-past { background: rgba(231,76,60,0.15); color: var(--red); }
.status-drunk { background: var(--bg-input); color: var(--text-dim); }
.drink-window { font-size: 0.8rem; color: var(--text-muted); text-align: right; }

/* Empty state */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-state svg { margin-bottom: 1rem; opacity: 0.6; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }

/* Guide section */
.guide-section { margin-bottom: 2rem; }
.guide-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.guide-card h3 {
  font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem;
  color: var(--gold);
}
.guide-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.55; }

/* Reference table */
.reference-section { margin-bottom: 2rem; }
.table-wrapper { overflow-x: auto; }
.reference-table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.reference-table th,
.reference-table td {
  padding: 0.75rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.reference-table th {
  background: var(--bg-input);
  font-weight: 700; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
}
.reference-table tr:last-child td { border-bottom: none; }
.reference-table tr:hover td { background: var(--bg-card-hover); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.15rem; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; cursor: pointer; line-height: 1;
  padding: 0.25rem; border-radius: var(--radius);
}
.modal-close:hover { color: var(--text); background: var(--bg-input); }
.modal-body { padding: 1.5rem; }

.modal-detail-row {
  display: flex; justify-content: space-between;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.modal-detail-row:last-child { border-bottom: none; }
.modal-detail-label { color: var(--text-muted); font-weight: 600; }
.modal-detail-value { color: var(--text); text-align: right; max-width: 60%; }

.modal-notes-area {
  width: 100%; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 0.75rem; font-family: var(--font);
  font-size: 0.9rem; resize: vertical; min-height: 80px;
  margin-top: 0.5rem;
}
.modal-notes-area:focus { outline: none; border-color: var(--accent); }

.pairing-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.pairing-list li {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 99px; padding: 0.25rem 0.75rem;
  font-size: 0.8rem; color: var(--text-muted);
}

.modal-actions { display: flex; gap: 0.5rem; margin-top: 1.25rem; flex-wrap: wrap; }

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
  text-align: center;
}
.footer-inner p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.footer-meta { font-size: 0.75rem; color: var(--text-dim); }

/* Print */
@media print {
  .site-header, .sidebar, .add-section, .guide-section, .site-footer,
  .filter-bar, .btn, .modal-overlay { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { display: block; }
  .wine-card { border: 1px solid #ccc; break-inside: avoid; }
  .section-title { color: #000; }
}

/* Responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .stat-card { flex: 1; min-width: 120px; }
  .sidebar-actions { flex-direction: row; width: 100%; }
  .sidebar-actions .btn { flex: 1; }
}

@media (max-width: 600px) {
  .header-inner { flex-direction: column; gap: 0.5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .wine-card { grid-template-columns: 1fr; }
  .wine-card-right { align-items: flex-start; }
  .guide-grid { grid-template-columns: 1fr; }
  .modal { max-height: 90vh; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
