/* ==========================================================================
   Qoldau Food — Modern HealthTech / EdTech Design System
   Tailored for Kazakhstan Food Label Transparency
   ========================================================================== */

:root {
  /* Brand & Color Palette */
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #f0fdfa;
  --primary-border: #99f6e4;
  --primary-gradient: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  
  --secondary: #0f172a;
  --secondary-hover: #1e293b;
  
  --kz-gold: #fbbf24;
  --kz-blue: #0284c7;

  /* Neutral Surface & Text */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;
  
  --border-color: #e2e8f0;
  --border-focus: #059669;

  /* Nutritional Indicators */
  --color-low-bg: #ecfdf5;
  --color-low-text: #065f46;
  --color-low-border: #a7f3d0;
  
  --color-mod-bg: #fffbeb;
  --color-mod-text: #92400e;
  --color-mod-border: #fde68a;
  
  --color-high-bg: #fef2f2;
  --color-high-text: #991b1b;
  --color-high-border: #fecaca;
  
  --color-neutral-bg: #f1f5f9;
  --color-neutral-text: #475569;
  --color-neutral-border: #cbd5e1;

  /* Shadows & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.06);

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: #faf8f5;
  background-image: 
    linear-gradient(180deg, rgba(253, 251, 247, 0.78) 0%, rgba(246, 250, 248, 0.84) 100%),
    url('assets/images/bg-pattern.jpg');
  background-repeat: repeat;
  background-position: center top;
  background-size: auto, 480px 853px; /* Exact 576:1024 (9:16) aspect ratio, perfectly balanced and crisp across all screens */
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 860px; /* Enhanced modern desktop & tablet reading width */
  margin: 0 auto;
  padding: 0 16px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.logo-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 61, 46, 0.28);
  background: #0f3d2e;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-group:hover .logo-badge {
  transform: scale(1.05) rotate(-2deg);
}

.header-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-title .highlight {
  color: var(--primary);
}

.kz-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: #f0f9ff;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid #bae6fd;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
  margin-top: -2px;
}

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

.currency-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 3px;
}

.currency-symbol {
  color: var(--primary);
  font-weight: 800;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 28px 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  transition: var(--transition);
}

.lang-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* ==========================================================================
   Main App Container & Views
   ========================================================================== */
.app-main {
  flex: 1;
  padding-top: 20px;
  padding-bottom: 40px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.25s ease-out;
}

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

/* ==========================================================================
   Buttons & Interactive Elements
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  user-select: none;
  min-height: 48px;
  padding: 10px 20px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
  box-shadow: var(--shadow-sm);
}

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

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1.5px solid var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-muted);
  border-color: var(--text-muted);
}

.btn-large {
  min-height: 56px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-lg);
  width: 100%;
}

.btn-pulse {
  position: relative;
}

.btn-pulse::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--radius-lg) + 3px);
  background: var(--primary);
  opacity: 0;
  z-index: -1;
  animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
  0% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1); }
}

.btn-icon {
  width: 22px;
  height: 22px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-back:hover {
  color: var(--text-main);
  background: var(--bg-muted);
}

.btn-back svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Home View Components
   ========================================================================== */
.hero-card {
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
  border: 1.5px solid var(--primary-border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--secondary);
  line-height: 1.2;
  margin-bottom: 10px;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 24px;
  line-height: 1.5;
}

.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.section-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.search-form {
  display: flex;
  gap: 10px;
  flex-direction: column;
}

@media (min-width: 480px) {
  .search-form {
    flex-direction: row;
  }
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-light);
  pointer-events: none;
}

.barcode-input {
  width: 100%;
  height: 48px;
  padding: 10px 38px 10px 42px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-main);
  transition: var(--transition);
}

.barcode-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.btn-clear-input {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px 6px;
}

.btn-clear-input:hover {
  color: var(--text-main);
}

