/* ═══════════════════════════════════════════
   Eventos Haru — CSS Global
   Fonte: Inter | Paleta: Rosa #f43f5e
═══════════════════════════════════════════ */

/* ── IMPORT FONTE ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── VARIÁVEIS ── */
:root {
  --rosa:        #f43f5e;
  --rosa-hover:  #e11d48;
  --rosa-light:  #fff1f2;
  --rosa-border: #fecdd3;

  --bg:          #f8f8f8;
  --surface:     #ffffff;
  --surface2:    #f1f5f9;
  --border:      #e2e8f0;

  --text:        #1e293b;
  --text-2:      #334155;
  --text-3:      #64748b;
  --text-4:      #94a3b8;

  --verde:       #16a34a;
  --verde-light: #f0fdf4;
  --verde-border:#bbf7d0;

  --azul:        #2563eb;
  --azul-light:  #eff6ff;
  --azul-border: #bfdbfe;

  --laranja:     #c2410c;
  --laranja-light:#fff7ed;
  --laranja-border:#fed7aa;

  --vermelho:    #e11d48;
  --vermelho-light:#fff1f2;
  --vermelho-border:#fecdd3;

  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-pill: 99px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow:    0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.1);
}

/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── PÁGINAS ── */
.page {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
}
.page.active {
  display: flex;
}

/* ── HEADER ── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.header-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.header-title span {
  color: var(--rosa);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-user {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}
.avatar {
  width: 32px;
  height: 32px;
  background: var(--rosa);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── BACK BUTTON ── */
.back-btn {
  width: 34px;
  height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-3);
  transition: all .15s;
}
.back-btn:active {
  transform: scale(.93);
}
.back-btn svg {
  width: 18px;
  height: 18px;
}

/* ── PAGE CONTENT ── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* ── SECTION TITLE ── */
.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 10px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card + .card {
  margin-top: 10px;
}

/* ── EVENTO BADGE (home) ── */
.evento-badge {
  background: linear-gradient(135deg, var(--rosa), #fb7185);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(244,63,94,.3);
}
.evento-badge-info .ev-label {
  font-size: 10px;
  font-weight: 500;
  opacity: .85;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.evento-badge-info .ev-nome {
  font-size: 17px;
  font-weight: 800;
  margin-top: 2px;
}
.evento-badge-info .ev-data {
  font-size: 11px;
  opacity: .75;
  margin-top: 2px;
}
.ev-status-dot {
  width: 10px;
  height: 10px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 8px #4ade80;
  flex-shrink: 0;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-val.rosa   { color: var(--rosa); }
.stat-val.verde  { color: var(--verde); }
.stat-val.azul   { color: var(--azul); }
.stat-lbl {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-4);
  margin-top: 4px;
}

/* ── HOME BUTTONS ── */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.home-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.home-btn:active {
  transform: scale(.97);
}
.home-btn .hb-icon {
  font-size: 26px;
  margin-bottom: 10px;
  display: block;
}
.home-btn .hb-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: block;
}
.home-btn .hb-desc {
  font-size: 11px;
  color: var(--text-4);
  display: block;
  margin-top: 2px;
}
.home-btn.entrada  { border-color: var(--rosa-border);    background: var(--rosa-light); }
.home-btn.retorno  { border-color: var(--azul-border);    background: var(--azul-light); }
.home-btn.relatorio{ border-color: var(--laranja-border); background: var(--laranja-light); }
.home-btn.pesquisa { border-color: var(--verde-border);   background: var(--verde-light); }

/* ── PRODUCT CARDS ── */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.product-card-info {
  flex: 1;
  min-width: 0;
}
.product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-code {
  font-size: 11px;
  color: var(--text-4);
  font-family: monospace;
  margin-top: 2px;
}
.product-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}
.product-by {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 5px;
}
.product-by span {
  color: var(--rosa);
  font-weight: 500;
}
.product-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

