/* ==========================================================================
   smartFACTS 2D Barcode & Ethics Explorer Stylesheet
   Authentic smartFACTS Consumer UI with GS1 Digital Link Multi-LinkType Grid
   ========================================================================== */

:root {
  --primary-teal: #125169;
  --primary-teal-dark: #0d3c4e;
  --primary-teal-light: #1c7293;
  --teal-surface: #e8f3f7;
  
  --ethics-green: #15803d;
  --ethics-green-bg: #f0fdf4;
  --ethics-border: #bbf7d0;

  --caution-yellow: #b45309;
  --caution-yellow-bg: #fefce8;
  --caution-border: #fef08a;

  --alert-red: #b91c1c;
  --alert-red-bg: #fef2f2;
  --alert-border: #fecaca;

  --gold-star: #f59e0b;
  --star-gray: #cbd5e1;

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-pill: #f1f5f9;
  --bg-pill-hover: #e2e8f0;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-light: #e2e8f0;
  --border-subtle: #f1f5f9;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 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 rgba(18, 81, 105, 0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -3px rgba(18, 81, 105, 0.12), 0 4px 6px -2px rgba(0,0,0,0.05);

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body.dark-mode {
  --bg-page: #0b1320;
  --bg-card: #152238;
  --bg-pill: #1e2e4a;
  --bg-pill-hover: #283c5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --border-light: #2d3f5e;
  --border-subtle: #1e293b;

  --teal-surface: #132838;
  --star-gray: #475569;
}

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

html, body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   APP CONTAINER & LAYOUT
   ========================================================================== */

.app-container {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,0.06);
}

/* ==========================================================================
   SMARTFACTS BRAND HEADER
   ========================================================================== */

.smartfacts-header {
  background: linear-gradient(135deg, var(--primary-teal) 0%, var(--primary-teal-light) 100%);
  color: #ffffff;
  padding: 16px 20px 24px 20px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-logo-badge {
  background: rgba(255, 255, 255, 0.2);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  backdrop-filter: blur(4px);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-main {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.brand-facts {
  font-weight: 400;
  opacity: 0.95;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.85;
  letter-spacing: 1px;
  text-transform: lowercase;
}

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

.icon-pill-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-pill-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.history-count {
  background: #ffffff;
  color: var(--primary-teal);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.icon-btn-circle {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn-circle:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ==========================================================================
   APP MAIN & CONTENT CONTAINER
   ========================================================================== */

.app-main {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   STATE 1: SCANNER SECTION
   ========================================================================== */

.scanner-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.scan-hero-card {
  background: var(--bg-card);
  padding: 16px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.hero-tag-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.hero-pill-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--teal-surface);
  color: var(--primary-teal);
}

.hero-pill-tag.tag-ethics {
  background: var(--ethics-green-bg);
  color: var(--ethics-green);
  border: 1px solid var(--ethics-border);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

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

/* Camera Viewport */
.viewport-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.viewport-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 340px;
  margin: 0 auto;
  background: transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  border: 2px solid var(--primary-teal);
  cursor: pointer;
}

#native-video,
#reader,
#reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  background: transparent;
}

#reader__scan_region {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  border: none !important;
}

#reader__header_message,
#reader__dashboard,
#reader__camera_selection,
#html5-qrcode-button-torch,
button[id*="torch"],
div[id*="torch"],
[class*="torch"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.scanner-standby {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--primary-teal);
  background: var(--teal-surface);
  gap: 12px;
  cursor: pointer;
  z-index: 1;
  transition: opacity 0.25s ease;
}

.scanner-standby.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.standby-pulse-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-teal);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  animation: pulse 2.2s ease-in-out infinite;
}

.standby-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-teal);
  letter-spacing: 0.2px;
}

.scanner-reticle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.scanner-reticle.inactive {
  display: none;
}
  display: none;
}

.reticle-box {
  width: 220px;
  height: 220px;
  position: relative;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.45);
  border-radius: 12px;
}

.corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: #38bdf8;
  border-style: solid;
}

.c-top-left { top: 0; left: 0; border-width: 3.5px 0 0 3.5px; border-top-left-radius: 8px; }
.c-top-right { top: 0; right: 0; border-width: 3.5px 3.5px 0 0; border-top-right-radius: 8px; }
.c-bottom-left { bottom: 0; left: 0; border-width: 0 0 3.5px 3.5px; border-bottom-left-radius: 8px; }
.c-bottom-right { bottom: 0; right: 0; border-width: 0 3.5px 3.5px 0; border-bottom-right-radius: 8px; }

