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

:root {
  --bg:        #0c0c0e;
  --surface:   #141416;
  --surface2:  #1c1c1f;
  --border:    #2a2a2e;
  --accent:    #e8c97a;
  --accent2:   #c9a34e;
  --text:      #f0ede8;
  --muted:     #7a7a82;
  --green:     #4caf82;
  --red:       #e05f5f;
  --radius:    12px;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 40px;
}

header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--accent);
}

nav { display: flex; gap: 4px; }

.nav-link {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--text); background: var(--surface2); }

/* ── Main ─────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.view { display: none; }
.view.active { display: block; }

.section-header { margin-bottom: 40px; }
.section-header h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--muted); margin-top: 4px; font-size: 14px; }

/* ── Recipes Grid ─────────────────────────────────── */
.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

.recipe-card:hover {
  border-color: var(--accent2);
  transform: translateY(-2px);
}

.recipe-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(232,201,122,0.04) 0%, transparent 60%);
  pointer-events: none;
}

.card-emoji {
  font-size: 32px;
  margin-bottom: 14px;
  display: block;
}

.card-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin-bottom: 6px;
}

.card-glass {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.availability-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.availability-badge.available { background: var(--green); box-shadow: 0 0 6px var(--green); }
.availability-badge.partial { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.availability-badge.unavailable { background: var(--red); }

/* ── Modal ────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--text); }

.modal-emoji { font-size: 40px; margin-bottom: 16px; display: block; }
.modal-name { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 4px; }
.modal-glass { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 20px; }

.modal-section { margin-bottom: 24px; }
.modal-section h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 12px;
}

.ingredients-list { list-style: none; }
.ingredients-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.ingredients-list li:last-child { border-bottom: none; }

.ing-name { color: var(--text); }
.ing-amount { color: var(--muted); }
.ing-missing { color: var(--red); }

.instructions {
  font-size: 14px;
  color: #b8b5b0;
  line-height: 1.75;
}

.modal-availability {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.modal-availability.available { background: rgba(76,175,130,0.1); color: var(--green); border: 1px solid rgba(76,175,130,0.2); }
.modal-availability.partial   { background: rgba(232,201,122,0.1); color: var(--accent); border: 1px solid rgba(232,201,122,0.2); }
.modal-availability.unavailable { background: rgba(224,95,95,0.1); color: var(--red); border: 1px solid rgba(224,95,95,0.2); }

/* ── Stock View ───────────────────────────────────── */
.stock-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .stock-layout { grid-template-columns: 1fr; }
}

.stock-table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 14px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

tbody td { padding: 14px 20px; font-size: 14px; vertical-align: middle; }

.stock-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.toggle input:checked ~ .toggle-track {
  background: var(--green);
  border-color: var(--green);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.toggle input:checked ~ .toggle-track::after {
  transform: translateX(18px);
}

.amount-input {
  width: 90px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  transition: border-color 0.15s;
}

.amount-input:focus {
  outline: none;
  border-color: var(--accent2);
}

.amount-input:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Stock Summary ────────────────────────────────── */
.stock-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 80px;
}

.stock-summary h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.summary-subtitle { font-size: 12px; color: var(--muted); margin-bottom: 20px; }

.availability-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.availability-item:last-child { border-bottom: none; }

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

.avail-dot.available  { background: var(--green); }
.avail-dot.partial    { background: var(--accent); }
.avail-dot.unavailable { background: var(--border); }

.avail-name { flex: 1; }
.avail-status { color: var(--muted); font-size: 12px; }

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
