/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary-dark);
  padding: 8px 12px;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

/* ---------- Top header / Bottom nav ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.app-header .logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  z-index: 30;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.bottom-nav a svg {
  width: 24px;
  height: 24px;
}

.bottom-nav a.active {
  color: var(--color-primary-dark);
}

/* ---------- Cards ---------- */

.recipe-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.recipe-card .cover {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: var(--color-surface-sunken);
}

.recipe-card .cover-placeholder {
  aspect-ratio: 4 / 3;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
}

.recipe-card .body {
  padding: var(--space-3);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.recipe-card h3 {
  font-size: 1rem;
  margin: 0;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
}

.badge-diet-vegan { background: color-mix(in srgb, var(--color-diet-vegan) 18%, transparent); color: var(--color-diet-vegan); }
.badge-diet-vegetarisch { background: color-mix(in srgb, var(--color-diet-vegetarisch) 18%, transparent); color: var(--color-diet-vegetarisch); }
.badge-diet-fisch { background: color-mix(in srgb, var(--color-diet-fisch) 18%, transparent); color: var(--color-diet-fisch); }
.badge-diet-fleisch { background: color-mix(in srgb, var(--color-diet-fleisch) 18%, transparent); color: var(--color-diet-fleisch); }

.cover-diet-vegan { background: linear-gradient(135deg, var(--color-diet-vegan), #3f4d2e); color: #fff; }
.cover-diet-vegetarisch { background: linear-gradient(135deg, var(--color-diet-vegetarisch), #5c7a34); color: #fff; }
.cover-diet-fisch { background: linear-gradient(135deg, var(--color-diet-fisch), #2c5e70); color: #fff; }
.cover-diet-fleisch { background: linear-gradient(135deg, var(--color-diet-fleisch), #7a2e1c); color: #fff; }

/* ---------- Info icon bar ---------- */

.info-bar {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) 0;
}

.info-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.info-item svg {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
}

.info-item strong {
  color: var(--color-text);
  font-size: 0.95rem;
}

/* ---------- Nutrition tiles ---------- */

.nutrition-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.nutrition-tile {
  background: var(--color-surface-sunken);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  text-align: center;
}

.nutrition-tile .value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.nutrition-tile .label {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---------- Servings stepper ---------- */

.servings-stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface-sunken);
  border-radius: 999px;
  padding: var(--space-1) var(--space-2);
}

.servings-stepper button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface);
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.servings-stepper .value {
  min-width: 60px;
  text-align: center;
  font-weight: 600;
}

/* ---------- Ingredient list ---------- */

.ingredient-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ingredient-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.ingredient-row.is-spice {
  opacity: 0.9;
}

.ingredient-checkbox {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ingredient-checkbox.checked {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: #fff;
}

.ingredient-text {
  flex: 1;
}

.ingredient-text.done {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.ingredient-amount {
  font-weight: 700;
  color: var(--color-primary-dark);
}

.add-to-cart-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Steps ---------- */

.step-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  counter-reset: step-counter;
}

.step-item {
  display: flex;
  gap: var(--space-3);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text {
  padding-top: var(--space-1);
}

/* ---------- Sections / surfaces ---------- */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-4);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

/* ---------- Forms ---------- */

.field {
  margin-bottom: var(--space-4);
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
  font-size: 0.9rem;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="password"],
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.help-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.error-text {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: var(--space-2);
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.tab {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary);
}

/* ---------- Dialog (natives <dialog>-Element) ----------
   Sichtbarkeit/Stacking (open/closed, Backdrop, Top-Layer) uebernimmt der
   Browser selbst ueber showModal()/close() -- das ist robuster als ein
   selbstgebautes hidden-Attribut + eigene CSS-display-Regel, wo Autor-Styles
   die native [hidden]-Regel in der Kaskade sonst leicht überschreiben. */

dialog.quantity-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  width: calc(100% - 32px);
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-elevated);
}

dialog.quantity-dialog::backdrop {
  background: rgba(20, 15, 8, 0.5);
}

/* ---------- Admin-Tabelle ---------- */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.admin-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Passwort-Sichtbarkeit ---------- */

.password-field-wrap {
  position: relative;
}

.password-field-wrap input {
  padding-right: 44px !important;
}

.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--color-text-muted);
  display: flex;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: var(--color-bg);
  padding: var(--space-3) var(--space-5);
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 200;
  box-shadow: var(--shadow-elevated);
}

/* ---------- Shopping list categories ---------- */

.search-input-large {
  width: 100%;
  padding: 16px 18px;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.shopping-item-actions {
  display: flex;
  gap: var(--space-1);
  flex-shrink: 0;
}

.category-section {
  margin-bottom: var(--space-5);
}

.category-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--color-secondary-dark);
}

.category-header .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-secondary);
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.shopping-item.checked {
  opacity: 0.55;
}

.shopping-item.checked .shopping-item-name {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.shopping-item-amount {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.check-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.check-circle.checked {
  background: var(--color-success);
  border-color: var(--color-success);
}

/* ---------- Hero (recipe detail) ---------- */

.hero-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

.hero-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

/* ---------- Kochmodus ---------- */

.cook-mode-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
}

.cook-mode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.cook-mode-progress {
  font-weight: 700;
  color: var(--color-text-muted);
}

.cook-mode-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-4);
}

.cook-mode-step-text {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 600;
  line-height: 1.35;
  max-width: 700px;
}

.cook-mode-nav {
  display: flex;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.cook-mode-nav .btn {
  flex: 1;
  padding: 18px;
  font-size: 1.1rem;
}

/* ---------- Dark mode toggle ---------- */

.theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}
