/* ═══════════════════════════════════════════════════════════
   Fridge Chef — stiluri
   Contrast verificat pe WCAG 2.1 AA în ambele teme.
   ═══════════════════════════════════════════════════════════ */

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

/* Multe elemente au display: flex/grid, deci hidden are nevoie de !important. */
[hidden] {
  display: none !important;
}

:root {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --surface-hover: #252525;
  --text: #f0f0f0;
  --text-muted: #a1a1a1;      /* era #888 — prea slab pe fundal închis */
  --border: #333;

  /* Portocaliu decorativ (borduri, fundaluri translucide, iconițe). */
  --accent: #ff6b2b;
  /* Portocaliu pentru TEXT — 6.1:1 pe fundal închis. */
  --accent-text: #ff8149;
  /* Fundal de buton cu text alb — 5.2:1, trece AA în ambele teme. */
  --accent-btn: #c2410c;
  --accent-btn-hover: #9a3412;

  --green: #4ade80;
  --green-text: #4ade80;
  --red: #f87171;
  --red-text: #fca5a5;

  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --focus: #7dd3fc;
}

body.light {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-hover: #eeeeee;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;      /* 6.4:1 pe alb */
  --border: #d8d8d8;

  --accent-text: #c2410c;     /* 5.2:1 pe alb — portocaliul deschis pica aici */
  --green-text: #15803d;
  --red-text: #b91c1c;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --focus: #0369a1;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;         /* fără salt când apare bara URL pe mobil */
  overflow-x: hidden;
  width: 100%;
  transition: background 0.3s, color 0.3s;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body.modal-open {
  overflow: hidden;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* ─────────────────── Focus vizibil (lipsea complet) ─────────────────── */

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--accent-btn);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

/* ─────────────────────────── Bara de sus ─────────────────────────── */

.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s, border-color 0.2s;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.lang-btn {
  font-weight: 700;
  letter-spacing: 0.5px;
  gap: 7px;
}

/* Spriteul cu simbolurile de steag nu trebuie să ocupe spațiu. */
.flag-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.flag {
  width: 20px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 2px;
  /* Contur subțire ca steagurile deschise (Franța, Spania) să nu se
     topească în fundalul cardului. */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
  vertical-align: -2px;
}

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

.upgrade-btn {
  background: var(--accent-btn);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.upgrade-btn:hover {
  background: var(--accent-btn-hover);
  border-color: transparent;
}

.upgrade-btn::before {
  content: '⭐';
}

.saved-count {
  background: var(--accent-btn);
  color: #fff;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

.lang-dropdown {
  position: relative;
}

.lang-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-width: 150px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.lang-dropdown.open .lang-menu {
  display: block;
}

.lang-option {
  display: block;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.lang-option:hover {
  background: var(--surface-hover);
}

.lang-option.active {
  color: var(--accent-text);
  font-weight: 700;
}

/* ─────────────────────────── Antet ─────────────────────────── */

.offline-banner {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--red-text);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 12px;
  text-align: center;
}

header {
  text-align: center;
  margin-bottom: 28px;
}

.logo {
  max-width: 280px;
  width: 100%;
  height: auto;
  margin-bottom: 8px;
}

/* Logo-ul se schimbă odată cu tema, nu doar cu preferința de sistem. */
.logo-light { display: none; }
body.light .logo-dark { display: none; }
body.light .logo-light { display: inline-block; }

.subtitle {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 1.05rem;
}

/* ─────────────────────── Streak & provocare ─────────────────────── */

.stats-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.streak-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
}

.streak-fire {
  font-size: 1.3rem;
}

.streak-count {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-text);
}

.streak-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.challenge-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(255, 107, 43, 0.12), rgba(255, 107, 43, 0.04));
  border: 1px solid rgba(255, 107, 43, 0.3);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 0;
}

.challenge-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.challenge-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.challenge-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-text);
  font-weight: 700;
}

.challenge-desc {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.35;
}

/* ─────────────────────── Banner notificări ─────────────────────── */

.notif-banner {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), rgba(74, 222, 128, 0.03));
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 20px;
  animation: fadeSlideIn 0.4s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.notif-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.notif-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.notif-btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.notif-yes {
  background: #15803d;
  color: #fff;
}

