/* ============================================================
   DOPMAN HML — PWA estática completa
   Tema dark idêntico ao app mobile (RN/Expo)
   Sem build Expo — apenas HTML+CSS+JS, servida pelo Nginx
============================================================ */

:root {
  --bg: #0f1419;
  --bg-elev-1: #161c23;
  --bg-elev-2: #1e293b;
  --bg-input: #1e293b;
  --border: #334155;
  --border-soft: #1f2a36;

  --primary: #4ade80;
  --primary-soft: rgba(74, 222, 128, 0.12);
  --primary-soft-2: rgba(74, 222, 128, 0.06);

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-text: #fca5a5;

  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --warn-text: #fcd34d;

  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --ok-text: #4ade80;

  --text: #e6e6e6;
  --text-soft: #94a3b8;
  --text-dim: #64748b;

  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --nav-h: 64px;
  --header-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ==================== reset ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; }

/* ==================== layout ==================== */
#app { display: flex; flex-direction: column; min-height: 100vh; max-width: 720px; margin: 0 auto; }

/* ==================== header ==================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(15, 20, 25, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  height: var(--header-h);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.3px;
}
.app-header .brand img { width: 28px; height: 28px; }
.app-header .brand span { color: var(--primary); }
.app-header .badges { display: flex; align-items: center; gap: 8px; }
.badge-hml {
  background: var(--warn);
  color: #0f1419;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.badge-v {
  background: var(--bg-elev-2);
  color: var(--text-soft);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
}

/* ==================== main + screens ==================== */
main {
  flex: 1;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
}
.screen { display: none; padding: 16px 16px 28px; }
.screen.active { display: block; }

/* ==================== nav ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: rgba(15, 20, 25, 0.96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-soft);
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  max-width: 720px;
  margin: 0 auto;
}
.bottom-nav .nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  position: relative;
  padding: 6px 0;
}
.bottom-nav .nav-btn .nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.2px; }
.bottom-nav .nav-btn .nav-chip {
  position: absolute;
  top: 6px;
  width: 44px;
  height: 32px;
  border-radius: 10px;
  background: var(--primary-soft);
  opacity: 0;
  transition: opacity 0.18s;
}
.bottom-nav .nav-btn.active { color: var(--primary); }
.bottom-nav .nav-btn.active .nav-chip { opacity: 1; }
.bottom-nav .nav-btn.scan-fab {
  position: relative;
}
.bottom-nav .nav-btn.scan-fab .fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #0f1419;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -22px;
  box-shadow: var(--shadow-md);
}

/* ==================== cards ==================== */
.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
}
.card h3 { font-size: 14px; margin-bottom: 10px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }

/* ==================== inputs ==================== */
.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border 0.15s;
}
.input:focus { border-color: var(--primary); }
.search-bar { position: relative; }
.search-bar .input { padding-left: 46px; padding-right: 100px; }
.search-bar .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
.search-bar .action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* ==================== buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #0f1419; }
.btn-primary:hover { background: #22c55e; }
.btn-primary:disabled { background: #475569; color: var(--text-dim); cursor: not-allowed; }
.btn-ghost { background: var(--bg-elev-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-elev-1); }
.btn-danger { background: var(--danger); color: white; }

/* ==================== chips ==================== */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ==================== status pill ==================== */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status.allowed { background: var(--ok-soft); color: var(--ok-text); }
.status.prohibited { background: var(--danger-soft); color: var(--danger-text); }
.status.pending { background: var(--warn-soft); color: var(--warn-text); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ==================== result card ==================== */
.result {
  background: var(--bg-elev-1);
  border-radius: var(--radius-lg);
  padding: 18px;
  border-left: 4px solid var(--primary);
  margin-top: 16px;
}
.result.prohibited { border-left-color: var(--danger); }
.result.pending { border-left-color: var(--warn); }
.result-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.result-title { font-size: 20px; font-weight: 700; }
.result-summary { line-height: 1.5; color: var(--text); margin: 8px 0; }
.result-meta {
  color: var(--text-soft);
  font-size: 13px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
}
.result-meta .result-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}
.result-meta .result-stat:first-child {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.result-meta .result-stat:first-child svg { color: var(--primary); }
.result-ingredients {
  margin-top: 12px;
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
}
.ingredient-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}
.ingredient-row:last-child { border-bottom: 0; }
.ingredient-row .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill-mini {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-elev-2);
  color: var(--text-soft);
  text-transform: uppercase;
}

/* ==================== sections ==================== */
.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-soft);
  margin: 22px 4px 10px;
  font-weight: 700;
}

/* ==================== loading ==================== */
.loading { text-align: center; color: var(--text-soft); padding: 24px; }
.spinner {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== error / toast ==================== */
.error {
  background: var(--danger-soft);
  border-left: 4px solid var(--danger);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--danger-text);
  margin-top: 12px;
  font-size: 14px;
}
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elev-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: toastIn 0.2s ease;
  pointer-events: auto;
  max-width: 90vw;
}
.toast.success { border-left: 4px solid var(--primary); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== history list ==================== */
.history-item {
  background: var(--bg-elev-1);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.history-item:hover { border-color: var(--border); }
.history-item .hi-query { font-weight: 600; }
.history-item .hi-meta { font-size: 11px; color: var(--text-soft); margin-top: 4px; }

/* ==================== news / feed ==================== */
.news-card {
  background: var(--bg-elev-1);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border-soft);
  margin-bottom: 10px;
}
.news-card .news-cat {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 4px;
}
.news-card .news-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.news-card .news-meta { font-size: 11px; color: var(--text-soft); }

/* ==================== trust bar ==================== */
.trust {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.trust .t {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}
.trust .t-icon { color: var(--primary); margin-bottom: 6px; }
.trust .t-title { font-size: 12px; font-weight: 700; }
.trust .t-sub { font-size: 11px; color: var(--text-soft); margin-top: 4px; }

/* ==================== profile ==================== */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
}
.profile-header .avatar {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #22c55e);
  display: flex; align-items: center; justify-content: center;
  color: #0f1419;
  font-size: 32px; font-weight: 800;
  margin-bottom: 12px;
}
.profile-header .name { font-size: 18px; font-weight: 700; }
.profile-header .role { color: var(--text-soft); font-size: 13px; margin-top: 4px; }
.profile-section .row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.profile-section .row:last-child { border-bottom: 0; }
.profile-section .row .label { color: var(--text-soft); font-size: 14px; }
.profile-section .row .value { font-weight: 600; font-size: 14px; }

/* ==================== empty state ==================== */
.empty {
  text-align: center;
  color: var(--text-soft);
  padding: 60px 24px;
}
.empty .icon-lg { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty p { font-size: 14px; }

/* ==================== modal (regulatory / legal) ==================== */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { font-size: 17px; }
.modal-close { background: transparent; border: 0; color: var(--text-soft); font-size: 22px; cursor: pointer; padding: 4px 8px; }
.modal-body { padding: 18px; overflow-y: auto; font-size: 14px; line-height: 1.55; }
.modal-body h4 { margin-top: 14px; margin-bottom: 6px; color: var(--primary); font-size: 14px; }
.modal-body h4:first-child { margin-top: 0; }
.modal-body p { margin-bottom: 10px; color: var(--text-soft); }

/* ==================== skeleton ==================== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elev-1) 0%, var(--bg-elev-2) 50%, var(--bg-elev-1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ==================== utility ==================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-soft { color: var(--text-soft); }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.between { justify-content: space-between; }
.center { align-items: center; }
.full { width: 100%; }
