:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #d1fae5;
  --gold: #d97706;
  --gold-light: #fef3c7;
  --dark: #0f172a;
  --text-main: #334155;
  --text-muted: #64748b;
  --bg-gradient: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 50%, #ecfdf5 100%);
  --card-bg: rgba(255, 255, 255, 0.88);
  --border: rgba(203, 213, 225, 0.6);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
}

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

body {
  font-family: 'Noto Serif SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 24px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(185, 28, 28, 0.2);
  border: 1.5px solid rgba(185, 28, 28, 0.4);
}

.brand-logo {
  font-size: 32px;
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 11px;
  color: var(--primary-dark);
  display: block;
}

.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.nav-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Main */
.main-content {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
  flex: 1;
  width: 100%;
}

.view-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* Glass Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

/* Search Bar Card */
.search-input-group {
  display: flex;
  gap: 12px;
}

.search-input-group input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input-group input:focus {
  border-color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.quick-samples {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sample-tag {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.sample-tag:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* Result Container */
.verify-badge-banner {
  padding: 16px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.badge-first-scan {
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.badge-repeat-scan {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
}

.verify-badge-banner .banner-icon {
  font-size: 28px;
}

.banner-title {
  font-size: 16px;
  font-weight: 700;
}

.banner-sub {
  font-size: 12px;
  margin-top: 4px;
}

/* Product Info Grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.detail-card h3 {
  font-size: 16px;
  color: var(--dark);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.info-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #f1f5f9;
}

.info-table td:first-child {
  color: var(--text-muted);
  width: 100px;
}

/* Pesticide Table */
.pesticide-box {
  margin-top: 16px;
}

.pesticide-summary-pill {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.pesticide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.pesticide-table th, .pesticide-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.pesticide-table th {
  background: #f8fafc;
  color: var(--text-muted);
}

.tag-pass {
  background: #d1fae5;
  color: #065f46;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* Mini Products Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

.product-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-card h3 {
  font-size: 16px;
  color: var(--dark);
  margin-bottom: 8px;
}

.product-spec {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  margin: 12px 0;
}

/* Loyalty */
.loyalty-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-gold {
  background: var(--gold-light);
  color: #b45309;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 6px;
}

.points-badge {
  text-align: right;
}

.points-num {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  display: block;
  line-height: 1;
}

.points-label {
  font-size: 12px;
  color: var(--text-muted);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.map-badge-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: all 0.2s ease;
}

.map-badge-card.unlocked {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.map-badge-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.map-badge-title {
  font-size: 13px;
  font-weight: 600;
}

/* Admin Radar */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
}

.stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.alert-num {
  color: #dc2626;
}

.stat-title {
  font-size: 11px;
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  max-width: 420px;
  width: 90%;
  position: relative;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.timer-display {
  margin: 24px 0;
}

.timer-number {
  font-size: 64px;
  font-weight: 800;
  color: var(--primary);
  font-family: 'Cinzel', serif;
}

.timer-unit {
  font-size: 18px;
  color: var(--text-muted);
}

.timer-note {
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 20px;
}

.timer-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