.notif-yes:hover {
  background: #166534;
}

.notif-no {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ─────────────────────── Selector de mod ─────────────────────── */

.scan-mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 4px;
  border: 1px solid var(--border);
}

.mode-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  min-height: 44px;
}

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

.mode-btn.active {
  background: var(--accent-btn);
  color: #fff;
}

/* ─────────────────────── Switch multi-frigider ─────────────────────── */

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: left;
  font-family: inherit;
  min-height: 48px;
}

.toggle-row:hover {
  border-color: var(--accent);
}

.toggle-row.active {
  border-color: var(--green);
  color: var(--green-text);
  background: rgba(74, 222, 128, 0.08);
}

.toggle-switch {
  width: 38px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-row.active .toggle-switch {
  background: #15803d;
}

.toggle-row.active .toggle-switch::after {
  transform: translateX(16px);
  background: #fff;
}

/* ─────────────────────────── Upload ─────────────────────────── */

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  background: var(--surface);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.upload-content svg {
  color: var(--accent-text);
}

.upload-content p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.browse {
  color: var(--accent-text);
  text-decoration: underline;
}

.formats {
  font-size: 0.8rem;
  color: var(--text-muted);   /* opacitatea 0.6 de dinainte pica la contrast */
}

.photo-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
}

.photo-thumb {
  position: relative;
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  overflow: visible;
  border: 2px solid var(--border);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.thumb-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  background: #b91c1c;
  color: #fff;
  border: 2px solid var(--bg);
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.camera-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  padding: 14px 20px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent-text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
}

.camera-btn:hover {
  background: rgba(255, 107, 43, 0.1);
}

.camera-btn svg {
  flex-shrink: 0;
}

.receipt-hint {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─────────────────────────── Preview ─────────────────────────── */

.preview-area {
  text-align: center;
  margin-top: 20px;
}

.preview-area img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--border);
}

.preview-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ─────────────────────────── Formular ─────────────────────────── */

.ingredients-section,
.diet-section,
.filter-section {
  margin-top: 24px;
}

.ingredients-section label,
.section-label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 1rem;
}

.ingredients-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.ingredients-input-wrap {
  display: flex;
  gap: 8px;
}

.ingredients-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.ingredients-input-wrap input:focus {
  border-color: var(--accent);
}

.ingredients-input-wrap input::placeholder {
  color: var(--text-muted);
}

.input-add-btn {
  flex-shrink: 0;
  width: 52px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent-text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.input-add-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.ingredients-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ingredient-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 14px;
  background: rgba(255, 107, 43, 0.15);
  color: var(--accent-text);
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

.tag-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 50%;
}

.tag-remove:hover {
  background: rgba(255, 107, 43, 0.25);
}

.diet-toggles,
.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.diet-btn,
.filter-pill {
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  min-height: 44px;
}

.diet-btn[aria-pressed='true'] {
  border-color: var(--green);
  background: rgba(74, 222, 128, 0.15);
  color: var(--green-text);
}

.filter-pill[aria-pressed='true'] {
  border-color: var(--accent);
  background: rgba(255, 107, 43, 0.15);
  color: var(--accent-text);
}

/* ─────────────────────────── Butoane ─────────────────────────── */

.btn {
  padding: 14px 28px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  min-height: 48px;
  font-family: inherit;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-btn-hover);
}

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

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-text {
  background: none;
  color: var(--text-muted);
  text-decoration: underline;
  padding: 10px 16px;
}

.btn-text:hover:not(:disabled) {
  color: var(--text);
}

.text-analyze-area {
  text-align: center;
  margin-top: 24px;
}

/* ─────────────────────────── Loading ─────────────────────────── */

.loading {
  text-align: center;
  padding: 36px 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

.loading p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 8px;
}

/* ─────────────────────────── Erori ─────────────────────────── */

.error {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  text-align: center;
}

.error p {
  color: var(--red-text);
  margin-bottom: 14px;
  line-height: 1.5;
}

.error-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 20px;
  line-height: 1.6;
}

/* ─────────────────────────── Rezultate ─────────────────────────── */

