/* ==========================================================================
   RIZWA — Meal Calories Calculator styles
   ========================================================================== */

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}
.calc-builder,
.calc-panel {
  min-width: 0;
}


.step-card { margin-bottom: 26px; }
.step-card:last-child { margin-bottom: 0; }

/* ---------- Meal Cards ---------- */
.meal-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 30px;
  margin-bottom: 26px;
  border: 1.5px solid rgba(9,30,39,0.06);
  position: relative;
}
.meal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(9,30,39,0.08);
}
.meal-card-header h2 {
  font-size: 1.35rem;
  margin: 0;
}
.meal-remove-btn {
  background: none;
  border: 1.5px solid rgba(193,73,74,0.3);
  color: #c1494a;
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 700;
}
.meal-remove-btn:hover { background: rgba(193,73,74,0.08); }

.meal-subtotal {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(9,30,39,0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.meal-subtotal strong { color: var(--color-deep); }

.step-block { margin-bottom: 24px; }
.step-block:last-child { margin-bottom: 0; }
.step-block-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 12px;
}

/* ---------- Ingredient Blocks (Ingredient 1 = Protein, Ingredient 2+ = Add-ons) ---------- */
.ingredients-wrap { display: flex; flex-direction: column; gap: 20px; }
.ingredient-block {
  background: var(--color-offwhite);
  border: 1.5px solid rgba(9,30,39,0.08);
  border-radius: var(--radius-md);
  padding: 22px 24px;
}
.ingredient-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ingredient-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--color-deep);
  letter-spacing: 0.3px;
}
.ingredient-remove-btn {
  background: none;
  border: none;
  color: #c1494a;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}
.ingredient-remove-btn:hover { background: rgba(193,73,74,0.08); }

.ingredient-row { margin-bottom: 18px; }
.ingredient-row:last-child { margin-bottom: 0; }

.add-ingredient-btn {
  margin-top: 18px;
  width: auto;
}

.food-search-input { margin-bottom: 14px; }

.food-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: 160px;
  overflow-y: auto;
  padding: 4px 2px;
}

.add-meal-btn {
  background: transparent;
  color: var(--color-deep);
  border: 1.5px dashed rgba(9,30,39,0.3);
  box-shadow: none;
}
.add-meal-btn:hover {
  background: var(--color-offwhite);
  border-color: var(--color-teal);
  transform: none;
}



.mini-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 700;
  margin: 18px 0 10px;
}

.hidden { display: none !important; }

.quantity-block { margin-top: 8px; }
.custom-qty {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.custom-qty .form-control { max-width: 180px; }
.unit-label { font-weight: 700; color: var(--text-muted); }

/* Selected food display */
.selected-food-banner {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--gradient-teal-glow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

/* Live Nutrition Panel */

.calc-panel { position: sticky; top: 110px; display: flex; flex-direction: column; gap: 24px; }
.nutrition-panel { text-align: center; }
.nutri-hero {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 22px;
}
.nutri-value {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--color-deep);
  line-height: 1;
}
.nutri-unit {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
}
.nutri-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.nutri-item {
  background: var(--color-offwhite);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
}
.nutri-item span {
  display: block;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-deep);
}
.nutri-item label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
}
.nutri-weight {
  border-top: 1px dashed rgba(9,30,39,0.12);
  padding-top: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Summary Card */
.summary-list { margin: 0; }
.summary-list li {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(9,30,39,0.08);
  font-size: 0.92rem;
}
.summary-list li:last-child { border-bottom: none; }
.summary-list li strong { color: var(--color-deep); }

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px dashed rgba(9,30,39,0.12);
}


/* Breakdown Table */
.table-wrap { overflow-x: auto; margin-top: 16px; }
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}
.breakdown-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 2px solid rgba(9,30,39,0.08);
}
.breakdown-table td {
  padding: 12px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(9,30,39,0.06);
}
.breakdown-table .row-remove {
  background: none;
  border: none;
  color: #c1494a;
  font-size: 1.1rem;
}
.breakdown-empty {
  padding: 24px 12px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}
.breakdown-meal-header td {
  background: var(--color-deep);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 12px;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}
.breakdown-meal-subtotal td {
  background: var(--color-offwhite);
  font-weight: 800;
  color: var(--color-deep);
  border-bottom: 2px solid rgba(9,30,39,0.1);
}