.quick-samples {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.quick-samples-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.chip-btn-muted {
  border-style: dashed;
  color: var(--text-muted);
}

/* History / Recent Scans */
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.btn-text-danger {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.btn-text-danger:hover {
  background: #fee2e2;
}

.recent-scans-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
}

.history-item:hover {
  border-color: var(--primary);
  background: #fcfdfd;
  transform: translateX(2px);
}

.history-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

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

.history-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.history-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.history-chips-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.history-score-chip {
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

/* Feature Row */
.features-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 560px) {
  .features-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.feature-icon {
  font-size: 1.7rem;
  margin-bottom: 8px;
}

.feature-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 4px;
}

.feature-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   Product Detail View
   ========================================================================== */
.product-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.badge-verified {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-unverified {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.product-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (min-width: 520px) {
  .product-hero-card {
    flex-direction: row;
    align-items: center;
  }
}

.product-image-container {
  width: 100%;
  max-width: 200px;
  height: 200px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.product-img-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.fallback-icon {
  font-size: 2.5rem;
}

.product-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-brand {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.product-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.25;
}

.product-barcode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.barcode-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: monospace;
  font-size: 0.82rem;
  background: var(--bg-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.barcode-chip svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.origin-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Rating Box (Neutral Informational Rating) */
.rating-box {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
}

.rating-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.rating-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--secondary);
}

.rating-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rating-low {
  background: var(--color-low-bg);
  color: var(--color-low-text);
  border: 1.5px solid var(--color-low-border);
}

.rating-moderate {
  background: var(--color-mod-bg);
  color: var(--color-mod-text);
  border: 1.5px solid var(--color-mod-border);
}

.rating-high {
  background: var(--color-high-bg);
  color: var(--color-high-text);
  border: 1.5px solid var(--color-high-border);
}

.rating-nodata {
  background: var(--color-neutral-bg);
  color: var(--color-neutral-text);
  border: 1.5px solid var(--color-neutral-border);
}

.rating-disclaimer {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ==============================================================================
   100-POINT SCIENTIFIC HEALTH SCORE CARD
   ============================================================================== */
.health-score-card {
  margin-top: 14px;
  padding: 16px;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.3s ease;
}

[data-theme="dark"] .health-score-card {
  background: rgba(18, 30, 24, 0.95) !important;
  border-color: rgba(52, 211, 153, 0.18) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45) !important;
}

.score-card-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Circular Radial Progress Gauge */
.score-meter-wrap {
  position: relative;
  width: 82px;
  height: 82px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-radial-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-circle-bg {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 8;
}

[data-theme="dark"] .score-circle-bg {
  stroke: #334155;
}

.score-circle-fg {
  fill: none;
  stroke: #10b981;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251.327;
  stroke-dashoffset: 251.327;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s ease;
}

.score-number-box {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.score-val {
  font-size: 1.6rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.03em;
}

[data-theme="dark"] .score-val {
  color: #f8fafc;
}

.score-max {
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
  margin-top: 1px;
}

/* Info side (Title, badge, headline, summary) */
.score-info-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.score-card-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

[data-theme="dark"] .score-card-label {
  color: #94a3b8;
}

.score-grade-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill, 9999px);
  color: #ffffff;
  background: #10b981;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.score-grade-badge.grade-nodata {
  background: #94a3b8 !important;
}

.score-headline {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-color, #0f172a);
  line-height: 1.25;
}

.score-summary {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

/* Horizontal Range Track (0 to 100) */
.score-bar-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}

.score-bar-track {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill, 9999px);
  background: linear-gradient(90deg, #ef4444 0%, #f97316 25%, #f59e0b 50%, #84cc16 75%, #10b981 100%);
  overflow: visible;
}

.score-bar-fill {
  display: none;
}

.score-bar-needle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2.5px solid #0f172a;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: left 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .score-bar-needle {
  background: #0f172a;
  border-color: #ffffff;
}

.score-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 600;
  color: #94a3b8;
  padding: 0 2px;
}

/* Positive & Negative Factors Grid */
.score-factors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.score-factor-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  line-height: 1.3;
}

.score-factor-chip.factor-pos {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

[data-theme="dark"] .score-factor-chip.factor-pos {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

.score-factor-chip.factor-neg {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

[data-theme="dark"] .score-factor-chip.factor-neg {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.score-disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
  margin: 0;
  padding-top: 4px;
  border-top: 1px dashed var(--border-color, #e2e8f0);
}

/* Data Confidence Indicator */
.confidence-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.confidence-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.confidence-label {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}

.confidence-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 9999px);
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

.confidence-badge.confidence-high {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.confidence-badge.confidence-medium {
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde047;
}

.confidence-badge.confidence-low {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.confidence-note {
  font-size: 0.72rem;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fef08a;
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 1.35;
}

[data-theme="dark"] .confidence-note {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

/* "Why this score?" Breakdown Section */
.why-score-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color, #e2e8f0);
}

.why-score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.why-score-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #64748b);
}

.why-score-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.why-score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.why-score-item.why-neg {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #991b1b;
}

[data-theme="dark"] .why-score-item.why-neg {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.why-score-item.why-pos {
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  color: #166534;
}

[data-theme="dark"] .why-score-item.why-pos {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #86efac;
}

.why-score-item.why-neutral {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

[data-theme="dark"] .why-score-item.why-neutral {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.why-item-desc {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.why-item-impact {
  font-weight: 800;
  font-size: 0.76rem;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.why-neg .why-item-impact {
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .why-neg .why-item-impact {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.why-pos .why-item-impact {
  background: #dcfce7;
  color: #15803d;
}

[data-theme="dark"] .why-pos .why-item-impact {
  background: rgba(16, 185, 129, 0.25);
  color: #86efac;
}

.why-neutral .why-item-impact {
  background: #e2e8f0;
  color: #475569;
}

/* Info Cards (Nutrition, Insights, Ingredients) */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.card-header-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--secondary);
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* "Easy to Understand" Insights Cards */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.insight-card.level-high {
  background: var(--color-high-bg);
  border-color: var(--color-high-border);
  color: var(--color-high-text);
}

.insight-card.level-moderate {
  background: var(--color-mod-bg);
  border-color: var(--color-mod-border);
  color: var(--color-mod-text);
}

.insight-card.level-low {
  background: var(--color-low-bg);
  border-color: var(--color-low-border);
  color: var(--color-low-text);
}

.insight-card.level-allergen {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.insight-card.level-info {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.insight-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.insight-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.insight-desc {
  font-size: 0.8rem;
  opacity: 0.9;
  line-height: 1.4;
}

/* Nutrition Grid */
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 480px) {
  .nutrition-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.nutr-cell {
  background: var(--bg-muted);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.nutr-cell.cell-primary {
  grid-column: span 2;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #a7f3d0;
}

@media (min-width: 480px) {
  .nutr-cell.cell-primary {
    grid-column: span 3;
  }
}

.nutr-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.nutr-cell.cell-primary .nutr-label {
  color: #065f46;
}

.nutr-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--secondary);
}

.nutr-cell.cell-primary .nutr-value {
  color: #047857;
  font-size: 1.4rem;
}

.nutr-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

/* Ingredients & Allergens */
.ingredients-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-main);
  background: #fbfcfe;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.allergens-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.allergen-chip {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.allergen-chip.no-allergens {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

/* Details list */
.details-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.86rem;
}

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

.detail-key {
  color: var(--text-muted);
  font-weight: 500;
}

.detail-val {
  font-weight: 600;
  color: var(--secondary);
  text-align: right;
}

.product-bottom-actions {
  margin-top: 10px;
}

/* ==========================================================================
   Status Screens (Not Found, Error)
   ========================================================================== */
.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.status-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-icon-wrapper.warning {
  background: #fef3c7;
  color: #d97706;
}

.status-icon-wrapper svg {
  width: 34px;
  height: 34px;
}

.status-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 10px;
}

.status-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto 20px;
}

.highlight-code {
  font-family: monospace;
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--secondary);
}

.kazakhstan-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: left;
  margin-bottom: 24px;
}

.callout-flag {
  font-size: 2rem;
  line-height: 1;
}

.kazakhstan-callout h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 4px;
}

.kazakhstan-callout p {
  font-size: 0.82rem;
  color: #14532d;
  line-height: 1.4;
}

.status-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
}

/* ==========================================================================
   Add Product Form
   ========================================================================== */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.form-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--secondary);
}

.notice-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: #92400e;
}

