/* =====================================================
   NutriSense India — WHO-Style Mobile Design System
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* WHO-Inspired Palette */
  --who-blue: #009CDE;
  --who-blue-dark: #0077B6;
  --who-navy: #003B5C;
  --who-navy-deep: #002840;
  --who-teal: #00A99D;
  --who-teal-light: #00C9B7;
  --who-green: #4CAF50;
  --who-orange: #FF9800;
  --who-red: #E53935;
  
  /* Surfaces */
  --bg-primary: #F0F4F8;
  --bg-card: #FFFFFF;
  --bg-card-alt: #F7FAFD;
  --bg-overlay: rgba(0, 59, 92, 0.6);
  
  /* Text */
  --text-primary: #1A2B3D;
  --text-secondary: #5A6B7D;
  --text-tertiary: #8899AA;
  --text-white: #FFFFFF;
  --text-inverse: #F0F4F8;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,40,64,0.08);
  --shadow-md: 0 4px 12px rgba(0,40,64,0.1);
  --shadow-lg: 0 8px 24px rgba(0,40,64,0.12);
  --shadow-xl: 0 12px 40px rgba(0,40,64,0.15);
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Bottom nav height */
  --nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

::placeholder {
  color: var(--text-tertiary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--who-blue); border-radius: 4px; }

/* ===== TOP HEADER ===== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--who-navy) 0%, var(--who-blue-dark) 100%);
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(0,40,64,0.2);
}

.app-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.app-title-block {
  flex: 1;
  min-width: 0;
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-action {
  width: 36px; height: 36px;
  border: none;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.header-action:active {
  background: rgba(255,255,255,0.25);
}

/* ===== SEARCH BAR ===== */
.search-container {
  position: fixed;
  top: 60px;
  top: calc(60px + env(safe-area-inset-top, 0px));
  left: 0; right: 0;
  z-index: 99;
  padding: 8px 16px 12px;
  background: linear-gradient(to bottom, var(--who-blue-dark), transparent);
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 400;
  box-shadow: var(--shadow-md);
  outline: none;
  transition: box-shadow 0.3s;
}

.search-box input:focus {
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--who-blue);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 16px;
  cursor: pointer;
  border-radius: var(--radius-full);
  display: none;
  align-items: center;
  justify-content: center;
}

.search-clear.visible { display: flex; }

/* ===== MAIN CONTENT ===== */
.app-main {
  padding-top: 120px;
  padding-top: calc(120px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 48px);
  min-height: 100vh;
  min-height: 100dvh;
}

.screen {
  display: none;
  padding: 0 16px;
  animation: fadeSlideIn 0.3s ease;
}

.screen.active {
  display: block;
}

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

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg-card);
  border-top: 1px solid rgba(0,40,64,0.08);
  display: flex;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 12px rgba(0,40,64,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  gap: 3px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.2s;
  text-decoration: none;
  position: relative;
}

.nav-item.active {
  color: var(--who-blue);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--who-blue);
  border-radius: 0 0 3px 3px;
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ===== SECTION TITLES ===== */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin: 24px 0 12px;
}

/* ===== FOOD GROUP GRID ===== */
.group-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.group-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid rgba(0,40,64,0.05);
}

.group-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-md);
}

.group-emoji {
  font-size: 32px;
  margin-bottom: 8px;
  display: block;
}

.group-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.group-count {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ===== FOOD LIST ===== */
.food-list {
  list-style: none;
}

.food-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid rgba(0,40,64,0.04);
}

.food-item:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
}

.food-code-badge {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--who-blue), var(--who-teal));
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.food-info {
  flex: 1;
  min-width: 0;
}

