:root {
  /* Paleta OxeTech — azul-elétrico do robô + chrome + couro de cangaceiro */
  --bg: #0a0e1a;            /* navy quase preto */
  --bg-elev: #131826;
  --bg-elev-2: #1c2130;
  --border: #2a3142;
  --text: #f1f5fb;
  --text-dim: #a3b1c6;
  --text-mute: #6b7585;
  --accent: #38bdf8;        /* azul-céu — olhos do robô */
  --accent-2: #0284c7;      /* azul mais profundo — gradiente */
  --accent-glow: rgba(56, 189, 248, 0.45);
  --leather: #a0522d;       /* marrom couro — chapéu de cangaceiro */
  --chrome: #cbd5e1;        /* prata do robô */
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-lg: 0 20px 60px -20px rgba(2, 132, 199, 0.35);
  --shadow-md: 0 6px 24px -8px rgba(0, 0, 0, 0.5);
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

* { box-sizing: border-box; }

/* Garantir que [hidden] vença qualquer regra de display em classes */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}

body { overflow-x: hidden; }

img, video, canvas { max-width: 100%; display: block; }

/* ============================================================
   LAYOUT
   ============================================================ */

.page { min-height: 100dvh; display: flex; flex-direction: column; }

.page--auth {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(56, 189, 248, 0.22), transparent 60%),
    radial-gradient(800px 400px at 100% 100%, rgba(2, 132, 199, 0.18), transparent 70%),
    var(--bg);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.topbar__logo {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(56, 189, 248, 0.4));
}
.topbar__brand-hl { color: var(--accent); }
.topbar__user { display: flex; align-items: center; gap: 10px; }
.topbar__email { font-size: 12px; color: var(--text-dim); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* App container */
.app {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-md);
}

.section__title { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.01em; }
.section__sub { margin: 0 0 14px; color: var(--text-dim); font-size: 13.5px; line-height: 1.45; }

/* ============================================================
   AUTH
   ============================================================ */
.auth {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px calc(48px + var(--safe-bottom));
  gap: 28px;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.brand { text-align: center; }
.brand__logo {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Aura difusa pulsante atras do robo */
.brand__logo::before {
  content: '';
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), rgba(2, 132, 199, 0.18) 45%, transparent 72%);
  filter: blur(8px);
  animation: pulse-glow 3.5s ease-in-out infinite;
  z-index: 0;
}
.brand__logo img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 2px 4px rgba(56, 189, 248, 0.4))
    drop-shadow(0 10px 24px rgba(2, 132, 199, 0.35));
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.08); }
}
.brand__name { margin: 0 0 6px; font-size: 30px; letter-spacing: -0.02em; }
.brand__name span { color: var(--accent); font-weight: 700; }
.brand__tag { margin: 0 0 12px; color: var(--text-dim); font-size: 14px; }
.brand__by {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.brand__by strong {
  color: var(--leather);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.form { display: flex; flex-direction: column; gap: 14px; }
.form__hint { margin: 4px 0 0; color: var(--text-mute); font-size: 11.5px; text-align: center; }
.form__error {
  margin: 0;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.02em; text-transform: uppercase; }
.field input {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #03111c;
  border-color: transparent;
  box-shadow: 0 6px 20px -6px var(--accent-glow);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.1); }

.btn--ghost {
  background: var(--bg-elev-2);
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover:not(:disabled) { background: #262626; }

.btn--sm { padding: 7px 12px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* ============================================================
   CAPTURE
   ============================================================ */
.capture {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.capture__video, .capture__preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.capture__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-mute);
  font-size: 13px;
  padding: 20px;
  text-align: center;
}
.capture__placeholder svg { width: 56px; height: 56px; opacity: 0.6; }

.capture__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.capture__actions .btn { flex: 1; min-width: 130px; }

/* ============================================================
   DISHES LIST
   ============================================================ */
.dishes { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 10px; }

.dish {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dish__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dish__name { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -0.005em; }
.dish__price { font-size: 13px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.dish__category {
  display: inline-block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 100px;
  width: fit-content;
}
.dish__desc { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.dish__ings { margin: 0; font-size: 12px; color: var(--text-mute); line-height: 1.5; }
.dish__ings strong { color: var(--text-dim); font-weight: 600; }

.dish__actions { display: flex; gap: 8px; margin-top: 4px; }
.dish__actions .btn { flex: 1; }

.dish__thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: zoom-in;
  margin-top: 4px;
}

.dish__loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: rgba(56, 189, 248, 0.06);
  border: 1px dashed rgba(56, 189, 248, 0.32);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

/* ============================================================
   GALLERY
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.gallery__item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--bg-elev-2);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }
.gallery__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 6px 8px;
  background: linear-gradient(0deg, rgba(0,0,0,0.85), transparent);
  font-size: 11px;
  line-height: 1.3;
  color: #fff;
}
.gallery__caption small { color: var(--text-dim); }

@media (min-width: 480px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}
.modal__panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
}
.modal__close:hover { background: var(--bg-elev-2); }
.modal__title { margin: 0 0 4px; font-size: 17px; padding-right: 30px; }
.modal__sub { margin: 0 0 14px; color: var(--text-dim); font-size: 12.5px; }
.modal__body img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.modal__actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.modal__actions .btn { flex: 1; min-width: 140px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 100px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: toastIn 0.2s ease-out;
}
.toast--error { border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.toast--success { border-color: rgba(34, 197, 94, 0.4); color: #86efac; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
