/* ==========================================================================
   Yomi Premium CSS Style Guide (Glassmorphism & Neon Accents)
   ========================================================================== */

:root {
  /* Colors */
  --bg-dark: #0f172a;
  --bg-darker: #020617;
  --card-glass: rgba(30, 41, 59, 0.45);
  --card-glass-hover: rgba(30, 41, 59, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-focus: rgba(255, 255, 255, 0.2);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #10b981; /* Emerald Green */
  --accent-primary-glow: rgba(16, 185, 129, 0.35);
  
  --accent-alert: #f59e0b; /* Amber */
  --accent-alert-glow: rgba(245, 158, 11, 0.3);
  
  --accent-error: #ef4444; /* Coral Red */
  --accent-error-glow: rgba(239, 68, 68, 0.3);
  
  --accent-info: #3b82f6; /* Electric Blue */
  
  /* Fonts */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Layout */
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 8px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Settings & Scrollbar */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-darker);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Background Animated Gradient Spheres */
.bg-blur-circles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  animation: float 20s infinite ease-in-out alternate;
}

.circle-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-primary);
  top: -100px;
  right: -100px;
  animation-duration: 25s;
}

.circle-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-info);
  bottom: -200px;
  left: -100px;
  animation-duration: 30s;
}

.circle-3 {
  width: 300px;
  height: 300px;
  background: var(--accent-error);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 18s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -50px) scale(1.1); }
  100% { transform: translate(-20px, 30px) scale(0.9); }
}

/* App Container Layout */
.app-container {
  width: 100%;
  max-width: 1200px;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header styling */
.app-header {
  text-align: center;
  margin-bottom: 8px;
}

.logo-area {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  color: var(--accent-primary);
  filter: drop-shadow(0 0 10px var(--accent-primary-glow));
}

.logo-area h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-area h1 .yo {
  color: var(--accent-primary);
  position: relative;
}

.logo-area h1 .mi {
  color: #f8fafc;
  position: relative;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 400;
}

/* Main Grid Layout */
.app-main-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  flex-grow: 1;
}

@media (max-width: 900px) {
  .app-main-grid {
    grid-template-columns: 1fr;
  }
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--card-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

/* Section elements inside left panel */
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .icon {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

/* Interactive Camera Scanner Area */
.scanner-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scanner-view {
  aspect-ratio: 4/3;
  width: 100%;
  border-radius: var(--border-radius-md);
  background: rgba(15, 23, 42, 0.8);
  border: 2px dashed var(--border-glass);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.scanner-view.active {
  border-style: solid;
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-primary-glow);
}

.scanner-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

.scanner-placeholder svg {
  width: 64px;
  height: 64px;
  position: relative;
}

.scanning-line {
  animation: scan 2.5s infinite linear;
}

@keyframes scan {
  0% { transform: translateY(-5px); }
  50% { transform: translateY(15px); }
  100% { transform: translateY(-5px); }
}

.scanner-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.camera-select-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.camera-select-container label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.styled-select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  outline: none;
  width: 100%;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.styled-select:focus {
  border-color: var(--accent-primary);
  background: var(--bg-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #059669);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--border-glass-focus);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* Separator / Divider */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-glass);
}

.divider:not(:empty)::before {
  margin-right: .75em;
}

.divider:not(:empty)::after {
  margin-left: .75em;
}

/* Manual Input Form */
.manual-input-form {
  width: 100%;
}

.input-group {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 6px;
  transition: var(--transition-smooth);
}

.input-group:focus-within {
  border-color: var(--accent-info);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
  background: rgba(15, 23, 42, 0.9);
}

.input-group input {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group button {
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  background: var(--accent-info);
  color: white;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.input-group button:hover {
  background: #2563eb;
  transform: scale(1.02);
}

.input-group button svg {
  width: 18px;
  height: 18px;
}

/* Result States Panels */
.result-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  animation: fadeIn 0.4s ease-out forwards;
}

.result-state.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Empty State Styling */
.empty-illustration svg {
  width: 80px;
  height: 80px;
  color: var(--text-muted);
  margin-bottom: 20px;
  opacity: 0.5;
}

.pulse-slow {
  animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.05); opacity: 0.7; }
  100% { transform: scale(1); opacity: 0.4; }
}

#result-empty h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 8px;
}

#result-empty p {
  color: var(--text-secondary);
  max-width: 320px;
  font-size: 0.95rem;
}