.laser-beam {
  position: absolute;
  top: 0;
  left: 5%;
  width: 90%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, transparent);
  animation: scanLaser 2s ease-in-out infinite alternate;
}

.reticle-tip {
  margin-top: 18px;
  font-size: 0.8rem;
  color: #ffffff;
  background: rgba(0,0,0,0.65);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.viewport-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--primary-teal);
  color: #ffffff;
}

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

.btn-secondary {
  background-color: var(--bg-pill);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

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

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* Manual Lookup Accordion */
.manual-input-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.accordion-toggle-btn {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.accordion-body {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-page);
}

.quick-samples-group {
  margin-bottom: 12px;
}

.samples-heading {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.samples-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sample-chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sample-chip-btn:hover {
  background: var(--teal-surface);
  border-color: var(--primary-teal);
  color: var(--primary-teal);
}

.manual-search-box {
  display: flex;
  gap: 8px;
}

.manual-search-box input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  font-family: var(--font-body);
}

/* ==========================================================================
   STATE 2: SMARTFACTS RESULTS SECTION (Post-Scan UI)
   ========================================================================== */

.smartfacts-results-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Top Return Action Bar */
.results-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.btn-return-scanner {
  background: var(--primary-teal);
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(18, 81, 105, 0.2);
  transition: all 0.2s ease;
}

.btn-return-scanner:hover {
  background: var(--primary-teal-dark);
}

.results-actions-right {
  display: flex;
  gap: 6px;
}

.action-circle-btn {
  background: var(--bg-pill);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-circle-btn:hover {
  background: var(--bg-pill-hover);
}

.action-circle-btn.btn-settings-highlight {
  background: var(--teal-surface);
  color: var(--primary-teal);
  border-color: var(--primary-teal);
}

.action-circle-btn.btn-settings-highlight:hover {
  background: var(--primary-teal);
  color: #ffffff;
}

/* SmartFacts Hero Product Card */
.smartfacts-hero-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: 14px;
  align-items: center;
}

.product-visual-col {
  flex-shrink: 0;
}

.product-img-frame {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
}

.product-img-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-details-col {
  flex: 1;
  min-width: 0;
}

.product-brand-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-teal);
  background: var(--teal-surface);
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.product-hero-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-hero-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 6px;
}

.product-rating-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}

.stars-visual {
  color: var(--gold-star);
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.review-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.product-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.meta-pill {
  font-size: 0.68rem;
  font-family: monospace;
  background: var(--bg-pill);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.meta-pill.pill-host {
  color: var(--primary-teal);
  font-weight: 600;
}

/* Dietary & Values Compatibility Banner */
.dietary-match-banner {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

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

.banner-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-link-xs {
  background: none;
  border: none;
  color: var(--primary-teal);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.dietary-badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diet-pill-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

.diet-pill-badge.pass {
  background: var(--ethics-green-bg);
  color: var(--ethics-green);
  border: 1px solid var(--ethics-border);
}

.diet-pill-badge.caution {
  background: var(--caution-yellow-bg);
  color: var(--caution-yellow);
  border: 1px solid var(--caution-border);
}

.diet-pill-badge.fail {
  background: var(--alert-red-bg);
  color: var(--alert-red);
  border: 1px solid var(--alert-border);
}

/* Ethics Spotlight Card */
.smartfacts-ethics-spotlight {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1.5px solid #86efac;
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.spotlight-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.spotlight-icon {
  font-size: 1.5rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #dcfce7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotlight-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #166534;
  letter-spacing: 0.5px;
}

.spotlight-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #14532d;
  line-height: 1.2;
}

.spotlight-body {
  font-size: 0.82rem;
  color: #166534;
  margin-bottom: 10px;
  line-height: 1.4;
}

.spotlight-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #166534;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.spotlight-link-btn:hover {
  background: #14532d;
}

/* SmartFacts 2-Column Pill Button Grid */
.smartfacts-grid-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

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

.grid-section-header h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.services-count {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--bg-pill);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.smartfacts-pills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* The Authentic smartFACTS Pill Button */
.smartfacts-pill {
  background: var(--bg-pill);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 58px;
  position: relative;
  overflow: hidden;
}

.smartfacts-pill:hover {
  background: var(--bg-pill-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.smartfacts-pill.highlighted {
  border-color: #38bdf8;
  background: #f0f9ff;
}

body.dark-mode .smartfacts-pill.highlighted {
  background: #0c2338;
}

.pill-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

body.dark-mode .pill-icon-circle {
  background: #152238;
}

.pill-text-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pill-label {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
}

.pill-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* AI Breakdown */
.ai-breakdown-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border-light);
}

.ai-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ai-chips-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-chip {
  background: var(--bg-pill);
  border: 1px solid var(--border-light);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: monospace;
}

.ai-chip strong {
  color: var(--primary-teal);
}

/* Diagnostics Accordion */
.diagnostics-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.diagnostics-toggle-btn {
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.diagnostics-content {
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg-page);
}

.diag-entry {
  padding: 3px 0;
  border-bottom: 1px dashed var(--border-light);
}

.diag-entry.ok { color: var(--ethics-green); }
.diag-entry.miss { color: var(--text-muted); }

/* Bottom Sticky Scan Bar */
.bottom-scan-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg-page);
  padding: 10px 0;
  z-index: 90;
  border-top: 1px solid var(--border-light);
}

.btn-block-scan {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   MODALS & DRAWERS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 0;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 540px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
}

.modal-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 540px) {
  .modal-card {
    border-radius: var(--radius-lg);
  }
}

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

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon-badge {
  font-size: 1.2rem;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: var(--bg-pill);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

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

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  background: var(--bg-page);
}