.results h2 {
  text-align: center;
  margin: 32px 0 20px;
  font-size: 1.4rem;
}

.screen-on-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  width: fit-content;
  margin: 12px auto 0;
}

.recipes-grid {
  display: grid;
  gap: 16px;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  transition: border-color 0.2s;
}

.recipe-card:hover {
  border-color: var(--accent);
}

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

.recipe-title {
  font-size: 1.2rem;
  color: var(--accent-text);
  flex: 1;
  min-width: 55%;
  overflow-wrap: anywhere;   /* numele lungi nu mai sparg layoutul */
}

.recipe-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.recipe-action {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.recipe-action:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.recipe-save[aria-pressed='true'] {
  color: #fff;
  background: #b91c1c;
  border-color: #b91c1c;
}

.recipe-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.recipe-time,
.recipe-servings {
  font-size: 0.8rem;
  color: var(--accent-text);
  background: rgba(255, 107, 43, 0.12);
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.recipe-card .description {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 14px 0;
  line-height: 1.55;
}

.recipe-card h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.ingredient-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ingredient-list li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 500;
}

.ingredient-list li.has {
  background: rgba(74, 222, 128, 0.15);
  color: var(--green-text);
}

.ingredient-list li.missing {
  background: rgba(248, 113, 113, 0.15);
  color: var(--red-text);
}

.steps-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(255, 107, 43, 0.08);
  border: 1px solid rgba(255, 107, 43, 0.3);
  border-radius: 10px;
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  min-height: 48px;
  font-family: inherit;
}

.steps-toggle:hover {
  background: rgba(255, 107, 43, 0.16);
  border-color: var(--accent);
}

.steps-toggle.open {
  border-radius: 10px 10px 0 0;
  border-bottom-color: transparent;
}

.steps-arrow {
  font-size: 0.7rem;
  transition: transform 0.25s;
  display: inline-block;
}

.steps-toggle.open .steps-arrow {
  transform: rotate(90deg);
}

.recipe-steps {
  list-style: none;
  counter-reset: step;
  background: var(--bg);
  border: 1px solid rgba(255, 107, 43, 0.3);
  border-top: none;
  border-radius: 0 0 10px 10px;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.recipe-steps li {
  counter-increment: step;
  padding: 14px 16px 14px 52px;
  position: relative;
  font-size: 0.95rem;
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
}

.recipe-steps li:last-child {
  border-bottom: none;
}

.recipe-steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 14px;
  width: 24px;
  height: 24px;
  background: var(--accent-btn);
  color: #fff;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.combos-section h2 {
  font-size: 1.2rem;
}

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

.combo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.combo-card h4 {
  color: var(--accent-text);
  font-size: 1rem;
  margin-bottom: 8px;
}

.combo-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─────────────────────────── Modale ─────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-content {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px calc(32px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow);
}