/* Loading state animations */
.skeleton-loader {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.skeleton-title {
  height: 28px;
  width: 60%;
  border-radius: var(--border-radius-sm);
  margin: 0 auto;
}

.skeleton-media {
  height: 140px;
  width: 140px;
  border-radius: var(--border-radius-md);
  margin: 12px auto;
}

.skeleton-text {
  height: 16px;
  width: 90%;
  border-radius: 4px;
  margin: 0 auto;
}

.skeleton-text.short {
  width: 50%;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.skeleton-block {
  height: 80px;
  border-radius: var(--border-radius-md);
}

.animated-bg {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.12) 37%,
    rgba(255, 255, 255, 0.05) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

/* Rejected / Error State Styling */
.alert-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.alert-icon svg {
  width: 40px;
  height: 40px;
  color: white;
}

.error-bg {
  background: var(--accent-error);
  box-shadow: 0 0 20px var(--accent-error-glow);
}

#result-rejected h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: #fda4af;
}

#result-rejected p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 340px;
  margin-bottom: 24px;
}

.rejected-details {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--border-radius-md);
  padding: 20px;
  width: 100%;
  max-width: 400px;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
}

.detail-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.detail-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Success State (Product details) Styling */
#result-success {
  width: 100%;
  text-align: left;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 24px;
  overflow-x: hidden;
}

.product-header {
  display: flex;
  gap: 20px;
  width: 100%;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 20px;
}

@media (max-width: 500px) {
  .product-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.product-image-container {
  width: 96px;
  height: 96px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  background: white;
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.product-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex-grow: 1;
}

.badge {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 500px) {
  .badge {
    align-self: center;
  }
}

.badge-food {
  background: var(--accent-primary-glow);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-offline {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
  margin-left: 6px;
}

.dietary-section {
  width: 100%;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-glass);
}
.dietary-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.dietary-table {
  width: 100%;
}
.dietary-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-glass);
  transition: background 0.2s;
  cursor: pointer;
  user-select: none;
}
.dietary-row:hover {
  background: rgba(255,255,255,0.03);
}
.dietary-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.dietary-attr {
  font-weight: 500;
  white-space: nowrap;
  font-size: 0.78rem;
}
.dietary-status {
  font-weight: 600;
  font-size: 0.78rem;
  cursor: help;
}
.dietary-chevron {
  font-size: 0.55rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  margin-left: 8px;
  flex-shrink: 0;
}
.dietary-row.open .dietary-chevron {
  transform: rotate(180deg);
}
.dietary-detail {
  width: 100%;
  padding: 8px 0 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 8px;
}
.dietary-detail strong {
  color: var(--text-primary);
  font-weight: 600;
}
.dietary-status.db-yes { color: #6ee7b7; }
.dietary-status.ai-yes { color: #fde047; }
.dietary-status.ai-no  { color: #fdba74; }
.dietary-status.db-no  { color: #fca5a5; }
.dietary-status.unknown { color: #9ca3af; filter: grayscale(1); }



.fallback-nutrition-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--border-radius-md);
  color: #fcd34d;
}

#product-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.brand-text {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
}

.barcode-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: monospace;
}

.data-source-info {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Analysis Cards Grid */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

@media (max-width: 550px) {
  .analysis-grid {
    grid-template-columns: 1fr;
  }
}

.analysis-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: var(--transition-smooth);
}

.analysis-card.full-width {
  grid-column: span 2;
}

@media (max-width: 550px) {
  .analysis-card.full-width {
    grid-column: span 1;
  }
}

.analysis-card:hover {
  border-color: var(--border-glass-focus);
  background: rgba(15, 23, 42, 0.7);
}

.card-icon-wrapper {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-sm);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.card-icon {
  width: 24px;
  height: 24px;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.card-details h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.status-value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}


/* Calories Indicator */
.calories-low {
  color: #3b82f6; /* Blue */
}
.calories-mod {
  color: #f59e0b; /* Amber */
}
.calories-high {
  color: #ef4444; /* Red */
}

/* Sugars Indicator */
.sugars-low {
  color: #3b82f6; /* Blue */
}
.sugars-mod {
  color: #f59e0b; /* Amber */
}
.sugars-high {
  color: #ef4444; /* Red */
}

#sugars-val, #proteins-val {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

#calories-val .number {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

#calories-val .unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.level-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Allergen tags styling */
.allergens-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.allergen-tag {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: scaleIn 0.3s ease-out forwards;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.allergen-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.allergen-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: var(--border-radius-sm);
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.15);
  transition: all 0.2s ease;
}
.allergen-grid-item .emoji {
  font-size: 1.6rem;
  line-height: 1;
}
.allergen-grid-item .label {
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.1;
}
.allergen-grid-item.safe {
  color: #64748b;
  border-color: rgba(100, 116, 139, 0.2);
}
.allergen-grid-item.safe .emoji {
  filter: grayscale(1);
  opacity: 0.5;
}
.allergen-grid-item.safe .label {
  color: #64748b;
}
.allergen-grid-item.detected {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
}
.allergen-grid-item.detected .label {
  color: #fca5a5;
}
.allergen-grid-item.traces {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.12);
}
.allergen-grid-item.traces .label {
  color: #fcd34d;
}