.food-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-scie {
  font-size: 11px;
  color: var(--text-tertiary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-energy {
  flex-shrink: 0;
  text-align: right;
}

.food-kcal {
  font-size: 16px;
  font-weight: 700;
  color: var(--who-blue-dark);
}

.food-kcal-label {
  font-size: 9px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.food-arrow {
  color: var(--text-tertiary);
  font-size: 16px;
  flex-shrink: 0;
}

/* ===== FOOD DETAIL SCREEN ===== */
.detail-hero {
  background: linear-gradient(135deg, var(--who-navy) 0%, var(--who-blue-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
  color: white;
  position: relative;
  overflow: hidden;
}

.detail-hero::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(0,156,222,0.15);
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 12px;
}

.detail-food-name {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}

.detail-food-scie {
  font-size: 13px;
  font-style: italic;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
}

.detail-food-group {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.detail-add-meal {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--who-teal);
  color: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: transform 0.2s, background 0.2s;
}

.detail-add-meal:active {
  transform: scale(0.9);
  background: var(--who-teal-light);
}

/* Macro rings */
.macro-rings {
  display: flex;
  justify-content: space-around;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.macro-ring {
  text-align: center;
}

.ring-canvas {
  width: 68px; height: 68px;
}

.macro-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 6px;
}

.macro-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Nutrient bars */
.nutrient-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.nutrient-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nutrient-section-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.nutrient-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,40,64,0.05);
}

.nutrient-row:last-child {
  border-bottom: none;
}

.nutrient-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.nutrient-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 70px;
  text-align: right;
  padding-right: 12px;
}

.nutrient-bar-wrap {
  width: 60px;
  height: 6px;
  background: rgba(0,40,64,0.06);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.nutrient-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
  min-width: 2px;
}

.bar-low { background: linear-gradient(90deg, #FFA726, #FFB74D); }
.bar-mid { background: linear-gradient(90deg, var(--who-blue), var(--who-teal)); }
.bar-high { background: linear-gradient(90deg, var(--who-green), #66BB6A); }
.bar-over { background: linear-gradient(90deg, var(--who-red), #EF5350); }

/* ===== MEAL CALCULATOR ===== */
.meal-header-card {
  background: linear-gradient(135deg, var(--who-teal) 0%, var(--who-blue) 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  color: white;
}

.meal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.meal-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}

.meal-total-kcal {
  font-size: 36px;
  font-weight: 800;
  margin: 12px 0 4px;
  letter-spacing: -1px;
}

.meal-total-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.7);
}

.meal-macros-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 16px;
  background: rgba(255,255,255,0.2);
}

.meal-macros-bar .bar-segment {
  transition: width 0.5s ease;
}

.meal-macros-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

.meal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.meal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

.meal-item-info {
  flex: 1;
  min-width: 0;
}

.meal-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meal-item-detail {
  font-size: 11px;
  color: var(--text-tertiary);
}

.meal-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--who-blue);
  background: none;
  color: var(--who-blue);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.qty-btn:active {
  background: var(--who-blue);
  color: white;
}

.qty-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 40px;
  text-align: center;
}

.meal-item-remove {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(229,57,53,0.1);
  color: var(--who-red);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.meal-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}

.meal-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.meal-empty-text {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.meal-empty-hint {
  font-size: 12px;
}

.meal-add-btn {
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--who-blue);
  border-radius: var(--radius-md);
  background: rgba(0,156,222,0.04);
  color: var(--who-blue);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  transition: background 0.2s;
}

.meal-add-btn:active {
  background: rgba(0,156,222,0.1);
}

/* ===== ABOUT / INSTALL SCREEN ===== */
.about-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.about-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.about-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.install-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--who-blue) 0%, var(--who-teal) 100%);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 12px;
}

.install-btn:active {
  transform: scale(0.98);
}

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

.install-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0,156,222,0.08);
  color: var(--who-blue);
  font-size: 12px;
  font-weight: 600;
}

.credit-link {
  color: var(--who-blue);
  text-decoration: none;
  font-weight: 600;
}

