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

:root {
  --orange:     #F59E0B;
  --orange-dk:  #D97706;
  --navy:       #1E3A5F;
  --navy-dk:    #152B47;
  --green:      #25D366; /* WhatsApp */
  --green-dk:   #1DA851;
  --red:        #EF4444;
  --bg:         #F8FAFC;
  --surface:    #FFFFFF;
  --border:     #E2E8F0;
  --text:       #1E293B;
  --muted:      #64748B;
  --radius:     14px;
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --shadow-md:  0 8px 24px rgba(0,0,0,.12);
}

html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font-family: inherit; font-size: inherit; }
input { font-family: inherit; font-size: inherit; }

/* ===== AUTH (LOGIN / PIN SETUP) ===== */
.auth-body {
  background: linear-gradient(160deg, #0F2340 0%, #1E3A5F 55%, #2A5298 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-wrap {
  width: 100%;
  max-width: 380px;
}
.auth-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 36px 28px 32px;
  box-shadow: 0 24px 48px rgba(0,0,0,.3);
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .wordmark { display: inline-block; }
.auth-logo .zaap { color: var(--orange); font-size: 1.9rem; font-weight: 800; }
.auth-logo .jipa { color: var(--navy);   font-size: 1.9rem; font-weight: 800; }
.auth-logo__sub {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
}

.auth-step-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.auth-step-sub {
  font-size: .83rem;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.5;
}
.auth-otp-label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.auth-back {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: .82rem;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s;
}
.auth-back:hover { color: var(--navy); }

/* Email field */
.neg-field {
  margin-bottom: 18px;
}
.neg-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 7px;
}
.neg-input {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.neg-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(245,158,11,.18);
  background: #fff;
}
.neg-input::placeholder { color: #B0BAC9; }

/* PIN setup icon */
.pin-setup-icon {
  font-size: 2.4rem;
  text-align: center;
  margin-bottom: 12px;
}
.pin-hints {
  margin-top: 18px;
  padding: 12px 14px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pin-hints div {
  font-size: .74rem;
  color: #166534;
  font-weight: 500;
}

/* OTP boxes */
.otp-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}
.otp-box {
  width: 46px;
  height: 54px;
  border: 2px solid var(--border);
  border-radius: 10px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-text-security: disc;
}
.otp-box:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(245,158,11,.18);
  background: #fff;
}
.otp-box.filled {
  border-color: var(--navy);
  background: #EEF2F8;
}

/* Alerts */
.neg-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: .83rem;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.4;
}
.neg-alert--error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.neg-alert--warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.neg-alert--info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.neg-alert--success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }

/* Buttons */
.neg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  border: none;
  margin-bottom: 12px;
}
.neg-btn:active { transform: scale(.98); }
.neg-btn--primary {
  background: var(--navy);
  color: #fff;
}
.neg-btn--primary:hover { background: var(--navy-dk); }
.neg-btn--block { width: 100%; }
.neg-btn--whatsapp {
  background: var(--green);
  color: #fff;
  font-size: 1rem;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(37,211,102,.35);
}
.neg-btn--whatsapp:hover { background: var(--green-dk); }
.neg-btn--outline {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  padding: 12px;
  font-size: .85rem;
}
.neg-btn--outline:hover { background: var(--bg); color: var(--text); }

/* ===== PORTAL HOME ===== */
.portal-body { background: var(--bg); }

.portal-wrap {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 0 0 40px;
  box-sizing: border-box;
  overflow-x: hidden;
}

.portal-header {
  background: linear-gradient(160deg, #0F2340 0%, #1E3A5F 70%, #2A5298 100%);
  color: #fff;
  text-align: center;
  padding: 48px 24px 36px;
}
.portal-avatar {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
  border: 3px solid rgba(255,255,255,.15);
}
.portal-nome {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.portal-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245,158,11,.2);
  color: var(--orange);
  border: 1px solid rgba(245,158,11,.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.portal-local {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
}

/* Cards */
.portal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px 16px 0;
  padding: 18px;
  box-shadow: var(--shadow);
}
.portal-card__label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 10px;
}
.portal-card__text {
  font-size: .9rem;
  color: var(--text);
  line-height: 1.6;
}
.portal-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.portal-card__row:last-child { border-bottom: none; }
.portal-card__key { color: var(--muted); font-weight: 500; }
.portal-card__val { font-weight: 600; text-align: right; }

