/* ═══════════════════════════════════════════════════════════════════════════
   PASHUDHAN NUTRI AI — Corporate Trust Design System
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg:          #F8FAFC;
  --surface:     #FFFFFF;
  --primary:     #4F46E5;
  --secondary:   #7C3AED;
  --success:     #10B981;
  --warning:     #F59E0B;
  --danger:      #EF4444;
  --text-main:   #0F172A;
  --text-muted:  #64748B;
  --border:      #E2E8F0;
  --indigo-50:   #EEF2FF;
  --indigo-100:  #E0E7FF;
  --shadow-soft: 0 4px 20px -2px rgba(79,70,229,0.10);
  --shadow-md:   0 10px 25px -5px rgba(79,70,229,0.15), 0 8px 10px -6px rgba(79,70,229,0.10);
  --shadow-btn:  0 4px 14px 0 rgba(79,70,229,0.30);
  --radius-xl:   12px;
  --radius-lg:   8px;
  --radius-full: 9999px;
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.lang-hi {
  font-family: 'Noto Sans Devanagari', 'Plus Jakarta Sans', system-ui, sans-serif;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; }
input, select, textarea { font-family: inherit; }

/* ── Gradient Utilities ───────────────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gradient-bg { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); }
.gradient-bg-soft { background: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%); }

/* ── Navigation ────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  min-height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.1rem; color: var(--text-main);
}
.navbar-brand .brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; box-shadow: var(--shadow-btn);
}
img.brand-icon {
  object-fit: contain;
  background: transparent;
  box-shadow: none;
  padding: 2px;
}
.navbar-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.nav-link {
  padding: 7px 14px; border-radius: var(--radius-full);
  font-size: 0.875rem; font-weight: 500; color: var(--text-muted);
  transition: all 0.2s;
}
.nav-link:hover { color: var(--primary); background: var(--indigo-50); }
.nav-link.active { color: var(--primary); background: var(--indigo-100); font-weight: 600; }
.nav-btn {
  padding: 8px 18px; border-radius: var(--radius-full);
  font-size: 0.875rem; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: var(--shadow-btn);
  transition: all 0.2s;
}
.nav-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,70,229,0.4); }

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: all 0.2s ease-out;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-pad { padding: 24px; }
.card-sm { padding: 16px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-lg);
  font-size: 0.9rem; font-weight: 600;
  transition: all 0.2s ease-out;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; box-shadow: var(--shadow-btn);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,70,229,0.4); }
.btn-secondary {
  background: var(--surface); color: #334155;
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: #94A3B8; }
.btn-success { background: linear-gradient(135deg, #059669, #10B981); color: #fff; }
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,185,129,0.4); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-lg); }

/* ── Form Elements ─────────────────────────────────────────────────────────── */
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 0.8125rem; font-weight: 600; color: #334155;
}
.form-input, .form-select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  font-size: 0.875rem; color: var(--text-main); background: var(--surface);
  transition: all 0.2s;
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.form-input::placeholder { color: #94A3B8; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Tags & Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 700;
}
.badge-indigo { background: var(--indigo-100); color: var(--primary); }
.badge-green  { background: #D1FAE5; color: #065F46; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-purple { background: #F5F3FF; color: #5B21B6; }
.badge-orange { background: #FEF3C7; color: #9A3412; }
.badge-gray   { background: #F1F5F9; color: #475569; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-lg);
  font-size: 0.8125rem; line-height: 1.5;
  display: flex; gap: 10px;
}
.alert-info    { background: #EFF6FF; border-left: 4px solid #3B82F6; color: #1E40AF; }
.alert-success { background: #F0FDF4; border-left: 4px solid #22C55E; color: #166534; }
.alert-warning { background: #FFFBEB; border-left: 4px solid #F59E0B; color: #92400E; }
.alert-danger  { background: #FFF1F2; border-left: 4px solid #F43F5E; color: #9F1239; }
.alert-purple  { background: #F5F3FF; border-left: 4px solid var(--secondary); color: #5B21B6; }

/* ── Section Title ─────────────────────────────────────────────────────────── */
.section-label {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--primary);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.section-title {
  font-size: 1.6rem; font-weight: 800; color: var(--text-main);
  line-height: 1.2; margin-bottom: 8px;
}
.section-subtitle {
  font-size: 1rem; color: var(--text-muted); line-height: 1.6;
}

/* ── Metric Card ───────────────────────────────────────────────────────────── */
.metric-card {
  background: var(--surface); border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  padding: 20px; text-align: center;
  box-shadow: var(--shadow-soft);
}
.metric-val { font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.metric-lbl { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Progress Bar ──────────────────────────────────────────────────────────── */
.progress { height: 6px; background: #E2E8F0; border-radius: 99px; overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.6s ease;
}

/* ── Toggle ────────────────────────────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 99px;
  background: #CBD5E1; cursor: pointer; transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: white; left: 3px; top: 3px;
  transition: 0.2s; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Stepper ───────────────────────────────────────────────────────────────── */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 32px; }
.step-item { display: flex; align-items: center; flex: 1; }
.step-circle {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  border: 2px solid var(--border); background: var(--surface); color: var(--text-muted);
  transition: all 0.3s; position: relative; z-index: 1;
}
.step-circle.active { border-color: var(--primary); color: var(--primary); background: var(--indigo-50); }
.step-circle.done { background: var(--primary); border-color: var(--primary); color: white; }
.step-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); margin-top: 6px; white-space: nowrap; }
.step-label.active { color: var(--primary); }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 4px; transition: all 0.3s; }
.step-line.done { background: var(--primary); }
.step-wrap { display: flex; flex-direction: column; align-items: center; }

/* ── Sidebar Layout ────────────────────────────────────────────────────────── */
.app-layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 64px); }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px; overflow-y: auto;
}
.sidebar-section { margin-bottom: 8px; }
.sidebar-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); padding: 0 12px 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-lg);
  font-size: 0.875rem; font-weight: 500; color: var(--text-muted);
  transition: all 0.15s;
}
.sidebar-link:hover { background: var(--bg); color: var(--text-main); }
.sidebar-link.active { background: var(--indigo-100); color: var(--primary); font-weight: 600; }
.sidebar-link .icon { width: 18px; height: 18px; flex-shrink: 0; }
.main-content { padding: 28px; overflow-y: auto; background: var(--bg); }