/* ── PILLS / BADGES ── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
}
.pill-verde   { background: var(--verde-light);   color: var(--verde);   }
.pill-azul    { background: var(--azul-light);    color: var(--azul);    }
.pill-rosa    { background: var(--rosa-light);    color: var(--rosa);    }
.pill-laranja { background: var(--laranja-light); color: var(--laranja); }
.pill-cinza   { background: var(--surface2);      color: var(--text-3);  }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-ativo     { background: var(--verde-light);    color: var(--verde);   border-color: var(--verde-border); }
.badge-encerrado { background: var(--surface2);       color: var(--text-3);  border-color: var(--border); }
.badge-admin     { background: #fdf4ff; color: #a21caf; border-color: #f0abfc; }
.badge-func      { background: var(--azul-light);     color: var(--azul);    border-color: var(--azul-border); }

/* ── BOTÕES ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn-primary   { background: var(--rosa);     color: white; }
.btn-primary:active { background: var(--rosa-hover); }
.btn-secondary { background: var(--surface);  color: var(--text);   border: 1px solid var(--border); }
.btn-ghost     { background: transparent;     color: var(--rosa);   border: 1px solid var(--rosa); }
.btn-danger    { background: var(--rosa-light); color: var(--vermelho); border: 1px solid var(--rosa-border); }
.btn-success   { background: var(--verde-light); color: var(--verde); border: 1px solid var(--verde-border); }
.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.gap-8  { display: flex; flex-direction: column; gap: 8px; }
.gap-10 { display: flex; flex-direction: column; gap: 10px; }
.gap-12 { display: flex; flex-direction: column; gap: 12px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }

/* ── FORMULÁRIOS ── */
.form-group { margin-bottom: 12px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 5px;
}
.input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 11px 13px;
  outline: none;
  transition: border .2s;
}
.input:focus  { border-color: var(--rosa); }
.input.valid  { border-color: var(--verde); }
.input.error  { border-color: var(--vermelho); }
.input-hint {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 4px;
}
.input-hint.sugerido { color: var(--verde); font-weight: 500; }

select.input { cursor: pointer; }
textarea.input { resize: vertical; min-height: 80px; }

/* ── SCANNER ── */
.scanner-wrap {
  position: relative;
  background: var(--text);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
  margin-bottom: 12px;
}
.scanner-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scanner-frame {
  width: 65%;
  aspect-ratio: 3/1.2;
  border: 2.5px solid var(--rosa);
  border-radius: 10px;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.5);
}
.scanner-line {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 2px;
  background: var(--rosa);
  border-radius: 2px;
  animation: scan 1.6s ease-in-out infinite;
  box-shadow: 0 0 8px var(--rosa);
}
@keyframes scan {
  0%, 100% { top: 10%; }
  50%       { top: 88%; }
}
.scanner-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  font-size: 13px;
  opacity: .6;
}
.scanner-idle svg { width: 36px; height: 36px; }

/* ── MODAL ── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-end;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px 32px;
  width: 100%;
  animation: slideUp .22s ease;
  max-height: 90dvh;
  overflow-y: auto;
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-pill);
  margin: 0 auto 18px;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all .3s;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.success { background: var(--verde); }
#toast.error   { background: var(--vermelho); }
#toast.info    { background: var(--azul); }

/* ── LOADING ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248,248,248,.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 1000;
}
#loading-overlay.hidden { display: none; }
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--rosa);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-4);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: block;
  opacity: .3;
}
.empty-state p {
  font-size: 14px;
  font-weight: 500;
}

/* ── TABS ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-4);
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.tab.active {
  color: var(--rosa);
  border-bottom-color: var(--rosa);
}
.tab svg { width: 16px; height: 16px; }

/* ── TABLE ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
}
.table-header {
  display: grid;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-4);
  background: var(--surface2);
}
.table-row {
  display: grid;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}
.table-row:last-child { border-bottom: none; }

/* ── SEARCH BAR ── */
.search-wrap {
  position: relative;
  margin-bottom: 12px;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  color: var(--text-4);
  pointer-events: none;
}
.search-wrap .input {
  padding-left: 38px;
}

/* ── SCANNED BADGE ── */
.scanned-badge {
  background: var(--verde-light);
  border: 1px solid var(--verde-border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--verde);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}
.scanned-badge svg { width: 15px; flex-shrink: 0; }

/* ── ADMIN NAV ── */
.admin-nav {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: none;
  flex-shrink: 0;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface2);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.admin-nav-btn.active {
  background: var(--rosa);
  border-color: var(--rosa);
  color: white;
}
.admin-nav-btn svg { width: 14px; height: 14px; }

/* ── UTILITIES ── */
.text-rosa   { color: var(--rosa); }
.text-verde  { color: var(--verde); }
.text-azul   { color: var(--azul); }
.text-muted  { color: var(--text-4); }
.font-mono   { font-family: monospace; }
.font-bold   { font-weight: 700; }
.text-center { text-align: center; }
.w-full      { width: 100%; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.p-16   { padding: 16px; }
.hidden { display: none !important; }