/* ===== Portion Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

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

.modal-sheet {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
  animation: slideUp 0.3s ease;
}

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

.modal-handle {
  width: 40px; height: 4px;
  background: rgba(0,40,64,0.15);
  border-radius: 2px;
  margin: 0 auto 20px;
}

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

.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.portion-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.portion-input {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid rgba(0,40,64,0.1);
  border-radius: var(--radius-md);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.portion-input:focus {
  border-color: var(--who-blue);
}

.portion-unit {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.portion-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 8px 16px;
  border: 1.5px solid rgba(0,40,64,0.12);
  border-radius: 20px;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:active, .preset-btn.selected {
  border-color: var(--who-blue);
  background: rgba(0,156,222,0.08);
  color: var(--who-blue);
}

.modal-confirm {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--who-blue);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-confirm:active {
  background: var(--who-blue-dark);
}

/* ===== LOADING / EMPTY STATES ===== */
.results-count {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-bottom: 12px;
  padding-left: 4px;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
}

.no-results-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.no-results-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.no-results-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ===== WHO Info Banner ===== */
.who-banner {
  background: linear-gradient(135deg, rgba(0,169,157,0.1) 0%, rgba(0,156,222,0.1) 100%);
  border: 1px solid rgba(0,156,222,0.15);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.who-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.who-banner-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.who-banner-text strong {
  color: var(--text-primary);
}

/* ===== VIEW MODE TOGGLE ===== */
.view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 4px;
  flex-shrink: 0;
}

.view-toggle-btn {
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: none;
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.view-toggle-btn.active {
  background: rgba(255,255,255,0.25);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.view-toggle-btn:hover:not(.active) {
  color: rgba(255,255,255,0.8);
}

/* ===== CLEAR ALL MEAL BUTTON ===== */
.meal-clear-btn {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--who-red);
  border-radius: var(--radius-md);
  background: rgba(229,57,53,0.05);
  color: var(--who-red);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.meal-clear-btn:active {
  background: rgba(229,57,53,0.12);
}

/* ===== MULTILINGUAL SEARCH TIP ===== */
.search-lang-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(0,169,157,0.08), rgba(0,156,222,0.08));
  border: 1px solid rgba(0,156,222,0.12);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.search-lang-tip-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.search-lang-tip-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.search-lang-tip-text strong {
  color: var(--who-blue-dark);
}

.lang-match {
  display: block;
  font-size: 10px;
  color: var(--who-teal);
  font-style: normal;
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-tag {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(0,169,157,0.1);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: var(--who-teal);
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.food-diet-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: 6px;
}

.tag-veg { background: rgba(76,175,80,0.12); color: #2E7D32; }
.tag-nonveg { background: rgba(229,57,53,0.12); color: #C62828; }
.tag-egg { background: rgba(255,152,0,0.12); color: #E65100; }
.tag-fish { background: rgba(0,156,222,0.12); color: #01579B; }

/* ===== PORTION MODAL CANCEL ===== */
.modal-cancel {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: color 0.2s;
}

.modal-cancel:active {
  color: var(--who-red);
}

/* ===== Responsive tweaks (Mobile default) ===== */
@media (min-width: 480px) {
  .group-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  body:not(.desktop-mode) .app-main { max-width: 480px; margin: 0 auto; }
  body:not(.desktop-mode) .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  body:not(.desktop-mode) .app-header,
  body:not(.desktop-mode) .search-container { max-width: 480px; left: 50%; transform: translateX(-50%); }
}

/* ===== DESKTOP MODE ===== */
body.desktop-mode {
  background: var(--bg-main);
}
body.desktop-mode .app-main {
  max-width: 600px;
  margin: 0 auto;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  min-height: 100vh;
}
body.desktop-mode .app-header,
body.desktop-mode .search-container,
body.desktop-mode .bottom-nav {
  max-width: 600px;
  left: 50%;
  transform: translateX(-50%);
}
body.desktop-mode .search-box input {
  max-width: 600px;
}
body.desktop-mode .modal-sheet {
  max-width: 560px;
  margin: auto;
}
/* ===== Animations ===== */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.toast {
  position: fixed;
  top: max(64px, calc(env(safe-area-inset-top) + 64px));
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--who-navy);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-xl);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  z-index: 3000;
  transition: transform 0.3s ease;
  white-space: nowrap;
}

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

/* ===== BHASHINI WIDGET STYLES ===== */
.bhashini-plugin-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 32px;
  margin-right: 8px;
  flex-shrink: 0;
}

body.desktop-mode .bhashini-plugin-container {
  margin-right: 16px;
}

/* Ensure Bhashini dropdown doesn't get hidden behind content */
div[id^="bhashini"] {
  z-index: 1000 !important;
}

/* ===== TOP QUERIES UI ===== */
.queries-section {
  margin-bottom: 24px;
}

.query-chips-wrap {
  overflow-x: auto;
  padding-bottom: 12px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  scrollbar-width: none;
}

.query-chips-wrap::-webkit-scrollbar {
  display: none;
}

.smart-query-btn {
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--who-navy);
  background: var(--bg-card);
  border: 1px solid rgba(0,40,64,0.15);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.smart-query-btn:hover, .smart-query-btn:active {
  background: var(--who-teal-light);
  color: white;
  border-color: var(--who-teal);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.query-chart-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
  display: none;
}

.query-chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-align: center;
}

.query-chart-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: -12px;
  margin-bottom: 16px;
}

.query-canvas-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  overflow-x: auto;
  overflow-y: hidden;
}

