/* ============================================================
   Companion Cristão PWA — Mobile-first styles
   ============================================================ */

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

:root {
  --primary:   #1B3A6B;
  --primary-l: #2A5298;
  --gold:      #D4AF37;
  --gold-l:    #F0D060;
  --bg:        #F4F6FB;
  --card-bg:   #FFFFFF;
  --text:      #1A1A2E;
  --text-muted:#6B7280;
  --radius:    14px;
  --shadow:    0 2px 12px rgba(27,58,107,.10);
  --safe-top:  env(safe-area-inset-top, 0px);
  --safe-bot:  env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── BACKGROUND BÍBLICO ──────────────────────────────────── */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(160deg, #0D1E3B 0%, #1B3A6B 50%, #4A3020 100%);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  transition: background-image .7s ease;
}
#bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(5,12,38,.62) 0%,
    rgba(5,12,38,.46) 60%,
    rgba(5,12,38,.60) 100%);
  pointer-events: none;
}

/* ── HEADER ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.header-left  { display: flex; align-items: center; gap: 10px; }
.header-logo  { width: 36px; height: 36px; border-radius: 8px; }
.header-title { font-size: 1rem; font-weight: 700; letter-spacing: .3px; }
.header-sub   { font-size: .72rem; opacity: .75; }
.header-right { display: flex; gap: 6px; }

.btn-som, .btn-notif, .btn-user {
  background: rgba(255,255,255,.15);
  border: none;
  border-radius: 8px;
  width: 36px; height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.btn-som:hover, .btn-notif:hover, .btn-user:hover { background: rgba(255,255,255,.28); }
.btn-notif.ativo { background: var(--gold); color: var(--primary); }
.btn-som.ativo   { background: rgba(255,220,80,.35); }

/* ── PLANO BAR ───────────────────────────────────────────── */
.plano-bar {
  background: linear-gradient(90deg, var(--primary-l), var(--primary));
  color: #fff;
  font-size: .78rem;
  padding: 5px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.link-assinar {
  color: var(--gold-l);
  font-weight: 700;
  text-decoration: none;
}

/* ── TAB NAV ─────────────────────────────────────────────── */
.tab-nav {
  position: sticky;
  top: 58px;
  z-index: 90;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  overflow-x: auto;
  gap: 0;
  border-bottom: 2px solid rgba(229,233,240,0.7);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 0 0 auto;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 11px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── MAIN / PANES ────────────────────────────────────────── */
.tab-content  { padding: 16px 14px calc(var(--safe-bot) + 80px); }
.tab-pane     { display: none; }
.tab-pane.active { display: block; }

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: rgba(255, 255, 255, 0.87);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.22);
  padding: 18px 16px;
  margin-bottom: 14px;
}
.card-premium { border-left: 4px solid var(--gold); }

