/* Dish Cards */
.dish-card {
  background: var(--warm);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.2s;
  position: relative;
}

.dish-card:hover {
  box-shadow: var(--shadow-lg);
}

.dish-card.fav-active {
  border-top: 3px solid var(--fav);
}

.dish-card--border {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.dish-card--border.type-vegi { background: var(--sage); }
.dish-card--border.type-otto { background: var(--otto); }
.dish-card--border.type-fisch { background: var(--fisch); }
.dish-card--border.type-fleisch { background: var(--fleisch); }

.dish-header {
  padding: 16px 16px 12px 20px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.dish-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.dish-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.dish-num.type-vegi { background: var(--sage); }
.dish-num.type-otto { background: var(--otto); }
.dish-num.type-fisch { background: var(--fisch); }
.dish-num.type-fleisch { background: var(--fleisch); }

.dish-toggle {
  color: var(--ink-light);
  font-size: 14px;
  transition: transform 0.3s;
  flex-shrink: 0;
}

.dish-card.open .dish-toggle {
  transform: rotate(180deg);
}

.dish-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.dish-actions button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s, transform 0.15s;
}

.dish-actions button:hover {
  background: var(--cream);
}

.dish-actions button:active {
  transform: scale(0.9);
}

.btn-fav.active {
  color: var(--fav);
}

.btn-fav.pulse {
  animation: pulse 0.4s ease-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.dish-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.dish-sub {
  font-size: 13px;
  color: var(--ink-light);
  margin-bottom: 8px;
}

.dish-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-vegi {
  background: var(--sage-light);
  color: var(--sage-dark);
}

.badge-otto {
  background: var(--otto-light);
  color: var(--otto);
}

.badge-fisch {
  background: var(--fisch-light);
  color: var(--fisch);
}

.badge-fleisch {
  background: var(--fleisch-light);
  color: var(--fleisch);
}

.badge-time {
  background: var(--gold-light);
  color: var(--gold-dark);
}

.badge-kcal {
  background: var(--terra-light);
  color: var(--terra-dark);
}

.badge-new {
  background: var(--sage);
  color: white;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Dish Body (collapsible) */
.dish-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.dish-card.open .dish-body {
  max-height: 2000px;
}

.dish-body-inner {
  padding: 0 16px 16px 20px;
}

/* Recipe Box */
.recipe-box {
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}

.recipe-box h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 15px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.recipe-time {
  font-size: 12px;
  color: var(--ink-light);
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
}

/* Ingredient Chips */
.ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.ingredient-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  background: white;
  border: 1px solid var(--border);
}

.ingredient-chip.shared {
  background: var(--sage-light);
  border-color: var(--sage);
  font-weight: 600;
}

/* Steps */
.steps {
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.steps li::before {
  content: counter(step);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sage-light);
  color: var(--sage-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.recipe-box.otto .steps li::before {
  background: var(--otto-light);
  color: var(--otto);
}

/* Tip Box */
.tip-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.tip-box.tip-gold {
  background: var(--gold-light);
  color: var(--gold-dark);
}

.tip-box.tip-otto {
  background: var(--otto-light);
  color: var(--otto);
}

.tip-icon {
  flex-shrink: 0;
}

/* Leftover hint */
.leftover-hint {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--terra-light);
  color: var(--terra-dark);
  font-size: 13px;
  display: flex;
  gap: 8px;
}

/* Source link */
.source-link {
  margin-top: 8px;
  font-size: 12px;
}

/* Loading overlay */
.dish-loading {
  position: absolute;
  inset: 0;
  background: rgba(253,250,247,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border-radius: var(--radius);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--sage);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--sage);
  color: white;
}

.btn-primary:hover {
  background: var(--sage-dark);
}

.btn-secondary {
  background: var(--cream);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--down-light);
  color: var(--down);
}

.btn-danger:hover {
  background: var(--down);
  color: white;
}

/* Stats Pills */
.stats-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
}

.pill-fav {
  background: var(--fav-light);
  color: var(--fav);
}

.pill-fav:hover {
  background: var(--fav);
  color: white;
}

.pill-down {
  background: var(--down-light);
  color: var(--down);
}

/* Modals */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(28,26,23,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: modalIn 0.2s;
}

@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-bg.hidden {
  display: none;
}

.modal {
  background: var(--warm);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 85vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 13px;
  color: var(--ink-light);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Leftovers Modal */
.leftover-category {
  margin-bottom: 16px;
}

.leftover-category h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.leftover-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.leftover-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}

.leftover-chip:hover {
  border-color: var(--sage);
}

.leftover-chip.selected {
  background: var(--sage-light);
  border-color: var(--sage);
  color: var(--sage-dark);
  font-weight: 600;
}

.leftover-chip.selected .chip-x {
  display: inline;
}

.chip-x {
  display: none;
  margin-left: 2px;
  font-size: 11px;
}

.leftover-input-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.leftover-input-row input {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 13px;
}

.leftover-input-row input:focus {
  outline: none;
  border-color: var(--sage);
}

.leftover-input-row button {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

/* Radio group */
.radio-group {
  margin-top: 16px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 14px;
  cursor: pointer;
}

.radio-group input[type="radio"] {
  accent-color: var(--sage);
  width: 16px;
  height: 16px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  transition: transform 0.3s ease;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Sync indicator */
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage);
  display: inline-block;
  transition: background 0.3s;
}

.sync-dot.saving {
  background: var(--gold);
  animation: syncPulse 1s infinite;
}

@keyframes syncPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Favourites panel */
.fav-panel {
  background: var(--fav-light);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  max-height: 0;
  padding: 0 16px;
}

.fav-panel.visible {
  max-height: 300px;
  padding: 16px;
}

.fav-panel.hidden {
  display: block;
}

.fav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.fav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: white;
  font-size: 13px;
  border: 1px solid var(--border);
}

.fav-item button {
  font-size: 11px;
  color: var(--ink-light);
  padding: 0;
  line-height: 1;
}

.fav-item button:hover {
  color: var(--fav);
}

.fav-empty {
  font-size: 13px;
  color: var(--ink-light);
}
