:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 12px;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header & Tabs */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background-color: var(--bg-secondary);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

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

.brand-icon {
  font-size: 24px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  background-color: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-md);
}

.nav-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-main);
}

.nav-btn.active {
  background-color: var(--primary);
  color: #0f172a;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Panels */
.panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Inventory Controls */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-input, .select-input {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
}

.search-input {
  flex: 1;
  min-width: 180px;
}

.search-input:focus, .select-input:focus {
  border-color: var(--primary);
}

.btn-action {
  background-color: var(--primary);
  color: #0f172a;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s ease;
}

.btn-action:hover {
  opacity: 0.9;
}

.btn-secondary {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

/* Cards & Tables */
.card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.pantry-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

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

.pantry-card.exhausted {
  opacity: 0.5;
  background: rgba(15, 23, 42, 0.2);
}

.pantry-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.pantry-item-name {
  font-weight: 600;
  font-size: 1rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-dairy { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.badge-meat { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.badge-produce { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.badge-grains { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.badge-pantry { background: rgba(168, 85, 247, 0.2); color: #a855f7; }

.pantry-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pantry-brand {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.macro-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.macro-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.macro-cal {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.macro-pro {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.macro-fat {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.macro-carb {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.macro-serving {
  font-size: 0.68rem;
  color: var(--text-muted);
  width: 100%;
  margin-top: 2px;
}

.btn-consume {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.btn-consume:hover {
  background-color: var(--accent-red);
  color: #fff;
}

.btn-consume.consumed {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-consume.consumed:hover {
  background-color: var(--accent-green);
  color: #fff;
}

/* Chef's Table & Featured Recipe */
.chef-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media(min-width: 900px) {
  .chef-container {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.featured-recipe-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
}

.recipe-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.recipe-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.recipe-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.tag {
  font-size: 0.75rem;
  background: var(--bg-hover);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
}

.star-rating {
  display: inline-flex;
  gap: 4px;
  cursor: pointer;
  font-size: 1.25rem;
  color: #64748b;
}

.star-rating .star.filled {
  color: #eab308;
}

.recipe-stats {
  display: flex;
  gap: 16px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.stat-value {
  font-weight: 700;
  color: #fff;
}

.ingredients-list, .steps-list {
  padding-left: 20px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.ingredients-list li, .steps-list li {
  margin-bottom: 6px;
}

.chef-notes-box {
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.85rem;
  color: #bae6fd;
}

/* Recipe Bank Accordion / List */
.bank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bank-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bank-card:hover {
  background-color: var(--bg-hover);
}

.bank-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
}

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

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-textarea {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.form-textarea:focus {
  border-color: var(--primary);
  outline: none;
}