.modal-center {
  align-self: center;
  border-radius: 20px;
  margin: 16px;
  animation: fadeSlideIn 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-content h2 {
  font-size: 1.4rem;
  margin-bottom: 12px;
  padding-right: 48px;
}

.modal-body {
  color: var(--text-muted);
  line-height: 1.65;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.modal-link {
  display: inline-block;
  color: var(--accent-text);
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-actions .btn {
  flex: 1;
  min-width: 140px;
}

.saved-list {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

/* ─────────────────────────── Pro ─────────────────────────── */

.upgrade-subtitle {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.upgrade-demo-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 20px;
  text-align: center;
}

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.pricing-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.pricing-card:hover {
  border-color: var(--accent);
}

.pricing-card.popular {
  border-color: var(--accent);
  background: rgba(255, 107, 43, 0.08);
}

.pricing-card.selected {
  border-color: var(--accent-btn);
  background: rgba(255, 107, 43, 0.14);
}

.pricing-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-btn);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
}

.pricing-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-amount {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.pricing-amount span {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
}

.pricing-note {
  display: block;
  font-size: 0.7rem;
  color: var(--green-text);
  font-weight: 600;
}

.pro-features {
  margin-bottom: 24px;
}

.pro-features h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.pro-features ul {
  list-style: none;
}

.pro-features li {
  padding: 7px 0;
  font-size: 0.92rem;
  display: flex;
  gap: 8px;
}

.upgrade-final-btn {
  width: 100%;
}

/* ─────────────────────────── Toast ─────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 1500;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-success {
  border-color: var(--green);
}

.toast-error {
  border-color: var(--red);
}

/* ─────────────────────────── Subsol & debug ─────────────────────────── */

.app-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.85rem;
}

.app-footer a {
  color: var(--text-muted);
}

.app-footer a:hover {
  color: var(--accent-text);
}

.debug-panel {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.debug-panel summary {
  padding: 12px 16px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  user-select: none;
}

.debug-log {
  background: #111;
  padding: 12px 16px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  color: #4ade80;
}

.debug-log div {
  border-bottom: 1px solid #1a1a1a;
  padding: 2px 0;
  word-break: break-word;
}

/* ─────────────────── Pagina de politică / legal ─────────────────── */

.legal {
  max-width: 720px;
  line-height: 1.7;
}

.legal h1 {
  font-size: 1.7rem;
  margin: 24px 0 6px;
}

.legal h2 {
  font-size: 1.15rem;
  margin: 32px 0 10px;
  color: var(--accent-text);
}

.legal h3 {
  font-size: 1rem;
  margin: 20px 0 8px;
}

.legal p,
.legal li {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.legal strong {
  color: var(--text);
}

.legal ul {
  margin: 10px 0 10px 22px;
}

.legal li {
  margin-bottom: 6px;
}

.legal a {
  color: var(--accent-text);
}

.legal-meta {
  font-size: 0.85rem !important;
  margin-bottom: 20px;
}

.legal-nav {
  margin: 20px 0;
}

.legal-lang {
  margin-bottom: 20px;
}

.legal-warning {
  background: rgba(255, 107, 43, 0.12);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 20px 0;
  font-size: 0.9rem;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.88rem;
  display: block;
  overflow-x: auto;
}

.legal-table th,
.legal-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  color: var(--text-muted);
}

.legal-table th {
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  white-space: nowrap;
}

.legal-sep {
  margin: 48px 0 8px;
  border: none;
  border-top: 1px solid var(--border);
}

/* ─────────────────────────── Responsive ─────────────────────────── */

@media (max-width: 600px) {
  .container { padding: 12px 16px 40px; }
  .logo { max-width: 200px; }
  .upload-area { padding: 36px 16px; }
  .preview-actions { flex-direction: column; }
  .preview-actions .btn { width: 100%; }
  .recipe-card { padding: 16px; }
  .recipe-title { min-width: 100%; }
  .ingredient-list li { padding: 4px 10px; font-size: 0.82rem; }
  .diet-btn, .filter-pill { font-size: 0.8rem; padding: 9px 13px; }
}

@media (max-width: 420px) {
  /* Cele trei butoane de mod se înghesuiau; le punem pe verticală. */
  .scan-mode-toggle { flex-direction: column; }
  .mode-btn { width: 100%; }
  .pricing-cards { grid-template-columns: 1fr; gap: 8px; }
  .pricing-card.popular { order: -1; }
  .pricing-amount span { display: inline; }
  .top-bar { justify-content: center; }
}

@media (min-width: 601px) {
  .stats-bar { flex-direction: row; }
  .streak-card { flex-shrink: 0; }
  .challenge-card { flex: 1; }
}

/* ─────────────────────── Preferințe utilizator ─────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root { --text-muted: #d4d4d4; --border: #666; }
  body.light { --text-muted: #333; --border: #999; }
}

/* ─────────────────────── Print (= export PDF gratuit) ─────────────────────── */

@media print {
  .top-bar, .stats-bar, .notif-banner, .scan-mode-toggle, #uploadSection,
  .preview-area, .ingredients-section, .diet-section, .filter-section,
  .text-analyze-area, .loading, .error, .modal, .toast, .debug-panel,
  .app-footer, .skip-link, .receipt-hint, .recipe-actions, .screen-on-hint {
    display: none !important;
  }

  body { background: #fff; color: #000; }

  .recipe-card {
    border: 1px solid #ccc;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 12px;
  }

  .recipe-steps { display: block !important; }
  .recipe-title { color: #000; }
  .steps-toggle { display: none !important; }
}
