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

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(23, 33, 56, 0.75);
  --bg-card-hover: rgba(30, 43, 72, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.25);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.25);
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
  
  --font-main: 'Plus Jakarta Sans', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-main);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 40%);
}

.app-container {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  padding-bottom: 85px;
}

/* Header & Top Bar */
.app-header {
  padding: 18px 20px;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 15px var(--accent-emerald-glow);
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.lang-selector {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.lang-selector:focus {
  border-color: var(--border-focus);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Action Hero / Search Area */
.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-subtle);
}

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

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 42px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: all 0.25s ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.scan-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-scan {
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-scan-camera {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 14px var(--accent-emerald-glow);
}

.btn-scan-camera:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-scan-demo {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-scan-demo:hover {
  background: var(--bg-card-hover);
}

/* User Allergy Badges Quick Bar */
.allergy-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.allergy-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.allergy-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.allergy-chips-scroll::-webkit-scrollbar { display: none; }

.allergy-chip {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.allergy-chip.active {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--accent-rose);
  color: #fda4af;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.2);
}

.toggle-chip {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-chip.active-halal {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  color: #6ee7b7;
}

.toggle-chip.active-vegan {
  background: rgba(16, 185, 129, 0.15);
  border-color: #34d399;
  color: #a7f3d0;
}

/* Result Container */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.3s ease;
}

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

.product-hero {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: #1e293b;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-badge-floating {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.badge-safe {
  background: rgba(16, 185, 129, 0.9);
  color: white;
  box-shadow: 0 0 15px var(--accent-emerald-glow);
}

.badge-caution {
  background: rgba(245, 158, 11, 0.9);
  color: white;
  box-shadow: 0 0 15px var(--accent-amber-glow);
}

.badge-danger {
  background: rgba(244, 63, 94, 0.9);
  color: white;
  box-shadow: 0 0 15px var(--accent-rose-glow);
}

.haccp-badge {
  position: absolute;
  bottom: 12px;
  left: 14px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
}

.product-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-title-row h2 {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.product-title-row p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Indicators Matrix */
.indicators-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.indicator-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.indicator-box.danger-box {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.08);
}

.indicator-box.safe-box {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.indicator-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.indicator-value {
  font-size: 13px;
  font-weight: 700;
}

/* Detected Allergens Area */
.allergen-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.allergen-tag {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid var(--accent-rose);
  color: #fda4af;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.no-allergen-tag {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
  color: #6ee7b7;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

/* Ingredients Section */
.ingredients-accordion {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.ingredients-accordion strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 6px;
}

/* SOS Card Modal / Card Design */
.sos-card-container {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  border: 2px solid #e11d48;
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #881337;
  box-shadow: 0 10px 30px rgba(225, 29, 72, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.sos-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px dashed rgba(225, 29, 72, 0.3);
  padding-bottom: 10px;
}

.sos-card-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #be123c;
}

.sos-korean-text {
  background: white;
  border: 1px solid #fecdd3;
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
  color: #1e293b;
  white-space: pre-line;
}

/* Restaurants List */
.restaurant-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.restaurant-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.rest-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.rest-title {
  font-size: 15px;
  font-weight: 700;
}

.rest-type-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
  color: #34d399;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.rest-details {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coupon-box {
  background: rgba(56, 189, 248, 0.1);
  border: 1px dashed #38bdf8;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #7dd3fc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Bottom Tab Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 520px;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 10px 0;
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-item.active {
  color: #38bdf8;
}

.nav-icon {
  font-size: 20px;
}

/* PRO Banner */
.pro-banner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.15);
}

.pro-banner-text h4 {
  font-size: 14px;
  font-weight: 800;
  color: #c084fc;
}

.pro-banner-text p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.btn-pro {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
}