.notice-box svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.create-product-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--secondary);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-card);
  transition: var(--transition);
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.form-input[readonly] {
  background: var(--bg-muted);
  cursor: not-allowed;
}

.photo-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.photo-preview-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-remove-photo {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nutrition-fieldset {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 6px;
}

.fieldset-legend {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--secondary);
  padding: 0 8px;
}

.nutrition-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 8px;
}

@media (min-width: 480px) {
  .nutrition-fields-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.field-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.form-submit-row {
  margin-top: 8px;
}

/* ==========================================================================
   Scanner Modal
   ========================================================================== */
.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
}

.scanner-modal-content {
  position: relative;
  width: 95%;
  max-width: 480px;
  background: #0f172a;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #1e293b;
  color: white;
}

.scanner-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
}

.scanner-header-icon {
  width: 20px;
  height: 20px;
  color: #34d399;
}

.btn-icon-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}

.btn-icon-close:hover {
  color: white;
}

.scanner-viewport-wrapper {
  position: relative;
  width: 100%;
  height: 58vh;
  min-height: 280px;
  max-height: 460px;
  background: #000000;
  overflow: hidden;
  border-radius: 14px;
}

.scanner-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-viewport video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.scanner-overlay-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-frame {
  position: relative;
  width: 75%;
  height: 60%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}

.corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #10b981;
  border-style: solid;
}

.corner.top-left {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 8px;
}

.corner.top-right {
  top: -2px;
  right: -2px;
  border-width: 3px 3px 0 0;
  border-top-right-radius: 8px;
}

.corner.bottom-left {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 3px 3px;
  border-bottom-left-radius: 8px;
}

.corner.bottom-right {
  bottom: -2px;
  right: -2px;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 8px;
}

.scanner-laser-line {
  position: absolute;
  left: 5%;
  right: 5%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #10b981, #34d399, transparent);
  box-shadow: 0 0 10px #10b981;
  animation: laserScan 2s ease-in-out infinite alternate;
}

@keyframes laserScan {
  0% { top: 8%; }
  100% { top: 92%; }
}

.scanner-distance-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  color: #34d399;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(52, 211, 153, 0.35);
  z-index: 10;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.tap-focus-ring {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 2px solid #34d399;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.4);
  opacity: 0;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
  z-index: 15;
}

.tap-focus-ring.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.scanner-zoom-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
}

.zoom-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
}

.btn-zoom {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
}

.btn-zoom.active, .btn-zoom:hover {
  background: #059669;
  border-color: #10b981;
  color: white;
}

.file-scanner-big-btn {
  background: #1e293b !important;
  color: #38bdf8 !important;
  border: 1.5px solid #0284c7 !important;
  box-shadow: none !important;
  min-height: 44px;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  margin-top: 4px;
}

.file-scanner-big-btn:hover {
  background: #0f172a !important;
  border-color: #38bdf8 !important;
}

.scanner-controls {
  padding: 16px 20px 20px;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.scanner-hint {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}

.scanner-btn-group {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-scanner-ctrl {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 40px;
}

.btn-scanner-ctrl:hover {
  background: #334155;
}

.btn-scanner-ctrl svg {
  width: 16px;
  height: 16px;
}

.scanner-error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* ==========================================================================
   Loading Overlay & Toasts
   ========================================================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border: 3.5px solid #d1fae5;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--secondary);
}

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 420px;
  pointer-events: none;
}

.toast {
  background: var(--secondary);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease-out forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.toast-error {
  background: #b91c1c;
}

.toast.toast-success {
  background: #047857;
}

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

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  border-top: 1px solid var(--border-color);
  background: white;
  padding: 20px 0;
  margin-top: auto;
}