/* ── Page Header ───────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 1.75rem; font-weight: 800; color: var(--text-main); }
.page-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-xl); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
thead tr { background: var(--bg); }
th { padding: 12px 16px; text-align: left; font-weight: 700; color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid #F1F5F9; color: var(--text-main); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #F8FAFC; }

/* ── Collapsible ────────────────────────────────────────────────────────────── */
.collapsible-hdr {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none; padding: 12px 0;
}
.collapsible-arrow { transition: transform 0.2s; font-size: 0.7rem; color: var(--text-muted); }
.collapsible-hdr.open .collapsible-arrow { transform: rotate(180deg); }
.collapsible-body { display: none; }
.collapsible-body.open { display: block; }

/* ── Loading spinner ────────────────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--indigo-100); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Blob Background ────────────────────────────────────────────────────────── */
.blob-container { position: relative; overflow: hidden; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none;
}
.blob-1 { width: 500px; height: 500px; background: rgba(79,70,229,0.12); top: -200px; right: -150px; }
.blob-2 { width: 400px; height: 400px; background: rgba(124,58,237,0.08); bottom: -100px; left: -100px; }

/* ── Animations ─────────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0.3); }
  50%       { box-shadow: 0 0 0 8px rgba(79,70,229,0); }
}
.fade-up { animation: fadeInUp 0.5s ease-out both; }
.fade-up-1 { animation-delay: 0.1s; }
.fade-up-2 { animation-delay: 0.2s; }
.fade-up-3 { animation-delay: 0.3s; }
.fade-up-4 { animation-delay: 0.4s; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  
  /* Show hamburger button */
  .mobile-menu-btn { display: block; margin-left: auto; }
  
  /* Convert navbar links to a slide-out drawer */
  .navbar-links {
    position: fixed;
    top: 64px; /* below navbar */
    right: -100%;
    width: 250px;
    height: calc(100vh - 64px);
    background: var(--surface);
    flex-direction: column;
    align-items: flex-start;
    padding: 0px 20px 20px 20px;
    gap: 8px;
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 999;
  }
  .navbar-links.open {
    right: 0;
  }
  .navbar-links .nav-link { 
    display: block; 
    width: 100%; 
    padding: 12px 16px;
  }
  .navbar-links #login-btn {
    width: 100%;
    margin-top: 10px;
  }

  /* Fix sticky sidebar for formulation pages so it scrolls naturally */
  .sticky-sidebar {
    position: static !important;
    height: auto !important;
    overflow: visible !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
  }
}
@media (max-width: 600px) {
  .main-content { padding: 16px; }
  .card-pad { padding: 16px; }
  .page-title { font-size: 1.35rem; }
  .section-title { font-size: 1.2rem; }
}

/* ── Ingredient bar ──────────────────────────────────────────────────────── */
.ing-bar-wrap { height: 5px; background: #E2E8F0; border-radius: 99px; margin-top: 4px; }
.ing-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 99px; }

/* ── Tab System ──────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; font-size: 0.875rem; font-weight: 600;
  color: var(--text-muted); background: transparent; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; transition: all 0.2s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeInUp 0.3s ease-out; }

/* ── Checkbox Group ──────────────────────────────────────────────────────── */
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill input { display: none; }
.check-pill label {
  padding: 5px 12px; border-radius: var(--radius-full);
  border: 1.5px solid var(--border); font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.check-pill input:checked + label {
  border-color: var(--primary); background: var(--indigo-50); color: var(--primary);
}

/* ── Section divider ───────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }


/* Hide Buffalo features for USA users */
body[data-country="USA"] .buffalo-only { display: none !important; }
body[data-country="USA"] option[value*="buf"] { display: none !important; }
body[data-country="USA"] option[value="buffalo"] { display: none !important; }
body[data-country="USA"] optgroup[label*="Buffalo"] { display: none !important; }