.query-chart-tooltip {
  position: absolute;
  background: rgba(0, 40, 64, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  top: 0;
  left: 0;
}

.tooltip-name {
  font-weight: 700;
  margin-bottom: 2px;
}

.tooltip-val {
  color: var(--who-teal-light);
}

/* ===== DGI 2024 ADHERENCE ===== */
.dgi-evaluation-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid rgba(0,40,64,0.08);
  box-shadow: var(--shadow-sm);
}

.dgi-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.dgi-status {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.dgi-status.balanced {
  color: var(--who-green);
}

.dgi-status.unbalanced {
  color: var(--who-orange);
}

.dgi-feedback {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}


/* Override Bhashini widget fixed positioning */
#bhashini-translation,
.bhashini-dropdown-btn {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  z-index: 1001 !important;
}

/* ===== LATEST UI ADJUSTMENTS ===== */
.bhashini-circle-wrap {
  margin-right: 8px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid rgba(0,40,64,0.1);
  position: relative;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 1001;
  flex-shrink: 0;
}

.bhashini-circle-wrap select {
  background: transparent;
  color: var(--who-navy);
  border: none;
  font-size: 11px;
  padding: 0 4px;
  outline: none;
  cursor: pointer;
}

.meal-header-rings {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  width: 100%;
}

.header-macro-ring {
  flex: 1;
  text-align: center;
  background: var(--bg-card);
  padding: 16px 4px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  min-width: 0;
}

.header-macro-ring .ring-canvas {
  width: 72px;
  height: 72px;
  max-width: 100%;
}

.header-macro-ring .macro-value {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
}

.header-macro-ring .macro-label {
  color: var(--text-secondary);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.group-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(0,40,64,0.1);
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  color: var(--who-navy);
  cursor: pointer;
  transition: all 0.2s ease;
}

.group-back-btn:hover {
  background: var(--who-teal-light);
  color: white;
  border-color: var(--who-teal);
}

.meal-rda-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.meal-rda-tile {
  background: var(--bg-card);
  border: 1px solid rgba(0,40,64,0.05);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.meal-rda-tile .ring-canvas {
  width: 70px;
  height: 70px;
}

.meal-rda-tile .macro-value {
  font-size: 13px;
  font-weight: 700;
}

.meal-rda-tile .macro-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-profile-meal {
  background: var(--who-navy);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}
.btn-profile-meal:hover {
  background: var(--who-teal);
  transform: translateY(-1px);
}

.food-name-veg {
  color: #1B5E20 !important; /* Very dark rich green */
}
.food-name-nonveg {
  color: #B71C1C !important; /* Very dark rich red */
}
