/* IndoVision AI - Indomie Computer Vision Styling */

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

:root {
  --bg-primary: #0a0c10;
  --bg-surface: #121620;
  --bg-card: rgba(22, 28, 42, 0.75);
  --bg-card-hover: rgba(30, 39, 58, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 183, 3, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --brand-yellow: #ffb703;
  --brand-yellow-glow: rgba(255, 183, 3, 0.25);
  --brand-red: #e63946;
  --brand-red-glow: rgba(230, 57, 70, 0.3);
  --brand-green: #2a9d8f;
  --brand-orange: #f4a261;
  --brand-purple: #9d4edd;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-main: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(255, 183, 3, 0.15);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(255, 183, 3, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(230, 57, 70, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(42, 157, 143, 0.04) 0%, transparent 60%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem 1.5rem;
}

/* --- NAVBAR / HEADER --- */
.header {
  backdrop-filter: blur(16px);
  background: rgba(10, 12, 16, 0.8);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
  margin-bottom: 2rem;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--brand-yellow), var(--brand-red));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px rgba(255, 183, 3, 0.3);
}

.logo-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff 0%, var(--brand-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.model-badge {
  background: rgba(255, 183, 3, 0.1);
  border: 1px solid rgba(255, 183, 3, 0.25);
  color: var(--brand-yellow);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.model-badge .status-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite;
}

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

/* --- HERO SECTION --- */
.hero {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 2.5rem auto;
}

.hero h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.hero h1 span {
  color: var(--brand-yellow);
  position: relative;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* --- MAIN LAYOUT GRID --- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 992px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* --- SCANNER CARD --- */
.scanner-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-main);
}

.card-header-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(10, 12, 16, 0.6);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--brand-yellow), #e0a000);
  color: #0d1117;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255, 183, 3, 0.3);
}

/* VIEWPORT CONTENT AREAS */
.viewport-area {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #05070a;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}

.viewport-area.active-feed {
  border-style: solid;
  border-color: var(--brand-yellow);
  box-shadow: var(--shadow-glow);
}

/* WEBCAM FEED */
#webcam-container {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#webcam-container canvas, #webcam-container video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.webcam-overlay {
  position: absolute;
  inset: 15px;
  border: 2px dashed rgba(255, 183, 3, 0.6);
  border-radius: var(--radius-sm);
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
}

.webcam-overlay::before {
  content: 'SESUAIKAN BUNGKUS DALAM KOTAK';
  background: rgba(0, 0, 0, 0.7);
  color: var(--brand-yellow);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

/* UPLOAD AREA */
.upload-zone {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  transition: transform 0.3s ease;
}

.upload-zone:hover .upload-icon {
  transform: translateY(-5px) scale(1.1);
}

.upload-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

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

#file-input {
  display: none;
}

#preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
}

/* CONTROLS BAR */
.scanner-controls {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.75rem;
}

.btn-primary, .btn-secondary {
  flex: 1;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-yellow), #e0a000);
  color: #0d1117;
  box-shadow: 0 4px 15px rgba(255, 183, 3, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 183, 3, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--brand-yellow);
}

/* PRESET SAMPLES BAR */
.preset-samples-section {
  margin-top: 1.5rem;
}

.preset-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.3rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.preset-chip:hover {
  background: rgba(255, 183, 3, 0.15);
  border-color: var(--brand-yellow);
  transform: translateY(-2px);
}

.preset-chip img, .preset-chip .preset-icon {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  margin: 0 auto 0.25rem auto;
  display: block;
}

.preset-chip span {
  font-size: 0.7rem;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.preset-chip:hover span {
  color: var(--brand-yellow);
}

/* AI CONFIDENCE MONITOR BAR */
.confidence-box {
  margin-top: 1.25rem;
  background: rgba(10, 12, 16, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem;
}

.confidence-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.confidence-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-yellow), var(--brand-red));
  border-radius: 20px;
  transition: width 0.4s ease;
}

/* --- RESULT CARD --- */
.result-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-main);
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s ease;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-yellow), var(--brand-red));
}

.result-placeholder {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.result-placeholder-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.6;
  animation: float 3s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.result-content {
  display: none;
}

.result-content.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* PRODUCT HEADER IN RESULT CARD */
.product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.product-title-group h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.product-variant-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 183, 3, 0.12);
  color: var(--brand-yellow);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 183, 3, 0.25);
}

.audio-speech-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--brand-yellow);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.audio-speech-btn:hover {
  background: var(--brand-yellow);
  color: #0d1117;
  transform: scale(1.1);
}

.audio-speech-btn.speaking {
  animation: pulse-ring 1s infinite;
  background: var(--brand-red);
  color: white;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(230, 57, 70, 0); }
  100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0); }
}

/* METRICS GRID & SECTIONS */
.info-section {
  margin-bottom: 1.5rem;
}

.info-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* SPICY METER 🌶️ */
.spicy-container {
  background: rgba(10, 12, 16, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.spicy-meter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.chili-icon {
  font-size: 1.4rem;
  opacity: 0.25;
  filter: grayscale(1);
  transition: all 0.3s ease;
}

.chili-icon.active {
  opacity: 1;
  filter: grayscale(0) drop-shadow(0 0 8px rgba(230, 57, 70, 0.6));
  transform: scale(1.15);
}

.spicy-score-pill {
  margin-left: auto;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  background: rgba(230, 57, 70, 0.15);
  color: var(--brand-red);
  border: 1px solid rgba(230, 57, 70, 0.3);
}

.spicy-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* CALORIES CARD 🔥 */
.calorie-box {
  background: linear-gradient(135deg, rgba(244, 162, 97, 0.08), rgba(233, 196, 106, 0.05));
  border: 1px solid rgba(244, 162, 97, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.calorie-icon-bg {
  width: 50px;
  height: 50px;
  background: rgba(244, 162, 97, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.calorie-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #f4a261;
}

.calorie-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* TOPPING CHIPS 🥚 */
.topping-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topping-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}

.topping-chip:hover {
  background: rgba(255, 183, 3, 0.15);
  border-color: var(--brand-yellow);
  transform: translateY(-2px);
}

/* RATING BOX ⭐ */
.rating-box {
  background: rgba(10, 12, 16, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.rating-score {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--brand-yellow);
  line-height: 1;
}

.rating-stars {
  color: var(--brand-yellow);
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
}

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

/* BOTTOM ACTION BAR */
.action-bar {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
}

/* --- CATALOG EXPLORER SECTION --- */
.catalog-section {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.catalog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.catalog-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-yellow);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.catalog-card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.catalog-card-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

.catalog-card-variant {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.catalog-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* FOOTER */
.footer {
  margin-top: 4rem;
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--brand-yellow);
  text-decoration: none;
}

/* TOAST NOTIFICATION */
.toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #10b981;
  color: #0d1117;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}
