:root {
  --bg: #f7f9f6;
  --bg-card: #ffffff;
  --bg-card-subtle: #f0f4ef;
  --border: #e0e7df;
  --border-focus: #3d7952;
  --text-main: #18241c;
  --text-muted: #5e6f63;
  --text-dim: #8b9b90;
  --primary: #275238;
  --primary-light: #eaf3ed;
  --primary-hover: #1f422d;
  --accent: #d96b43;
  --accent-light: #fdf1ec;
  --gold: #d49a37;
  --gold-light: #fef7ec;
  --danger: #c93b3b;
  --danger-light: #fbeeee;
  --shadow-sm: 0 1px 3px rgba(24, 36, 28, 0.05);
  --shadow-md: 0 4px 12px rgba(24, 36, 28, 0.08);
  --shadow-lg: 0 10px 24px rgba(24, 36, 28, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-serif: 'Newsreader', Georgia, serif;
}

[data-theme="dark"] {
  --bg: #111813;
  --bg-card: #18221b;
  --bg-card-subtle: #202c24;
  --border: #29382e;
  --border-focus: #52966a;
  --text-main: #ecf3ed;
  --text-muted: #9db1a3;
  --text-dim: #6c8072;
  --primary: #4e9c6b;
  --primary-light: #1b3323;
  --primary-hover: #5eb57e;
  --accent: #eb8560;
  --accent-light: #362118;
  --gold: #e2ab4c;
  --gold-light: #332714;
  --danger: #e25858;
  --danger-light: #331818;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand-icon {
  font-size: 24px;
  background: var(--primary-light);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sync-badge.pending {
  background: var(--gold-light);
  color: var(--gold);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
}

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

/* Container */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}

/* Sections */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Header */
.section-head {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Banner digestiv */
.digestive-banner {
  background: var(--accent-light);
  border: 1px solid rgba(217, 107, 67, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.digestive-banner .banner-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.digestive-banner p {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.45;
}

.digestive-banner strong {
  color: var(--accent);
}

/* Week Plan Cards */
.plan-days {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.day-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.day-card.today {
  border-color: var(--primary);
  background: linear-gradient(to bottom, var(--primary-light), var(--bg-card) 60px);
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.day-name {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-tag {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.day-totals {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.day-totals span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.day-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .day-slots {
    grid-template-columns: 1fr;
  }
}

.slot-box {
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  position: relative;
}

.slot-box.filled {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.slot-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.slot-recipe-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 6px;
  cursor: pointer;
}

.slot-recipe-name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.slot-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.btn-slot-choose {
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-self: flex-start;
  margin-top: auto;
}

.btn-slot-choose:hover {
  background: var(--primary);
  color: white;
}

.btn-icon-mini {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}

.btn-icon-mini:hover {
  background: var(--border);
  color: var(--danger);
}

.btn-icon-copy {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-icon-copy:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Recipes Catalog */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  white-space: nowrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.recipe-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.recipe-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.recipe-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.recipe-cat-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-card-subtle);
  color: var(--text-muted);
}

.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-dim);
  padding: 2px 4px;
}

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

.recipe-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 8px;
}

.recipe-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.recipe-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: background 0.15s ease;
}

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

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-outline:hover {
  background: var(--bg-card-subtle);
}

/* Shopping List */
.shopping-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-bar-wrap {
  flex: 1;
  max-width: 260px;
  margin: 0 16px;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.shopping-add-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.shopping-add-box input, .shopping-add-box select {
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
}

.shopping-add-box input {
  flex: 1;
}

.shopping-aisle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.aisle-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
}

.shopping-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shopping-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

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

.shopping-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  flex: 1;
}

.shopping-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  border-radius: 4px;
}

.shopping-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

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

.shopping-item-qty {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* Cook Mode (Gateste Azi) */
.cook-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.cook-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.cook-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.cook-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
}

.timer-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.timer-display {
  font-size: 32px;
  font-weight: 800;
  font-family: monospace;
  color: var(--primary);
}

.timer-controls {
  display: flex;
  gap: 8px;
}

.step-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}

.step-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s ease;
  min-width: 60px;
}

.nav-item .nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 24, 19, 0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Informational Guide Cards */
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.guide-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-card p {
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.55;
  margin-bottom: 10px;
}

.guide-card ul {
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Drag & Drop în Meniu */
.slot-box[draggable="true"] {
  cursor: grab;
}

.slot-box[draggable="true"]:active {
  cursor: grabbing;
}

.slot-box.dragging {
  opacity: 0.35;
  transform: scale(0.98);
}

.slot-box.drag-over {
  border: 2px dashed var(--primary) !important;
  background-color: var(--primary-light) !important;
}

.drag-indicator {
  font-size: 10px;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* Imagini Rețete & Placeholder */
.recipe-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.recipe-img-placeholder {
  width: 100%;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

/* Butoane Căutare Minimaliste (Google Imagini & YouTube) */
.search-btns {
  display: flex;
  gap: 6px;
  margin: 6px 0 10px;
  flex-wrap: wrap;
}

.btn-search-link {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card-subtle);
  transition: all 0.15s ease;
}

.btn-search-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Control Porții (Stepper Scalare) */
.servings-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.stepper-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.stepper-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.servings-val {
  font-size: 13px;
  font-weight: 700;
  min-width: 65px;
  text-align: center;
  color: var(--text-main);
}

.btn-scale-quick {
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
}

.btn-scale-quick:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Ghid Infografic Simplu & Vizual */
.infographic-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.guide-step-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.guide-step-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-step-body h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
}

.guide-step-body p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