@media (max-width: 1024px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-panel { position: static; }
}

@media (max-width: 780px) {
  .meal-card { padding: 22px 18px; }
  .ingredient-block { padding: 16px; }
  .meal-card-header h2 { font-size: 1.15rem; }
  .nutri-value { font-size: 2.6rem; }
  .calc-mockup { display: none; }
}

@media (max-width: 560px) {
  .nutri-grid { grid-template-columns: repeat(2, 1fr); }
  .ingredient-block { padding: 16px 14px; }
  .meal-card { padding: 18px 14px; margin-bottom: 18px; }
  .meal-card-header {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 14px;
  }
  .meal-card-header h2 { font-size: 1.05rem; }
  .meal-remove-btn { padding: 5px 12px; font-size: 0.75rem; }

  .ingredient-block-header { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .ingredient-label { font-size: 0.78rem; }

  .food-chip-grid { max-height: 130px; gap: 8px; }
  .chip { padding: 8px 14px; font-size: 0.8rem; }

  .quantity-options.chip-row,
  .oil-qty-options.chip-row,
  .cooking-methods.chip-row,
  .oil-list.chip-row {
    gap: 8px;
  }

  .custom-qty {
    flex-wrap: wrap;
  }
  .custom-qty .form-control,
  .custom-qty .custom-oil-input {
    max-width: 100%;
    flex: 1 1 140px;
  }

  .nutri-hero { margin: 10px 0 18px; gap: 6px; }
  .nutri-value { font-size: 2.3rem; }
  .nutri-unit { font-size: 0.85rem; }
  .nutri-grid { gap: 10px; }
  .nutri-item { padding: 10px 6px; }
  .nutri-item span { font-size: 0.95rem; }
  .nutri-item label { font-size: 0.65rem; }

  .summary-list li { font-size: 0.85rem; padding: 10px 0; }

  .meal-subtotal {
    font-size: 0.78rem;
    gap: 6px 14px;
  }

  .breakdown-table { min-width: 420px; }
  .breakdown-table th { font-size: 0.65rem; padding: 8px 8px; }
  .breakdown-table td { font-size: 0.8rem; padding: 10px 8px; }

  .add-ingredient-btn, .add-meal-btn { font-size: 0.85rem; }
}

@media (max-width: 400px) {
  .meal-card { padding: 16px 12px; }
  .ingredient-block { padding: 14px 12px; }
  .nutri-value { font-size: 2rem; }
  .breakdown-table { min-width: 380px; }
}

/* ==========================================================================
   Language Switch + Arabic (RTL) Support
   ========================================================================== */

.calc-lang-switch {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}
.lang-toggle-btn {
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  color: var(--text-on-dark);
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.15s ease;
}
.lang-toggle-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

/* Arabic font + RTL layout — scoped to when body has .lang-ar */
body.lang-ar {
  font-family: 'Cairo', var(--font-body);
}
body.lang-ar h1,
body.lang-ar h2,
body.lang-ar h3,
body.lang-ar .nutri-value {
  font-family: 'Cairo', var(--font-heading);
}

html[dir="rtl"] .meal-card-header,
html[dir="rtl"] .ingredient-block-header,
html[dir="rtl"] .custom-qty,
html[dir="rtl"] .meal-subtotal,
html[dir="rtl"] .nutri-hero,
html[dir="rtl"] .summary-list li {
  direction: rtl;
}

html[dir="rtl"] .food-chip-grid,
html[dir="rtl"] .chip-row {
  direction: rtl;
}

html[dir="rtl"] .breakdown-table th,
html[dir="rtl"] .breakdown-table td {
  text-align: right;
}

html[dir="rtl"] .row-remove {
  transform: scaleX(1); /* keep the × symbol unmirrored */
}

html[dir="rtl"] .summary-list li {
  flex-direction: row-reverse;
}

html[dir="rtl"] .meal-remove-btn,
html[dir="rtl"] .ingredient-remove-btn {
  direction: rtl;
}

html[dir="rtl"] .custom-qty .form-control {
  text-align: right;
}

html[dir="rtl"] .calc-lang-switch {
  justify-content: flex-start;
}