.footer-content {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-sub a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-sub a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Search Mode Tabs & Product Name Search UI
   ========================================================================== */
.search-tabs {
  display: flex;
  background: var(--bg-body, #f1f5f9);
  padding: 4px;
  border-radius: var(--radius-md, 12px);
  gap: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color, #e2e8f0);
}

.search-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-tab .tab-icon {
  width: 18px;
  height: 18px;
}

.search-tab:hover {
  color: var(--text-main, #0f172a);
}

.search-tab.active {
  background: white;
  color: var(--primary, #059669);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.search-panel {
  display: none;
}

.search-panel.active {
  display: block;
}

/* Search Results UI */
.search-results-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.results-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.badge-count {
  background: var(--primary-light, #ecfdf5);
  color: var(--primary, #059669);
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.btn-text-muted {
  background: none;
  border: none;
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-text-muted:hover {
  color: var(--text-main, #0f172a);
  background: #f1f5f9;
}

.search-feedback-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
  background: #f8fafc;
  border-radius: var(--radius-md, 12px);
  margin-top: 8px;
}

.search-feedback-box .feedback-icon {
  font-size: 1.5rem;
}

.search-feedback-box.error {
  color: #b91c1c;
  background: #fef2f2;
}

.spinner-small {
  width: 18px;
  height: 18px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--primary, #059669);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 2px;
}

.search-result-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.search-result-card:hover {
  border-color: var(--primary, #059669);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.1);
  transform: translateY(-1px);
}

.search-result-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: #f8fafc;
  flex-shrink: 0;
  border: 1px solid #f1f5f9;
}

.search-result-thumb-fallback {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

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

.search-result-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main, #0f172a);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-result-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  border-radius: 10px;
  padding: 2px 6px;
  font-weight: 800;
  font-size: 0.92rem;
  flex-shrink: 0;
  line-height: 1.1;
}

.search-result-score-badge small {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.85;
}

/* ==========================================================================
   Healthier Alternatives Component
   ========================================================================== */
.alternatives-card {
  border: 1.5px solid #a7f3d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100px);
}

.badge-accent-sub {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #047857;
  background: #d1fae5;
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.alternatives-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  color: var(--text-muted, #64748b);
  font-size: 0.88rem;
}

.alternatives-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted, #64748b);
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
}

.alternatives-empty-state .empty-icon {
  font-size: 1.8rem;
}

.alternatives-empty-state p {
  margin: 0;
  font-size: 0.9rem;
}

.alternatives-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.alt-item-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: white;
  border: 1px solid #d1fae5;
  border-radius: var(--radius-md, 12px);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.04);
}

.alt-item-card:hover {
  transform: translateY(-2px);
  border-color: #10b981;
  box-shadow: 0 6px 18px rgba(4, 120, 87, 0.12);
}

.alt-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alt-item-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.alt-item-thumb-fallback {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

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

.alt-item-name {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  margin-bottom: 2px;
  line-height: 1.3;
}

.alt-item-brand {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
}

.alt-item-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  min-width: 48px;
}

.alt-item-score small {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.85;
}

.alt-reasons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}

.alt-reason-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.alt-reason-chip.chip-better-score {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alt-reason-chip.chip-sugar {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alt-reason-chip.chip-salt {
  background: #f5f3ff;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
}

.alt-reason-chip.chip-satfat {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alt-reason-chip.chip-protein {
  background: #f0fdfa;
  color: #115e59;
  border: 1px solid #99f6e4;
}

.alternatives-disclaimer-note {
  font-size: 0.76rem;
  color: var(--text-muted, #64748b);
  margin-top: 12px;
  line-height: 1.4;
  text-align: center;
}

/* ==========================================================================
   Official Product Information & Certification
   ========================================================================== */
.official-info-card {
  border-left: 4px solid #3b82f6;
}

.official-tag-row {
  margin-bottom: 4px;
}

.badge-official {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.official-info-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.official-cert-empty {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: var(--text-muted, #64748b);
  font-size: 0.86rem;
  line-height: 1.4;
}

.official-cert-empty .empty-cert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.official-cert-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
}

.official-cert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #0369a1;
}

.official-cert-meta {
  font-size: 0.82rem;
  color: #334155;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 6px;
}

.official-cert-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #0284c7;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: 4px;
}

.official-cert-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Data Source & Transparency Component
   ========================================================================== */
.transparency-card {
  border-left: 4px solid #10b981;
}

.transparency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.transparency-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}

.transparency-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.transparency-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main, #0f172a);
}

.transparency-val.badge-status {
  display: inline-block;
  background: #e2e8f0;
  color: #334155;
  padding: 2px 8px;
  border-radius: 6px;
  width: fit-content;
  font-size: 0.78rem;
}

.transparency-disclaimer-box {
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
}

.transparency-disclaimer-box p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #92400e;
}

/* ==========================================================================
   Midterm Stage 1: User Preferences & Header Actions
   ========================================================================== */
.pref-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-weight: 700;
  transition: var(--transition);
}

.pref-header-btn:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.pref-badge-count {
  background: #16a34a;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

/* Top badges bar on product page */
.product-top-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-offline-cache {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-weight: 700;
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Personalized Warning Component (Main User Flow)
   ========================================================================== */
.personalized-warning-card {
  margin-top: 12px;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}

/* Alert state: Match with allergen or restricted diet */
.personalized-warning-card.warning-alert {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  color: #9f1239;
}

[data-theme="dark"] .personalized-warning-card.warning-alert {
  background: rgba(225, 29, 72, 0.15);
  border-color: rgba(225, 29, 72, 0.35);
  color: #fecdd3;
}

.warning-alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.3;
}

.warning-alert-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.warning-matched-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.warning-matched-tag {
  background: #ffe4e6;
  color: #881337;
  border: 1px solid #fda4af;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 6px;
}

[data-theme="dark"] .warning-matched-tag {
  background: rgba(225, 29, 72, 0.25);
  color: #ffe4e6;
  border-color: rgba(225, 29, 72, 0.4);
}

.warning-disclaimer-note {
  font-size: 0.72rem;
  color: #9f1239;
  opacity: 0.85;
  line-height: 1.35;
}

/* Safe state: Preferences set, no conflict detected */
.personalized-warning-card.warning-safe {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

[data-theme="dark"] .personalized-warning-card.warning-safe {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #86efac;
}

.warning-safe-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Prompt state: No preferences configured yet */
.personalized-warning-card.warning-prompt {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #475569;
}

.warning-prompt-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.warning-prompt-text {
  font-size: 0.8rem;
  font-weight: 600;
}

.warning-prompt-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
}

.warning-prompt-btn:hover {
  background: #f1f5f9;
}

/* ==========================================================================
   Data Validation & Quality Layer Card
   ========================================================================== */
.validation-card {
  margin-top: 12px;
  padding: 14px;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

[data-theme="dark"] .validation-card {
  background: #1e293b;
  border-color: #334155;
}

.validation-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.validation-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.validation-confidence-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.validation-confidence-badge.confidence-high {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.validation-confidence-badge.confidence-medium {
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde047;
}

.validation-confidence-badge.confidence-low {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.validation-card-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
}

.data-origin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}

[data-theme="dark"] .data-origin-pill {
  background: #334155;
  color: #cbd5e1;
}

.pill-sep {
  opacity: 0.5;
}

.validation-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.validation-missing-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px dashed #e2e8f0;
}

.validation-missing-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

.validation-missing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.missing-chip {
  font-size: 0.7rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   Product Not Found Inline Search Form
   ========================================================================== */
.not-found-search-inline {
  width: 100%;
  margin: 14px 0 8px 0;
  text-align: left;
}

.not-found-search-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

/* ==========================================================================
   Healthier Alternatives Score Advantage Badge
   ========================================================================== */
.alt-score-diff {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 0.74rem;
  color: #047857;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ==========================================================================
   User Preferences / Profile Modal
   ========================================================================== */
.pref-modal-content {
  background: #ffffff;
  color: var(--text-main);
  padding: 0;
  max-width: 520px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}

[data-theme="dark"] .pref-modal-content {
  background: #1e293b;
  color: #f8fafc;
}

.pref-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}

.pref-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pref-header-icon {
  font-size: 1.5rem;
}

.pref-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

[data-theme="dark"] .pref-modal-title {
  color: #f8fafc;
}

.pref-modal-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.pref-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pref-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pref-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pref-section-icon {
  font-size: 1.1rem;
}

.pref-section-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
}

[data-theme="dark"] .pref-section-title {
  color: #f8fafc;
}

.pref-section-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.pref-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.pref-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

[data-theme="dark"] .pref-chip {
  background: #0f172a;
  border-color: #334155;
}

.pref-chip:hover {
  background: #f1f5f9;
  border-color: var(--primary);
}

.pref-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.pref-chip:has(.pref-checkbox:checked) {
  background: #ecfdf5;
  border-color: #059669;
  color: #065f46;
}

[data-theme="dark"] .pref-chip:has(.pref-checkbox:checked) {
  background: rgba(5, 150, 105, 0.2);
  border-color: #10b981;
  color: #a7f3d0;
}

.pref-chip-label {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}

.pref-disclaimer-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  color: #92400e;
  font-size: 0.74rem;
  line-height: 1.4;
}

.pref-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: #fafafa;
}

[data-theme="dark"] .pref-modal-footer {
  background: #0f172a;
  border-color: #334155;
}




/* ==========================================================================
   QOLDAU v3.0 Modernization Extensions
   - Catalog Grid & Category Filters
   - 8-Card Product Hierarchy
   - Halal Verification Status Styles
   - Product Comparison Matrix & Floating Bar
   - Community Error Reporting Modal
   ========================================================================== */

/* Header Comparison Button */
.comp-header-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  transition: var(--transition);
}

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

.comp-header-btn .badge-count {
  background: var(--primary);
  color: white;
}

/* Home Categories & Catalog Section */
.home-categories-section {
  margin: 24px 0 16px;
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.heading-title-group .section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary);
}

.heading-title-group .section-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.category-pills-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-pills-row::-webkit-scrollbar {
  display: none;
}

.category-pill {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.category-pill:hover {
  background: var(--bg-muted);
  border-color: var(--primary-border);
}

.category-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

.home-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 500px) {
  .home-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

.home-product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.home-product-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}

.home-card-header,
.home-product-thumb-wrap {
  position: relative;
  width: 100%;
  height: 140px;
  min-height: 140px;
  background: #f8fafc;
  border-radius: calc(var(--radius-md) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(226, 232, 240, 0.7);
}

.home-product-thumb {
  max-width: 100%;
  max-height: 124px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.home-product-card:hover .home-product-thumb {
  transform: scale(1.06);
}

.home-product-thumb-fallback {
  font-size: 2.4rem;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-card-score,
.home-product-score {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.84rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.home-card-score small,
.home-product-score small {
  font-size: 0.65rem;
  opacity: 0.8;
}

.home-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.home-card-title,
.home-product-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

.home-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.home-card-brand,
.home-product-brand {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-card-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.home-product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}

.home-product-score {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.home-product-score small {
  font-size: 0.65rem;
  opacity: 0.8;
}

.home-product-halal-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.home-product-halal-badge.verified {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.home-product-halal-badge.claim {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* How It Works Card */
.how-it-works-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .steps-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.step-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.step-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.step-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Trust Principles Card */
.trust-principles-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 20px 0 30px;
  box-shadow: var(--shadow-sm);
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (max-width: 540px) {
  .trust-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.trust-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.trust-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1;
}

.trust-text strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 2px;
}

.trust-text p {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Product View Top Badges & Actions */
.product-top-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-compare-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-compare-action.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Experimental Score Tag */
.badge-experimental {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  cursor: help;
}

/* Ingredients Details Box */
.ingredients-full-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.ingredients-box-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

/* Halal Card & Badges */
.halal-card {
  border-left: 4px solid #14b8a6;
}

.halal-tag-row {
  margin-bottom: 4px;
}

.badge-halal {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.halal-content-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.halal-status-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
}

.halal-status-banner.verified {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.halal-status-banner.claim {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.halal-status-banner.not-verified {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.halal-status-banner.unavailable {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.halal-status-banner.not-halal {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.halal-banner-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.halal-banner-body h3 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.halal-banner-body p {
  font-size: 0.8rem;
  line-height: 1.45;
  margin-bottom: 4px;
}

.halal-banner-body .halal-cert-org {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.95;
}

.halal-ingredient-scan {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-main);
}

.halal-disclaimer-note {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

/* Report Error Button & Modal */
.report-box-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-outline-report {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline-report:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.report-modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 92%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

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

.report-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-header-icon {
  font-size: 1.3rem;
}

.report-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--secondary);
}

.report-modal-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.report-form {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.report-product-badge {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--secondary);
}

.report-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
}

@media (max-width: 480px) {
  .report-checkbox-grid {
    grid-template-columns: 1fr;
  }
}

.report-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.report-chip input {
  accent-color: var(--primary);
}

/* Sticky Floating Comparison Bar */
.floating-compare-bar {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  z-index: 50;
  pointer-events: none;
}

.floating-compare-content {
  pointer-events: auto;
  background: #0f172a;
  color: white;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.floating-compare-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compare-counter-pill {
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.compare-label {
  font-size: 0.84rem;
  font-weight: 600;
}

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

/* Comparison Modal & Table */
.comparison-modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 920px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.comparison-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.comparison-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comp-header-icon {
  font-size: 1.4rem;
}

.comparison-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--secondary);
}

.comparison-modal-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.comparison-modal-body {
  padding: 20px;
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
}

.comparison-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  flex-shrink: 0;
}

.comparison-empty-state {
  text-align: center;
  padding: 40px 20px;
}

.comp-empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 10px;
}

.comparison-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

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

.comparison-matrix th.param-header {
  width: 160px;
  background: #f8fafc;
  font-weight: 700;
  color: var(--text-muted);
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid var(--border-color);
}

.comparison-matrix td.comp-prod-col {
  min-width: 160px;
  background: var(--bg-card);
}

.comp-prod-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding-bottom: 8px;
}

.comp-prod-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.comp-prod-name {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.25;
  color: var(--secondary);
}

.comp-prod-brand {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-remove-comp-item {
  font-size: 0.72rem;
  color: #ef4444;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-remove-comp-item:hover {
  background: #fee2e2;
}

.comp-winner-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #ecfdf5;
  color: #065f46;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  margin-left: 4px;
}

/* Static QR Mobile Box */
.qr-modal-box {
  background: white;
  color: #0f172a;
  padding: 24px;
  text-align: center;
  max-width: 440px;
  border-radius: 18px;
}

.qr-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.qr-head-title {
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-badge-ready {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  border: 1px solid #a7f3d0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.qr-modal-desc {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 12px;
  line-height: 1.4;
}

.qr-code-frame {
  background: #f8fafc;
  padding: 12px;
  border-radius: 14px;
  display: inline-block;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  min-width: 216px;
  min-height: 216px;
  position: relative;
}

.qr-target-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 216px;
  height: 216px;
  margin: 0 auto;
}

.qr-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.qr-link-text {
  flex: 1;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  word-break: break-all;
  font-family: monospace;
  color: #0f766e;
  font-weight: 600;
  text-align: left;
  max-height: 48px;
  overflow-y: auto;
}

.qr-tip-box {
  background: #eff6ff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  color: #1e40af;
  text-align: left;
  line-height: 1.4;
  border: 1px solid #bfdbfe;
}

/* ==========================================================================
   ENHANCED VISUAL SYSTEM, ANIMATIONS & FLEXIBLE UI
   ========================================================================== */

/* 1. Dynamic Ambient Glowing Background System */
.ambient-glow-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  will-change: transform;
}

.ambient-orb.orb-1 {
  top: -120px;
  left: -100px;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(13, 148, 136, 0.28) 0%, rgba(20, 184, 166, 0.05) 70%, transparent 100%);
  animation: floatOrb1 20s infinite ease-in-out alternate;
}

.ambient-orb.orb-2 {
  top: 15%;
  right: -140px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.22) 0%, rgba(251, 191, 36, 0.08) 65%, transparent 100%);
  animation: floatOrb2 24s infinite ease-in-out alternate;
}

.ambient-orb.orb-3 {
  bottom: -80px;
  left: 20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(2, 132, 199, 0.18) 0%, rgba(13, 148, 136, 0.06) 70%, transparent 100%);
  animation: floatOrb3 22s infinite ease-in-out alternate;
}

.ambient-grid-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(13, 148, 136, 0.09) 1.2px, transparent 1.2px);
  background-size: 28px 28px;
  opacity: 0.4;
  mask-image: radial-gradient(circle at 50% 30%, black 50%, transparent 95%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, black 50%, transparent 95%);
}

@keyframes floatOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 80px) scale(1.12); }
  100% { transform: translate(-40px, 120px) scale(0.95); }
}