/* WhatsApp button wrapper */
.neg-btn--whatsapp {
  margin: 16px 16px 0;
  width: calc(100% - 32px);
  text-decoration: none;
}

/* Logout button */
.neg-btn--outline {
  margin: 12px 16px 0;
  width: calc(100% - 32px);
}

/* Toast */
.neg-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #166534;
  color: #fff;
  padding: 12px 22px;
  border-radius: 50px;
  font-size: .85rem;
  font-weight: 600;
  z-index: 999;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  white-space: nowrap;
}

/* Footer */
.portal-footer {
  text-align: center;
  color: var(--muted);
  font-size: .74rem;
  margin-top: 28px;
  padding: 0 16px;
}

/* ===== PORTAL CAROUSEL (topo da home do portal) ===== */
.pc-wrap {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100dvh;
}

/* Wrapper do carousel */
.pc-carousel-wrap {
  position: relative;
  background: #111;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  margin: 10px 14px 0;
}

/* Carousel de fotos */
.pc-carousel {
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pc-carousel::-webkit-scrollbar { display: none; }

/* Cada slide */
.pc-slide {
  flex-shrink: 0;
  width: 100%;
  scroll-snap-align: start;
  aspect-ratio: 1 / 1;
  max-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pc-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-slide__avatar { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pc-slide__emoji  { font-size: 5.5rem; filter: drop-shadow(0 6px 18px rgba(0,0,0,.22)); }

/* Dots — flutuam sobre a foto */
.pc-dots {
  position: absolute;
  bottom: 36px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 5; pointer-events: none;
}
.pc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.45);
  transition: background .2s, width .2s;
}
.pc-dot--active { background: #fff; width: 18px; border-radius: 4px; }

/* Setas de navegação */
.pc-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 10; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.28); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.9);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: .72;
  transition: opacity .2s, transform .15s;
  user-select: none; -webkit-user-select: none;
}
.pc-arrow:hover  { opacity: 1; }
.pc-arrow:active { transform: translateY(-50%) scale(.9); }
.pc-arrow--prev  { left: 10px; }
.pc-arrow--next  { right: 10px; }
.pc-arrow--hidden { opacity: 0 !important; pointer-events: none; }

/* Content card — sobrepõe o carousel com cantos arredondados (full-width) */
.pc-content {
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  margin-top: -22px;
  position: relative; z-index: 2;
  padding-bottom: 40px;
}
/* Handle bar */
.pc-content::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
}

/* Cabeçalho dentro do content card */
.pc-header {
  padding: 14px 16px 4px;
}
.pc-nome {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 8px;
}
.pc-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #EEF2F8;
  color: var(--navy);
  border: 1px solid #C7D9F0;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.pc-local {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
  color: var(--muted);
  font-weight: 500;
}
.pc-local svg { stroke: var(--orange); flex-shrink: 0; }

/* Ações rápidas dentro do content card */
.pc-actions {
  padding: 0;
}

/* ===== PORTAL TOPBAR (páginas internas) ===== */
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.portal-topbar__back {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background .15s;
  flex-shrink: 0;
}
.portal-topbar__back:active { background: var(--border); }
.portal-topbar__title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

/* ===== PORTAL QUICK ACTION (botão de acesso rápido no index) ===== */
.portal-quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin: 12px 16px 0;
  box-shadow: var(--shadow);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.portal-quick-action:active { opacity: .75; }
.portal-quick-action__icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}
.portal-quick-action__text { flex: 1; min-width: 0; }
.portal-quick-action__title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
}
.portal-quick-action__sub {
  font-size: .73rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== GESTÃO DE FOTOS ===== */
.fotos-infobar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  gap: 8px;
  flex-wrap: wrap;
}
.fotos-infobar__count {
  font-size: .8rem;
  font-weight: 700;
  color: var(--navy);
  background: #EEF2F8;
  padding: 3px 10px;
  border-radius: 20px;
}
.fotos-infobar__hint {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
}