.allergen-legend {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-gray { background: #64748b; }
.dot-red { background: #fca5a5; }
.dot-yellow { background: #fcd34d; }
.dot-purple { background: #a78bfa; }

.allergen-grid-item.ai-suggested {
  color: #c4b5fd;
  border: 1.5px dashed rgba(167, 139, 250, 0.5);
  background: rgba(167, 139, 250, 0.12);
  position: relative;
}
.allergen-grid-item.ai-suggested .label {
  color: #c4b5fd;
}
.allergen-grid-item.ai-suggested .emoji {
  filter: none;
  opacity: 1;
}
.ai-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 0.7rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.allergen-tag.ai-suggested {
  background: rgba(167, 139, 250, 0.15);
  border: 1.5px dashed rgba(167, 139, 250, 0.45);
  color: #c4b5fd;
}

.safe-msg {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.allergen-unknown {
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Nutriscore Styling */
.nutriscore-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.score-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label-heading {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.score-badge {
  background: var(--border-glass);
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.nutriscore-bar {
  display: flex;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  height: 28px;
  align-items: stretch;
}

.ns-score {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.05);
  transition: var(--transition-smooth);
}

.ns-score.a { border-right: 1px solid var(--bg-darker); }
.ns-score.b { border-right: 1px solid var(--bg-darker); }
.ns-score.c { border-right: 1px solid var(--bg-darker); }
.ns-score.d { border-right: 1px solid var(--bg-darker); }

/* Nutri-score standard colors when active */
.ns-score.active[data-score="a"] { background-color: #038141; color: white; box-shadow: 0 0 10px rgba(3, 129, 65, 0.4); }
.ns-score.active[data-score="b"] { background-color: #85bb2f; color: white; box-shadow: 0 0 10px rgba(133, 187, 47, 0.4); }
.ns-score.active[data-score="c"] { background-color: #fecb02; color: white; box-shadow: 0 0 10px rgba(254, 203, 2, 0.4); }
.ns-score.active[data-score="d"] { background-color: #ee8100; color: white; box-shadow: 0 0 10px rgba(238, 129, 0, 0.4); }
.ns-score.active[data-score="e"] { background-color: #e63e11; color: white; box-shadow: 0 0 10px rgba(230, 62, 17, 0.4); }

/* Helper classes */
.hidden {
  display: none !important;
}

/* AI Query Section */
.ai-query-section {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
}
.ai-query-header h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 4px;
}
.ai-query-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

/* DB Disclaimer */
.db-disclaimer {
  margin-top: 0.75rem;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.db-disclaimer p {
  margin: 0;
}

/* Traces (may contain) section */
.traces-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.traces-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.traces-tag {
  background: rgba(255, 200, 0, 0.1);
  border-color: rgba(255, 200, 0, 0.25);
  color: var(--text-secondary);
}

/* Source results table */
.source-table-wrapper {
  margin-top: 0.5rem;
  overflow-x: auto;
}
.source-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}
.source-table th {
  text-align: left;
  padding: 4px 6px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-glass);
}
.source-table td {
  padding: 4px 6px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.source-table .status-yes { color: var(--accent-primary); }
.source-table .status-no { color: var(--text-muted); }

/* Proteins Indicator */
.proteins-low {
  color: var(--text-muted);
}
.proteins-mod {
  color: var(--accent-alert);
}
.proteins-high {
  color: var(--accent-primary);
}

/* No Recomendado Para */
.not-rec-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 8px;
}
.not-rec-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: help;
}
.not-rec-item.certain {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.not-rec-item.possible {
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.35);
}
.not-rec-icon {
  font-size: 1rem;
  line-height: 1;
}
.not-rec-grupo {
  font-weight: 600;
  white-space: nowrap;
}
.not-rec-razon {
  color: var(--text-secondary);
  font-size: 0.75rem;
}
.not-rec-none {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
  padding: 4px 0;
}

/* Health Risks Section */
#card-health-risks { padding: 0 !important; overflow: hidden; }
.health-risks-details { width: 100%; padding: 0; border: none; border-radius: 0; background: transparent; overflow: hidden; }
.health-risks-details summary { cursor: pointer; padding: 14px 18px; font-family: var(--font-display); font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); user-select: none; list-style: none; display: flex; align-items: center; gap: 8px; }
.health-risks-details summary::-webkit-details-marker { display: none; }
.health-risks-details summary::before { content: "▶"; font-size: 0.75rem; color: var(--text-muted); transition: transform 0.2s ease; }
.health-risks-details[open] summary::before { transform: rotate(90deg); }
.health-risks-details summary:hover { background: rgba(255, 255, 255, 0.03); }
.health-risks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px 16px; }
@media (max-width: 550px) { .health-risks-grid { grid-template-columns: 1fr; } }
.health-card { padding: 14px !important; gap: 12px !important; }

/* Collapsible Ingredients Section */
.card-collapsible {
  padding: 0 !important;
  overflow: hidden;
  background: var(--card-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
}

.ingredients-details {
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

.ingredients-details summary {
  cursor: pointer;
  padding: 14px 18px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ingredients-details summary::-webkit-details-marker {
  display: none;
}

.ingredients-details summary::before {
  content: "▶";
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.ingredients-details[open] summary::before {
  transform: rotate(90deg);
}

.ingredients-details summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.ingredients-text {
  padding: 0 18px 14px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Carbohydrates Card */
.carbs-net-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.health-card .status-value { font-size: 1.4rem !important; font-weight: 700 !important; line-height: 1; }
.health-card .level-indicator { font-size: 0.7rem !important; }
.diabetes-risk-alto, .hypertension-risk-alto, .cholesterol-risk-alto, .weight-density-alta { color: #ef4444; }
.diabetes-risk-medio, .hypertension-risk-medio, .cholesterol-risk-medio, .weight-density-media { color: #f59e0b; }
.diabetes-risk-bajo, .hypertension-risk-bajo, .cholesterol-risk-bajo, .weight-density-baja { color: #10b981; }
.diabetes-impact-text, .hypertension-sodium-text, .cholesterol-satfat-text, .weight-detail-text { font-size: 0.8rem; color: var(--text-secondary); margin: 2px 0 0; }
.diabetes-notes-text, .hypertension-notes-text, .cholesterol-notes-text, .weight-notes-text { font-size: 0.7rem; color: var(--text-muted); font-style: italic; margin: 2px 0 0; }
.health-level-high { color: var(--accent-error) !important; }
.health-level-mod { color: var(--accent-alert) !important; }
.health-level-low { color: var(--accent-primary) !important; }
.health-card h4 { font-size: 0.82rem !important; }
.health-card .card-icon-wrapper { padding: 6px !important; }
.health-card .card-icon { width: 18px !important; height: 18px !important; }

.level-indicator.carbs-high { color: var(--accent-error); }
.level-indicator.carbs-mod { color: var(--accent-alert); }
.level-indicator.carbs-low { color: var(--accent-primary); }



/* Confidence card */
.confidence-section {
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.confidence-source-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(148,163,184,0.15);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  margin: 0 4px 4px 0;
}
.confidence-source-found { color: #34d399; }
.confidence-source-miss { color: #64748b; }
.confidence-ai-level {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 20px;
  border: 2px solid currentColor;
}
.confidence-ai-alta { color: #10b981; }
.confidence-ai-media { color: #d97706; }
.confidence-ai-baja { color: #dc2626; }
.confidence-notes-text {
  font-style: italic;
  color: var(--text-muted);
}

/* Mexican Warning Seals (NOM-051) */
.sellos-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 16px 12px;
  justify-content: center;
}

.sello-octagon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  background: #000;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  -webkit-clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  flex-shrink: 0;
}

.sello-octagon .sello-label {
  font-size: 0.5rem;
  letter-spacing: 0.3px;
  opacity: 0.85;
  line-height: 1;
}

.sello-octagon .sello-value {
  font-size: 0.75rem;
  font-weight: 800;
  margin-top: 1px;
  line-height: 1;
}

.sello-octagon .sello-detail {
  font-size: 0.5rem;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 2px;
  line-height: 1;
}

.sello-octagon .sello-threshold {
  font-size: 0.45rem;
  font-weight: 300;
  opacity: 0.5;
  margin-top: 1px;
  line-height: 1;
}

/* Nutrition Table */
.nutrition-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0;
}

.nutrition-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.nutrition-table tbody tr:last-child {
  border-bottom: none;
}

.nutrition-table td {
  padding: 8px 18px;
  color: var(--text-secondary);
}

.nutrition-table td:first-child {
  font-weight: 500;
  color: var(--text-muted);
}

.nutrition-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Footer style */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 16px 0;
  margin-top: auto;
}

.confidence-section.provider-log {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.confidence-section.provider-log .provider-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.confidence-section.provider-log .provider-entry .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.confidence-section.provider-log .provider-entry .status-dot.ok { background: #22c55e; }
.confidence-section.provider-log .provider-entry .status-dot.fail { background: #ef4444; }
.confidence-section.provider-log .provider-entry .provider-name { font-weight: 600; color: var(--text-primary); }

.cache-badge {
  display: inline-block;
  background: #1e293b;
  color: #fbbf24;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.cache-refresh-btn {
  margin-left: 8px;
  background: #1e293b;
  color: #60a5fa;
  border: 1px solid #334155;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 500;
  vertical-align: middle;
}

.cache-refresh-btn:hover { background: #334155; }
.cache-refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Freshness indicators */
.freshness-indicators {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.freshness-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.2s;
}

.freshness-badge.verified {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.freshness-badge.cached {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.freshness-details {
  margin-top: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  font-size: 0.8rem;
  color: #94a3b8;
}

.freshness-details:not(.hidden) {
  display: block;
}

/* OCR Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1001;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #fff;
}

.ocr-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ocr-step.hidden {
  display: none;
}

.ocr-step p {
  margin: 0;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.camera-container {
  position: relative;
}

#ocr-photo-input {
  display: none;
}

#ocr-upload-btn {
  width: 100%;
  padding: 12px 16px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

#ocr-upload-btn:hover {
  background: #2563eb;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

#ocr-progress {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  width: 0%;
  transition: width 0.3s;
}

.ocr-textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #e2e8f0;
  font-family: monospace;
  font-size: 0.9rem;
  resize: vertical;
}

.ocr-textarea:focus {
  outline: none;
  border-color: #3b82f6;
}

.ocr-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-primary {
  padding: 10px 20px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-primary:disabled {
  background: #64748b;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 10px 20px;
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.3);
}

.ocr-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 8px 0 0 0;
}
