/* UniClubes+ App — mobile-first, estilo fintech (Nubank/Inter). Autoria: Ernestino Barcellos - https://tem3.com.br */
:root {
  /* Paleta (sobrescrita por <style> inline vinda de app_temas() em includes/boot.php) */
  --hero1: #E91E8C; --hero2: #b3126b; --onhero: #ffffff; --b: #E91E8C; --on: #ffffff; --bd: #ff3da1; --ond: #ffffff;
  --brand: var(--b); --on-brand: var(--on);
  --brand-soft: #fde7f3; --brand-soft: color-mix(in srgb, var(--brand) 13%, var(--card));
  --bg: #f4f4f6; --card: #ffffff; --ink: #14141a; --muted: #7a7a89; --line: #ececf1;
  --ok: #10b981; --warn: #f59e0b; --bad: #ef4444;
  --r: 20px; --shadow: 0 2px 14px rgba(20,20,26,.06);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
/* Modo escuro: automático (sistema) ou forçado pelo usuário (data-modo) */
@media (prefers-color-scheme: dark) {
  :root:not([data-modo="claro"]) { --bg: #0e0e12; --card: #1a1a21; --ink: #f4f4f8; --muted: #9a9aab; --line: #2a2a33; --shadow: none; --brand: var(--bd); --on-brand: var(--ond); }
}
:root[data-modo="escuro"] { --bg: #0e0e12; --card: #1a1a21; --ink: #f4f4f8; --muted: #9a9aab; --line: #2a2a33; --shadow: none; --brand: var(--bd); --on-brand: var(--ond); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; }
body { min-height: 100vh; padding-bottom: calc(76px + var(--safe-b)); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* Cabeçalho de marca */
.hero { background: linear-gradient(160deg, var(--hero1) 0%, var(--hero2) 100%); color: var(--onhero); padding: calc(18px + var(--safe-t)) 0 64px; border-radius: 0 0 28px 28px; }
.hero .row { display: flex; align-items: center; justify-content: space-between; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-weight: 700; }
.hero h1 { font-size: 24px; margin: 18px 0 2px; font-weight: 700; letter-spacing: -.02em; }
.hero p { margin: 0; opacity: .85; font-size: 14px; }
.pull { margin-top: -44px; }

/* Cartões */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card + .card, .stack > * + * { margin-top: 12px; }
.section-t { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 10px; }
.section-t h2 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.section-t a { color: var(--brand); font-size: 13px; font-weight: 600; }

/* Atalhos (círculos) */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.quick i { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 19px; }

/* Lista de benefícios */
.b-list { display: grid; gap: 12px; }
.b-item { display: flex; gap: 12px; background: var(--card); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow); align-items: center; }
.b-item img { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; background: var(--line); flex: none; }
.b-item .t { font-weight: 600; line-height: 1.3; font-size: 14.5px; }
.b-item .p { font-size: 11.5px; color: var(--muted); text-transform: uppercase; font-weight: 600; letter-spacing: .03em; margin-bottom: 3px; }
.b-item .go { margin-left: auto; color: var(--muted); }
.h-scroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.h-scroll::-webkit-scrollbar { display: none; }
.b-tile { flex: none; width: 200px; background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); scroll-snap-align: start; }
.b-tile img { width: 100%; height: 110px; object-fit: cover; background: var(--line); }
.b-tile div { padding: 10px 12px 12px; font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.b-tile small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; margin-bottom: 2px; }

/* Busca / chips */
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 999px; padding: 0 16px; box-shadow: var(--shadow); }
.search input { flex: 1; border: 0; background: transparent; height: 48px; font-size: 15px; color: var(--ink); outline: none; }
.search i { color: var(--muted); }
.chips { display: flex; gap: 8px; margin: 12px 0; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.chip.on { background: var(--brand); color: var(--on-brand); }

/* Botões e formulários */
.btn { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; height: 52px; border: 0; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: 16px; font-weight: 700; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.line { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.sm { height: 40px; font-size: 14px; width: auto; padding: 0 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin: 0 4px 6px; font-weight: 600; }
.field input { width: 100%; height: 52px; border: 1.5px solid var(--line); background: var(--card); border-radius: 16px; padding: 0 16px; font-size: 16px; color: var(--ink); outline: none; }
.field input:focus { border-color: var(--brand); }
.alert { padding: 12px 14px; border-radius: 14px; font-size: 14px; margin-bottom: 14px; background: #fee2e2; color: #991b1b; }
.alert.ok { background: #d1fae5; color: #065f46; }

/* Cupom */
.coupon { border: 2px dashed var(--brand); border-radius: var(--r); padding: 18px; text-align: center; background: var(--brand-soft); }
.coupon small { color: var(--muted); text-transform: uppercase; font-weight: 700; font-size: 11px; letter-spacing: .06em; }
.coupon .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 26px; font-weight: 800; color: var(--brand); letter-spacing: .06em; margin: 6px 0 12px; word-break: break-all; }

/* Detalhe */
.cover { position: relative; }
.cover img { width: 100%; height: 240px; object-fit: cover; background: var(--line); }
.cover .back, .cover .fav { position: absolute; top: calc(12px + var(--safe-t)); width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.92); color: #111; display: grid; place-items: center; border: 0; font-size: 16px; }
.cover .back { left: 14px; } .cover .fav { right: 14px; }
.sheet { background: var(--bg); margin-top: -24px; border-radius: 26px 26px 0 0; position: relative; padding-top: 20px; }
.tag { display: inline-block; background: var(--brand-soft); color: var(--brand); font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.desc { line-height: 1.55; color: var(--ink); font-size: 14.5px; }
.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); padding: 12px 16px calc(12px + var(--safe-b)); box-shadow: 0 -4px 20px rgba(0,0,0,.08); z-index: 30; }
.has-cta { padding-bottom: calc(100px + var(--safe-b)); }

/* Lista de perfil / carteira */
.row-item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-item i.ic { width: 38px; height: 38px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.row-item .sub { color: var(--muted); font-size: 12.5px; }
.pager { display: flex; justify-content: center; gap: 10px; margin: 20px 0; }

/* Barra inferior */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; padding: 8px 6px calc(8px + var(--safe-b)); z-index: 40; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; }
.tabbar a i { font-size: 20px; }
.tabbar a.on { color: var(--brand); }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; }
.login .top { background: linear-gradient(160deg, var(--hero1), var(--hero2)); color: var(--onhero); padding: calc(56px + var(--safe-t)) 24px 48px; border-radius: 0 0 32px 32px; }
.login .logo { width: 72px; height: 72px; border-radius: 22px; background: #fff; display: grid; place-items: center; margin-bottom: 22px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.login .logo img { width: 44px; height: auto; }
.login h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.02em; }
.login .top p { margin: 0; opacity: .85; }
.login .form { padding: 24px 20px; max-width: 480px; width: 100%; margin: 0 auto; }
.login .links { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.login .links a { color: var(--brand); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty i { font-size: 40px; color: var(--brand); opacity: .5; margin-bottom: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: #14141a; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13.5px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; }
.toast.on { opacity: 1; }
.b-item > div { min-width: 0; flex: 1; }
.b-item .t, .b-item .p { overflow-wrap: anywhere; }
.b-item .p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-tile small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html, body { overflow-x: hidden; }

/* ===== Splash de campanhas ===== */
#splash { position: fixed; inset: 0; z-index: 1000; display: none; color: #fff; background: linear-gradient(160deg, var(--hero1), var(--hero2)); overflow: hidden; touch-action: pan-y; transition: opacity .35s ease; }
html.splash-pending #splash { display: block; }
html.splash-pending body > *:not(#splash):not(script):not(style) { visibility: hidden; }
#splash.out { opacity: 0; pointer-events: none; }
.sp-load { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; color: var(--onhero); transition: opacity .3s; }
.sp-logo { width: 96px; height: 96px; border-radius: 28px; background: #fff; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: sp-pulse 1.4s ease-in-out infinite; }
.sp-logo img { width: 58px; height: auto; }
.sp-spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); border-top-color: var(--onhero); animation: sp-rot .8s linear infinite; }
@keyframes sp-rot { to { transform: rotate(360deg); } }
@keyframes sp-pulse { 50% { transform: scale(1.07); } }
#splash.ready .sp-load { opacity: 0; pointer-events: none; }
.sp-track { position: absolute; inset: 0; display: flex; transition: transform .5s cubic-bezier(.22,.9,.3,1); will-change: transform; }
.sp-slide { flex: 0 0 100%; height: 100%; position: relative; background: #000; }
.sp-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-slide::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46%; background: linear-gradient(to top, rgba(0,0,0,.78), transparent); pointer-events: none; }
.sp-info { position: absolute; left: 20px; right: 20px; bottom: calc(28px + var(--safe-b)); z-index: 2; color: #fff; }
.sp-info .sp-par { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; margin-bottom: 6px; }
.sp-info .sp-tit { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-bottom: 16px; text-shadow: 0 2px 12px rgba(0,0,0,.4); }
.sp-cta { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-weight: 800; font-size: 16px; }
.sp-bars { position: absolute; top: calc(10px + var(--safe-t)); left: 12px; right: 12px; display: flex; gap: 4px; z-index: 5; }
.sp-bar { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
.sp-bar i { display: block; height: 100%; width: 0; background: #fff; }
.sp-skip { position: absolute; top: calc(22px + var(--safe-t)); right: 14px; z-index: 6; border: 0; background: rgba(0,0,0,.42); color: #fff; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* ===== Aparência (perfil) ===== */
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.swatch .sw { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.2; }
.swatch .dot { width: 44px; height: 44px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255,255,255,.55), 0 2px 8px rgba(0,0,0,.18); }
.swatch input:checked + .sw { border-color: var(--brand); background: var(--brand-soft); }
.swatch input:checked + .sw::after { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; top: 6px; right: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-size: 10px; }
.seg { display: flex; background: var(--line); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.seg label { flex: 1; position: relative; text-align: center; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 9px 0; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ===== Cadastro dentro do app ===== */
.login .top { position: relative; }
.cad-back { position: absolute; top: calc(14px + var(--safe-t)); left: 14px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); color: var(--onhero); display: grid; place-items: center; }
.dots { display: flex; gap: 6px; margin-top: 18px; }
.dots i { width: 22px; height: 5px; border-radius: 5px; background: rgba(255,255,255,.35); }
.dots i.on { background: #fff; }
.opt { display: block; position: relative; margin-bottom: 10px; cursor: pointer; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.opt-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); }
.opt-box small { color: var(--muted); font-size: 12.5px; }
.opt input:checked + .opt-box { border-color: var(--brand); background: var(--brand-soft); }
.price { font-size: 18px; font-weight: 800; white-space: nowrap; text-align: right; }
.price small { display: block; font-weight: 600; }
.aceite { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; margin: 14px 2px 16px; color: var(--muted); }
.aceite input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.aceite a { color: var(--brand); font-weight: 700; text-decoration: underline; }

/* ===== Sensação de app nativo ===== */
html { touch-action: manipulation; overscroll-behavior-y: none; -webkit-text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, .desc, .coupon .code, .row-item .sub, code { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
img, a { -webkit-user-drag: none; }
.b-item, .b-tile, .chip, .quick a, .tabbar a, .opt, .swatch, .row-item a { transition: transform .12s ease, opacity .12s ease; }
.b-item:active, .b-tile:active, .chip:active, .quick a:active, .opt:active, .swatch:active { transform: scale(.97); }
.tabbar a:active { transform: scale(.92); opacity: .8; }
.b-item { content-visibility: auto; contain-intrinsic-size: auto 104px; }
.cover .share { position: absolute; top: calc(12px + var(--safe-t)); right: 64px; width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.92); color: #111; display: grid; place-items: center; border: 0; font-size: 16px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; z-index: 2; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(20px); }

/* Transição entre telas (navegação de documento): desliza suave; a barra de abas fica parada */
@view-transition { navigation: auto; }
.tabbar { view-transition-name: tabbar; }
::view-transition-old(root) { animation: 110ms ease-out both uc-out; }
::view-transition-new(root) { animation: 240ms cubic-bezier(.22,.9,.3,1) both uc-in; }
@keyframes uc-out { to { opacity: 0; } }
@keyframes uc-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@supports not (view-transition-name: x) { body { animation: uc-in .2s ease-out both; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  body { animation: none !important; }
}