.card-titulo  { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.card-subtitulo { font-size: .9rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.card-texto   { font-size: .95rem; color: var(--text); line-height: 1.7; }

/* ── BÊNÇÃO CARD ─────────────────────────────────────────── */
.bencao-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-l));
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.bencao-instrucao {
  color: var(--gold-l);
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.bencao-texto {
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1.1rem;
  line-height: 1.8;
  font-style: italic;
}

/* ── ESTUDO HEADER ───────────────────────────────────────── */
.estudo-header-card {
  background: var(--primary);
  color: #fff;
}
.estudo-numero  { font-size: .75rem; font-weight: 700; color: var(--gold-l); letter-spacing: 1px; text-transform: uppercase; display: block; margin-bottom: 4px; }
.estudo-livro   { font-size: 1.3rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.estudo-subtitulo { font-size: .9rem; color: rgba(255,255,255,.8); margin-bottom: 10px; }
.estudo-meta    { font-size: .8rem; color: rgba(255,255,255,.6); }

/* ── VERSÍCULO KEY ───────────────────────────────────────── */
.card-versiculo { border-left: 4px solid var(--gold); }
.versiculo-label { font-size: .72rem; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px; }
.versiculo-texto { font-style: italic; font-size: .95rem; color: var(--text); }

/* ── PASSAGEM ────────────────────────────────────────────── */
.card-passagem { border-left: 4px solid var(--primary-l); }
.passagem-ref  { font-size: .78rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px; }
.passagem-texto { font-style: italic; font-size: .95rem; line-height: 1.7; }

/* ── BADGE SANTO ─────────────────────────────────────────── */
.badge-santo {
  display: inline-block;
  background: var(--gold);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

/* ── NAVEGAÇÃO CURIOSIDADE ───────────────────────────────── */
.nav-curiosidade {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 14px;
}
.btn-nav {
  background: var(--card-bg);
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  font-size: .82rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-nav:hover { background: var(--primary); color: #fff; }
.btn-nav:disabled { opacity: .35; cursor: not-allowed; }
.nav-count { font-size: .8rem; color: var(--text-muted); }

/* ── TEASER CARD ─────────────────────────────────────────── */
.teaser-card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px dashed rgba(180,195,225,0.85);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 14px;
}
.teaser-titulo { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.teaser-desc   { font-size: .88rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }

/* ── UPGRADE CARD ────────────────────────────────────────── */
.upgrade-card {
  background: rgba(255,255,255,0.87);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.22);
  padding: 22px 18px;
  margin-bottom: 14px;
  text-align: center;
}
.upgrade-titulo { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.upgrade-desc   { font-size: .9rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }

.upgrade-exemplo {
  background: #EEF2FB;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  text-align: left;
}
.upgrade-exemplo-label { font-size: .73rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 5px; }
.upgrade-exemplo-texto { font-size: .88rem; font-style: italic; color: var(--text); line-height: 1.6; }

/* ── BOTÕES ──────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: background .2s, transform .1s;
}
.btn-primary:hover  { background: var(--primary-l); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  display: block;
  width: 100%;
  background: var(--primary-l);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background .2s;
}

.btn-outline {
  display: block;
  width: 100%;
  background: transparent;
  color: #e05252;
  border: 1.5px solid #e05252;
  border-radius: 10px;
  padding: 11px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background .2s, color .2s;
}
.btn-outline:hover { background: #e05252; color: #fff; }

.btn-upgrade {
  background: linear-gradient(135deg, var(--gold), #B8962E);
  color: var(--primary);
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 3px 10px rgba(212,175,55,.35);
}
.btn-upgrade:hover  { opacity: .9; }
.btn-upgrade:active { transform: scale(.98); }

.btn-visitante {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .84rem;
  cursor: pointer;
  margin-top: 12px;
  text-decoration: underline;
  width: 100%;
  text-align: center;
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px calc(var(--safe-bot) + 24px);
  animation: slideUp .28s ease;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-titulo { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 16px; }

.tab-modal-nav {
  display: flex;
  border-bottom: 2px solid #E5E9F0;
  margin-bottom: 16px;
}
.tab-modal-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 8px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.tab-modal-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.input-field {
  display: block;
  width: 100%;
  border: 1.5px solid #D1D9E8;
  border-radius: 9px;
  padding: 12px 14px;
  font-size: .95rem;
  color: var(--text);
  background: var(--bg);
  margin-bottom: 10px;
  outline: none;
  transition: border-color .2s;
}
.input-field:focus { border-color: var(--primary); }

.input-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  margin-top: 10px;
}

.modal-erro {
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .84rem;
  margin-top: 8px;
}

.perfil-nome  { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.perfil-email { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }
.perfil-plano { font-size: .85rem; font-weight: 600; color: var(--gold); margin-top: 6px; margin-bottom: 14px; }

.btn-fechar-modal {
  position: absolute;
  top: 14px;
  right: 16px;
  background: #EEF2FB;
  border: none;
  border-radius: 50%;
  width: 30px; height: 30px;
  font-size: .9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bot) + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: #1A1A2E;
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 24px;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  animation: fadeInOut 3s forwards;
}
@keyframes fadeInOut {
  0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── RESPONSIVO ─────────────────────────────────────────── */
@media (min-width: 480px) {
  .tab-content { max-width: 480px; margin: 0 auto; }
}