/* Ingredients Drawer Specifics */
.dietary-status-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
}

.dietary-status-box.pass {
  background: var(--ethics-green-bg);
  color: var(--ethics-green);
  border: 1px solid var(--ethics-border);
}

.dietary-status-box.caution {
  background: var(--caution-yellow-bg);
  color: var(--caution-yellow);
  border: 1px solid var(--caution-border);
}

.dietary-status-box.fail {
  background: var(--alert-red-bg);
  color: var(--alert-red);
  border: 1px solid var(--alert-border);
}

.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ingredients-tokens-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ingredient-token-pill {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: var(--bg-pill);
  border: 1px solid var(--border-light);
  color: var(--text-main);
}

.ingredient-token-pill.non-vegan {
  background: var(--alert-red-bg);
  border-color: var(--alert-border);
  color: var(--alert-red);
  font-weight: 600;
}

.ingredient-token-pill.gluten {
  background: var(--caution-yellow-bg);
  border-color: var(--caution-border);
  color: var(--caution-yellow);
  font-weight: 600;
}

.ingredient-token-pill.palm {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
  font-weight: 600;
}

.detected-substances-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.violation-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--alert-red-bg);
  border: 1px solid var(--alert-border);
  font-size: 0.82rem;
  color: var(--alert-red);
}

.violation-card strong {
  display: block;
  font-size: 0.86rem;
}

/* Allergens Matrix */
.allergens-matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.allergen-matrix-card {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-pill);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.allergen-matrix-card.contains {
  background: var(--alert-red-bg);
  border-color: var(--alert-border);
  color: var(--alert-red);
  font-weight: 700;
}

.allergen-matrix-card.free-from {
  background: var(--ethics-green-bg);
  border-color: var(--ethics-border);
  color: var(--ethics-green);
}

/* Filter Preferences Modal */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary-teal);
  letter-spacing: 0.5px;
}

.pref-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-pill);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.pref-checkbox-row input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary-teal);
}

.pref-label-col {
  display: flex;
  flex-direction: column;
}

.pref-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
}

.pref-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Install Guide */
.install-platform-box {
  background: var(--bg-pill);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.platform-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-teal);
  margin-bottom: 4px;
}

/* Toast */
.toast-popup {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  animation: fadeIn 0.2s ease;
}

/* Footer */
.smartfacts-footer {
  padding: 16px 20px 24px 20px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

/* Utility */
.hidden {
  display: none !important;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

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

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

@keyframes scanLaser {
  0% { top: 10%; opacity: 0.4; }
  50% { opacity: 1; }
  100% { top: 90%; opacity: 0.4; }
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}