@keyframes floatOrb2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-80px, 100px) scale(1.08); }
  100% { transform: translate(40px, -60px) scale(0.92); }
}

@keyframes floatOrb3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, -70px) scale(1.15); }
  100% { transform: translate(70px, -40px) scale(0.9); }
}

/* 2. Glassmorphism & Elevated Card Styles (High Opacity for Perfect Readability) */
.hero-card,
.search-card,
.info-card,
.history-card,
.how-it-works-card,
.trust-principles-card,
.home-categories-section,
.product-hero-card,
.search-results-section {
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.92) !important;
  box-shadow: 0 10px 30px -4px rgba(15, 23, 42, 0.08), 0 2px 8px -2px rgba(15, 23, 42, 0.04) !important;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s;
}

.home-product-card {
  background: rgba(255, 255, 255, 0.97) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(226, 232, 240, 0.95) !important;
}

.info-card:hover {
  box-shadow: 0 16px 36px -6px rgba(13, 148, 136, 0.12), 0 0 0 1px rgba(13, 148, 136, 0.28) !important;
}

/* 3. Header Action Icons & Button Enhancements */
.header-action-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
}

.currency-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.currency-tag:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.currency-tag:active {
  transform: scale(0.96);
}

/* 4. Category Pills with SVG Icons */
.category-pills-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  scroll-snap-align: start;
}