/* Upload area */
.fotos-upload-wrap {
  margin: 4px 16px 12px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  text-align: center;
  background: var(--surface);
  transition: border-color .15s;
}
.fotos-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
}
.fotos-upload-btn:active {
  background: var(--navy-dk);
  transform: scale(.97);
}
.fotos-upload-btn:disabled {
  background: #94a3b8;
  transform: none;
  cursor: not-allowed;
}
.fotos-upload-hint {
  margin-top: 8px;
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.5;
}
.fotos-progress {
  margin-top: 12px;
  height: 5px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.fotos-progress__bar {
  height: 100%;
  background: var(--orange);
  border-radius: 5px;
  transition: width .15s linear;
  width: 0%;
}
.fotos-limit-msg {
  margin: 0 16px 12px;
  padding: 10px 14px;
  background: #FFF8EC;
  border: 1px solid var(--orange);
  border-radius: 10px;
  font-size: .8rem;
  color: var(--navy-dk);
  font-weight: 500;
  text-align: center;
}

/* Grid de fotos */
.fotos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 32px;
}
.fotos-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 0 16px;
  color: var(--muted);
}
.fotos-empty__icon { font-size: 3rem; margin-bottom: 10px; }
.fotos-empty p { font-size: .85rem; line-height: 1.6; }

.foto-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.foto-item--new {
  animation: fotoPop .3s ease both;
}
@keyframes fotoPop {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: scale(1); }
}

.foto-item__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg);
}
.foto-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.foto-item__capa {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(245,158,11,.92);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.foto-item__actions {
  display: flex;
  gap: 6px;
  padding: 7px 8px;
}
.fotoBtn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 8px;
  font-size: .68rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
}
.fotoBtn:active { transform: scale(.94); }
.fotoBtn--capa {
  background: #EEF2F8;
  color: var(--navy);
}
.fotoBtn--capa:hover { background: #D6E4F7; }
.fotoBtn--del {
  background: #FEF2F2;
  color: #991B1B;
}
.fotoBtn--del:hover { background: #FECACA; }

/* ===== EDIÇÃO DE PERFIL (inline edit) ===== */
.pf-section {
  margin: 16px 16px 0;
  /* Garante que não ultrapassa o portal-wrap em nenhuma resolução */
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.pf-section__label {
  font-size: .66rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px;
}

/* Card que agrupa as linhas de uma seção */
.pf-section > .pf-row {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: border-color .15s;
  flex-wrap: wrap; /* permite inline-edit quebrar para linha abaixo */
}
.pf-section > .pf-row:focus-within {
  border-color: var(--orange);
}

/* Linha: info (label + valor) + botão lápis */
.pf-row__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.pf-row__key {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.pf-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pf-row__val {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

/* Botão lápis */
.pf-edit-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--navy);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.pf-edit-btn:active { background: #D6E4F7; }

/* Container de edição inline */
.pf-inline-edit {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  width: 100%;   /* ocupa a linha inteira dentro do pf-row */
  min-width: 0;  /* evita overflow em flex containers */
  gap: 8px;
}
.pf-input {
  width: 100%;
  font-size: .9rem;
}

/* Prefixo @ para Instagram */
.pf-at-prefix {
  padding: 13px 8px 13px 14px;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-right: none;
  border-radius: 10px 0 0 10px;
  font-size: .95rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.pf-input--at {
  border-radius: 0 10px 10px 0 !important;
  border-left: none !important;
}

/* Botões salvar / cancelar */
.pf-inline-actions {
  display: flex;
  gap: 8px;
}
.pf-save-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.pf-save-btn:disabled { background: #94a3b8; cursor: not-allowed; }
.pf-save-btn:hover:not(:disabled) { background: var(--navy-dk); }
.pf-cancel-btn {
  padding: 10px 16px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.pf-cancel-btn:hover { background: var(--bg); }

/* ===== ANIMATIONS ===== */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