.category-pill:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
}

.category-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}

.pill-svg-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* 5. Catalog Controls (View Switcher: Grid vs List + Sort Select) */
.catalog-kz-header,
.section-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.catalog-controls-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-switcher-toggle {
  display: inline-flex;
  background: rgba(241, 245, 249, 0.95);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-btn svg {
  width: 16px;
  height: 16px;
}

.view-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.catalog-sort-select {
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.catalog-sort-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* 6. Catalog List Mode (.home-products-grid.mode-list) */
.home-products-grid.mode-list {
  grid-template-columns: 1fr !important;
  gap: 10px;
}

.home-products-grid.mode-list .home-product-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 12px 18px;
  gap: 16px;
}

.home-products-grid.mode-list .home-card-header {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  position: static;
  background: transparent;
  padding: 0;
}

.home-products-grid.mode-list .home-product-thumb {
  height: 64px;
  width: 64px;
  object-fit: contain;
}

.home-products-grid.mode-list .home-card-score {
  position: static;
  margin-left: auto;
  flex-shrink: 0;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.home-products-grid.mode-list .home-card-body {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 7. Sticky Quick-Navigation Pill Bar for Product View */
.product-quick-nav {
  position: sticky;
  top: 64px;
  z-index: 30;
  background: rgba(255, 255, 255, 0.97) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin: -10px -16px 16px -16px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.quick-nav-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick-nav-track::-webkit-scrollbar {
  display: none;
}

.quick-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(241, 245, 249, 0.85);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.quick-nav-pill svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.quick-nav-pill:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.quick-nav-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

/* 8. Tinted Icon Containers for Card Headers */
.card-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-header-icon svg {
  width: 22px;
  height: 22px;
}

.card-header-icon.icon-teal { background: #f0fdfa; color: #0d9488; border: 1px solid #99f6e4; }
.card-header-icon.icon-emerald { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.card-header-icon.icon-green { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.card-header-icon.icon-amber { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.card-header-icon.icon-rose { background: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }
.card-header-icon.icon-indigo { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }
.card-header-icon.icon-cyan { background: #ecfeff; color: #0891b2; border: 1px solid #a5f3fc; }
.card-header-icon.icon-gold { background: #fefce8; color: #ca8a04; border: 1px solid #fef08a; }

.section-icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f0fdfa;
  color: #0d9488;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}

.section-icon-badge svg {
  width: 16px;
  height: 16px;
}

.trust-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trust-icon-box svg {
  width: 22px;
  height: 22px;
}

.trust-icon-box.icon-teal { background: #f0fdfa; color: #0d9488; border: 1px solid #99f6e4; }
.trust-icon-box.icon-green { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.trust-icon-box.icon-rose { background: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }
.trust-icon-box.icon-indigo { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }

.step-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.step-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f0fdfa;
  color: #0d9488;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon-wrap svg {
  width: 18px;
  height: 18px;
}

/* 9. Laser Scanner Animation in Camera Viewfinder */
.laser-line {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #14b8a6, #2dd4bf, transparent);
  box-shadow: 0 0 16px #14b8a6, 0 0 8px #2dd4bf;
  animation: laserScan 2.4s ease-in-out infinite alternate;
  z-index: 10;
  border-radius: 3px;
}

@keyframes laserScan {
  0% { top: 12%; opacity: 0.9; }
  100% { top: 88%; opacity: 0.9; }
}

/* 10. Card Hover & Micro-interactions */
.home-product-card {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.28s;
  cursor: pointer;
}

.home-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -8px rgba(13, 148, 136, 0.18), 0 0 0 1px rgba(13, 148, 136, 0.35);
}

.home-product-card:active {
  transform: scale(0.98);
}

.chip-btn,
.btn {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chip-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.chip-btn:active,
.btn:active {
  transform: scale(0.97);
}

/* Smooth radial score circle animation */
.score-circle-fg {
  transition: stroke-dashoffset 1.2s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.4s ease;
}

/* ==========================================================================
   Dark Theme Design System
   Matches User's Custom Dark Botanical Pattern (assets/images/bg-pattern-dark.jpg)
   ========================================================================== */
[data-theme="dark"] {
  --primary: #14b8a6;
  --primary-hover: #2dd4bf;
  --primary-light: rgba(20, 184, 166, 0.16);
  --primary-border: rgba(45, 212, 191, 0.35);
  --primary-gradient: linear-gradient(135deg, #0d9488 0%, #059669 100%);
  
  --secondary: #f8fafc;
  --secondary-hover: #e2e8f0;
  
  --kz-gold: #fbbf24;
  --kz-blue: #38bdf8;

  --bg-page: #0b1610;
  --bg-card: rgba(18, 30, 24, 0.95);
  --bg-muted: #14241c;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-inverse: #0b1610;
  
  --border-color: rgba(255, 255, 255, 0.12);
  --border-focus: #14b8a6;

  --color-low-bg: rgba(16, 185, 129, 0.16);
  --color-low-text: #6ee7b7;
  --color-low-border: rgba(110, 231, 183, 0.3);
  
  --color-mod-bg: rgba(245, 158, 11, 0.16);
  --color-mod-text: #fde047;
  --color-mod-border: rgba(253, 224, 71, 0.3);
  
  --color-high-bg: rgba(239, 68, 68, 0.18);
  --color-high-text: #fca5a5;
  --color-high-border: rgba(252, 165, 165, 0.3);
  
  --color-neutral-bg: rgba(255, 255, 255, 0.08);
  --color-neutral-text: #cbd5e1;
  --color-neutral-border: rgba(255, 255, 255, 0.14);

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] body,
body[data-theme="dark"] {
  background-color: #0b1610 !important;
  background-image: 
    linear-gradient(180deg, rgba(11, 22, 16, 0.85) 0%, rgba(9, 18, 14, 0.90) 100%),
    url('assets/images/bg-pattern-dark.jpg') !important;
  background-repeat: repeat !important;
  background-position: center top !important;
  background-size: auto, 480px 853px !important;
  background-attachment: fixed !important;
  color: #f8fafc !important;
}

/* Dark Mode Ambient Orbs */
[data-theme="dark"] .orb-1 {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, rgba(13, 148, 136, 0) 70%) !important;
}
[data-theme="dark"] .orb-2 {
  background: radial-gradient(circle, rgba(20, 184, 166, 0.14) 0%, rgba(5, 150, 105, 0) 70%) !important;
}
[data-theme="dark"] .orb-3 {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.10) 0%, rgba(180, 83, 9, 0) 70%) !important;
}
[data-theme="dark"] .ambient-grid-pattern {
  opacity: 0.12 !important;
}

/* Dark Mode App Header & Navigation */
[data-theme="dark"] .app-header {
  background: rgba(14, 25, 19, 0.94) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .brand-title {
  color: #f8fafc !important;
}

[data-theme="dark"] .brand-sub {
  color: #94a3b8 !important;
}

[data-theme="dark"] .product-quick-nav {
  background: rgba(14, 25, 19, 0.96) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .quick-nav-pill {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

[data-theme="dark"] .quick-nav-pill:hover {
  background: rgba(20, 184, 166, 0.18) !important;
  border-color: rgba(20, 184, 166, 0.35) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .quick-nav-pill.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

/* Dark Mode Cards (Elevated, Sleek Deep Forest / Slate Tone) */
[data-theme="dark"] .hero-card,
[data-theme="dark"] .search-card,
[data-theme="dark"] .info-card,
[data-theme="dark"] .history-card,
[data-theme="dark"] .how-it-works-card,
[data-theme="dark"] .trust-principles-card,
[data-theme="dark"] .home-categories-section,
[data-theme="dark"] .product-hero-card,
[data-theme="dark"] .search-results-section,
[data-theme="dark"] .home-product-card {
  background: rgba(18, 30, 24, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(52, 211, 153, 0.18) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
  color: #f8fafc !important;
}

[data-theme="dark"] .home-product-card:hover {
  transform: translateY(-4px) !important;
  border-color: rgba(45, 212, 191, 0.45) !important;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.65), 0 0 24px rgba(20, 184, 166, 0.22) !important;
}

[data-theme="dark"] .info-card:hover {
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.6), 0 0 20px rgba(20, 184, 166, 0.18) !important;
  border-color: rgba(45, 212, 191, 0.35) !important;
}

/* Product Card Thumbnail Header in Dark Mode */
[data-theme="dark"] .home-card-header,
[data-theme="dark"] .home-product-thumb-wrap,
[data-theme="dark"] .product-image-container {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Dark Mode Typography in Cards */
[data-theme="dark"] .home-card-title,
[data-theme="dark"] .product-title,
[data-theme="dark"] .card-title,
[data-theme="dark"] .hero-title,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4 {
  color: #f8fafc !important;
}

[data-theme="dark"] .hero-subtitle,
[data-theme="dark"] .card-desc,
[data-theme="dark"] .section-desc,
[data-theme="dark"] .product-brand {
  color: #94a3b8 !important;
}

[data-theme="dark"] .home-card-meta {
  color: #94a3b8 !important;
}

[data-theme="dark"] .home-card-brand {
  color: #94a3b8 !important;
}

/* Dark Mode Inputs, Dropdowns and Filters */
[data-theme="dark"] .search-input,
[data-theme="dark"] .form-input,
[data-theme="dark"] .catalog-sort-select,
[data-theme="dark"] .lang-select,
[data-theme="dark"] textarea {
  background: rgba(14, 25, 19, 0.95) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

[data-theme="dark"] .search-input:focus,
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .catalog-sort-select:focus,
[data-theme="dark"] .lang-select:focus,
[data-theme="dark"] textarea:focus {
  border-color: #14b8a6 !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.22) !important;
}

[data-theme="dark"] .search-input::placeholder,
[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #64748b !important;
}

[data-theme="dark"] .currency-tag,
[data-theme="dark"] .lang-switcher-wrapper {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .currency-tag:hover {
  background: rgba(20, 184, 166, 0.18) !important;
  border-color: rgba(20, 184, 166, 0.35) !important;
}

/* Dark Mode Category Pills & Toggle Buttons */
[data-theme="dark"] .category-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .category-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .category-btn.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .view-toggle-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .view-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .view-toggle-btn.active {
  background: rgba(20, 184, 166, 0.22) !important;
  border-color: rgba(20, 184, 166, 0.45) !important;
  color: #2dd4bf !important;
}

/* Dark Mode Badges & Chips */
[data-theme="dark"] .badge-neutral {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

[data-theme="dark"] .barcode-chip {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

[data-theme="dark"] .origin-badge {
  background: rgba(2, 132, 199, 0.2) !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}

[data-theme="dark"] .chip-btn {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .chip-btn:hover {
  background: rgba(20, 184, 166, 0.16) !important;
  border-color: rgba(20, 184, 166, 0.35) !important;
  color: #ffffff !important;
}

/* Dark Mode Nutritional Breakdown & Comparison */
[data-theme="dark"] .nutrition-row {
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .nutrition-row:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .trust-table th,
[data-theme="dark"] .trust-table td {
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .trust-table tr:hover td {
  background: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .factor-card {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .alternative-card {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .alternative-card:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: var(--primary) !important;
}

[data-theme="dark"] .empty-state-card {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .step-card {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .step-icon-wrap {
  background: rgba(20, 184, 166, 0.18) !important;
  color: #2dd4bf !important;
}

/* Dark Mode Modals */
[data-theme="dark"] .modal-content {
  background: #0f1c16 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(52, 211, 153, 0.25) !important;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.75) !important;
}

[data-theme="dark"] .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(0, 0, 0, 0.25) !important;
}

[data-theme="dark"] .btn-outline {
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .btn-ghost {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .footer {
  background: rgba(10, 18, 14, 0.96) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #94a3b8 !important;
}


