/* ==========================================================================
   Componentes partilhados: cabeçalho, navegação, faixa "Hoje", modal, tabs,
   progresso, calendário mensal, WhatsApp flutuante, rodapé, tooltip
   ========================================================================== */

/* ---------- Faixa "Hoje na Refresh" ---------- */
.hoje { background: var(--navy-900); color: #e8eefb; font-size: .88rem; position: relative; z-index: 60; }
.hoje-inner { display: flex; align-items: center; gap: 12px; min-height: 44px; padding-block: 8px; }
.hoje .i-ribbon { color: var(--campanha); width: 20px; height: 20px; }
.hoje-txt { flex: 1; min-width: 0; line-height: 1.35; }
.hoje-txt strong { color: #fff; }
.hoje-btn { background: none; border: 0; padding: 4px 6px; font-weight: 800; color: #ffb27a; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.hoje-btn:hover { color: #fff; }
.hoje-close { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: #b8c7e4; }
.hoje-close:hover { background: rgb(255 255 255 / 12%); color: #fff; }

/* ---------- Cabeçalho ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgb(255 255 255 / 94%); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; transition: border-color .3s, box-shadow .3s; }
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 4px 20px rgb(1 24 53 / 6%); }
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); max-width: calc(1320px + var(--gutter) * 2); }
.brand { display: block; flex: none; line-height: 0; }
.brand img { height: 48px; width: auto; }
.nav { margin-left: auto; }
.nav-list { display: flex; align-items: center; gap: 2px; }
.nav-list > li { position: relative; }
.nav-link, .nav-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: .6em .7em; border: 0; background: none; border-radius: 10px;
  font-weight: 700; font-size: .88rem; color: var(--navy-900); text-decoration: none; position: relative; white-space: nowrap;
}
.nav-link::after, .nav-btn::after { content: ""; position: absolute; left: .7em; right: .7em; bottom: 4px; height: 2px; background: var(--orange-500); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.nav-link:hover, .nav-btn:hover { color: var(--blue-600); }
.nav-link:hover::after, .nav-btn:hover::after, .nav-link[aria-current="true"]::after, .has-sub.current > .nav-btn::after { transform: scaleX(1); }
.nav-btn .i { width: 14px; height: 14px; transition: transform .25s; }
.nav-btn[aria-expanded="true"] .i { transform: rotate(180deg); }
.sub { position: absolute; left: 0; top: calc(100% + 6px); min-width: 270px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .2s, transform .2s var(--ease), visibility .2s; z-index: 5; }
.has-sub:hover > .sub, .has-sub:focus-within > .sub, .has-sub.open > .sub { opacity: 1; visibility: visible; transform: none; }
.sub a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--navy-900); font-weight: 700; font-size: .9rem; }
.sub a small { display: block; font-weight: 500; color: var(--ink-3); font-size: .78rem; line-height: 1.3; }
.sub a:hover { background: var(--blue-50); color: var(--blue-700); }
.sub .i { color: var(--blue-600); }
.nav-portal .badge { margin-left: 4px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.header-actions .btn-sm { white-space: nowrap; font-size: .76rem; padding: .5em 1em; }
.header-wa { display: none; }
.menu-toggle { display: none; place-items: center; width: 48px; height: 48px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: #fff; color: var(--navy-900); }
.menu-toggle .i { width: 24px; height: 24px; }
.menu-toggle .i-x { display: none; }
.menu-toggle[aria-expanded="true"] .i-menu { display: none; }
.menu-toggle[aria-expanded="true"] .i-x { display: block; }
.nav-mobile-cta { display: none; }

@media (max-width: 1279px) {
  :root { --header-h: 68px; }
  /* backdrop-filter criaria um bloco contentor para o menu fixo — removido aqui */
  .site-header { backdrop-filter: none; background: #fff; }
  .brand img { height: 42px; }
  .header-actions .btn-sm { display: none; }
  .header-wa { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: #128c7e; color: #fff; }
  .header-wa .i { width: 26px; height: 26px; }
  .menu-toggle { display: inline-grid; }
  .nav { position: fixed; inset: var(--header-h) 0 0 0; z-index: 40; margin: 0; padding: 12px var(--gutter) 32px; background: #fff; overflow-y: auto; transform: translateX(100%); visibility: hidden; transition: transform .35s var(--ease), visibility .35s; border-top: 1px solid var(--line); }
  .nav.open { transform: none; visibility: visible; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-list > li { border-bottom: 1px solid var(--line); }
  .nav-link, .nav-btn { width: 100%; justify-content: space-between; padding: 1em .25em; font-size: 1.05rem; border-radius: 0; }
  .nav-link::after, .nav-btn::after { display: none; }
  .nav-btn .i { display: none; }
  .sub { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 12px 12px; min-width: 0; background: none; }
  .sub a { padding: 10px 8px; font-size: .98rem; min-height: 48px; }
  .sub a small { display: none; }
  .nav-mobile-cta { display: grid; gap: 10px; margin-top: 24px; }
  .header-actions { margin-left: auto; }
  body.menu-open { overflow: hidden; }
}

/* ---------- WhatsApp flutuante ---------- */
.wa-float { position: fixed; right: 18px; bottom: 18px; z-index: 45; display: inline-flex; align-items: center; gap: 10px; height: 58px; padding: 0 20px 0 16px; border-radius: 999px; background: #128c7e; color: #fff; text-decoration: none; font-weight: 800; font-size: .92rem; box-shadow: 0 10px 28px rgb(1 24 53 / 28%); transition: transform .25s var(--ease), box-shadow .25s; }
.wa-float:hover { color: #fff; transform: translateY(-3px); box-shadow: 0 14px 34px rgb(1 24 53 / 34%); }
.wa-float .i { width: 28px; height: 28px; }
@media (max-width: 640px) { .wa-float { width: 58px; padding: 0; justify-content: center; right: 14px; bottom: 14px; } .wa-float span { display: none; } }

/* ---------- Modal (dialog) ---------- */
dialog.modal { border: 0; padding: 0; margin: auto; width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border-radius: var(--radius-lg); background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.modal::backdrop { background: rgb(1 15 38 / 62%); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: modalIn .3s var(--ease); display: flex; flex-direction: column; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px 8px; }
.modal-head h2, .modal-head h3 { font-size: 1.35rem; flex: 1; }
.modal-close { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--surface); color: var(--navy-900); flex: none; }
.modal-close:hover { background: var(--blue-100); }
.modal-body { padding: 8px 24px 24px; overflow-y: auto; }
.modal-body > * + * { margin-top: 14px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px 24px 22px; border-top: 1px solid var(--line); background: var(--surface); }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-row .lbl { font-size: .82rem; font-weight: 700; color: var(--ink-3); margin-right: 4px; }
.share-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: #fff; font-weight: 700; font-size: .82rem; color: var(--navy-900); text-decoration: none; }
.share-btn:hover { border-color: var(--blue-600); color: var(--blue-700); }
.share-btn .i { width: 16px; height: 16px; }

/* ---------- Tabs ---------- */
.tablist { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: .5em 1.05em; border-radius: 999px; border: 1.5px solid var(--line-strong); background: #fff; font-weight: 700; font-size: .88rem; color: var(--ink-2); transition: all .2s; }
.tab:hover { border-color: var(--blue-500); color: var(--blue-700); }
.tab[aria-selected="true"], .tab[aria-pressed="true"] { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }

/* Controlo segmentado */
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 14px; background: var(--blue-100); }
.segmented button { min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.segmented button:hover { color: var(--navy-900); }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-sm); }

/* ---------- Progresso ---------- */
.progress { height: 8px; border-radius: 8px; background: var(--blue-100); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: 8px; background: var(--orange-500); transition: width .9s var(--ease); }
.progress.blue > span { background: var(--blue-600); }

/* ---------- Fita de sensibilização ---------- */
.ribbon { color: var(--campanha); }

/* ---------- Tooltip ---------- */
.tip { position: fixed; z-index: 200; pointer-events: none; max-width: 240px; padding: 8px 12px; border-radius: 10px; background: var(--navy-900); color: #fff; font-size: .8rem; line-height: 1.4; box-shadow: var(--shadow); opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.tip.show { opacity: 1; transform: none; }
.tip b { display: block; font-size: .78rem; color: #ffb27a; letter-spacing: .04em; }

/* ---------- Calendário mensal (partilhado) ---------- */
.mgrid { width: 100%; }
.mgrid-head, .mgrid-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mgrid-head { margin-bottom: 4px; }
.mgrid-head span { text-align: center; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 6px 0; }
.mday { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; min-height: 68px; padding: 8px 8px 7px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; transition: border-color .2s, background-color .2s, transform .2s var(--ease); }
.mday:hover { border-color: var(--blue-500); background: var(--blue-50); }
.mday.out { background: transparent; border-color: transparent; color: #8794b0; pointer-events: none; }
.mday.out .mnum { opacity: .55; }
.mnum { font-weight: 800; font-size: .95rem; line-height: 1; color: var(--navy-900); }
.mday.today { border-color: var(--orange-500); box-shadow: inset 0 0 0 1px var(--orange-500); }
.mday.today .mnum { background: var(--orange-500); color: var(--navy-900); border-radius: 6px; padding: 3px 6px; margin: -3px 0 0 -4px; }
.mday.selected { background: var(--navy-900); border-color: var(--navy-900); }
.mday.selected .mnum { color: #fff; }
.mday.selected.today .mnum { background: var(--orange-500); color: var(--navy-900); }
.mdots { display: flex; gap: 3px; flex-wrap: wrap; min-height: 8px; }
.mdot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-600); box-shadow: 0 0 0 1.5px #fff; }
.mday.selected .mdot { box-shadow: 0 0 0 1.5px var(--navy-900); }
.mday.has-holiday::after { content: ""; position: absolute; right: 8px; top: 8px; width: 6px; height: 6px; border-radius: 2px; background: var(--orange-500); transform: rotate(45deg); }
.mday.selected.has-holiday::after { box-shadow: 0 0 0 0 transparent; }
@media (max-width: 640px) { .mday { min-height: 48px; padding: 6px 4px 5px; border-radius: 8px; align-items: center; } .mgrid-head, .mgrid-body { gap: 3px; } .mdots { justify-content: center; } .mdot { width: 6px; height: 6px; } .mnum { font-size: .85rem; } }

/* ---------- Rodapé ---------- */
.site-footer { background: var(--navy-950); color: #b8c7e4; padding-top: clamp(48px, 6vw, 80px); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: clamp(28px, 4vw, 56px); }
.footer-brand .plate { display: inline-block; padding: 12px 16px; border-radius: 14px; background: #fff; line-height: 0; }
.footer-brand .plate img { height: 46px; width: auto; }
.footer-brand p { margin-top: 18px; max-width: 34ch; font-size: .92rem; }
.footer-brand .script { color: #ffb27a; font-size: 1.5rem; margin-top: 10px; display: block; }
.site-footer h3 { color: #fff; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 16px; }
.site-footer ul { display: grid; gap: 10px; }
.site-footer a { color: #b8c7e4; text-decoration: none; font-size: .92rem; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-contact li { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.footer-contact .i { margin-top: 3px; color: #ffa561; width: 18px; height: 18px; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; margin-top: clamp(36px, 5vw, 64px); padding-block: 22px; border-top: 1px solid rgb(255 255 255 / 12%); font-size: .82rem; }
.footer-bottom nav { display: flex; gap: 18px; flex-wrap: wrap; }
@media (max-width: 960px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Painel de demonstração (?demo=1) ---------- */
.demo-bar { position: fixed; left: 12px; bottom: 12px; z-index: 90; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; max-width: min(560px, calc(100vw - 100px)); padding: 10px 14px; border-radius: 14px; background: var(--navy-900); color: #fff; font-size: .82rem; box-shadow: var(--shadow-lg); }
.demo-bar strong { color: #ffb27a; letter-spacing: .08em; text-transform: uppercase; font-size: .7rem; }
.demo-bar select, .demo-bar input { min-height: 36px; border-radius: 8px; border: 0; padding: 0 8px; background: #fff; color: var(--ink); font-size: .85rem; }
.demo-bar button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--orange-500); color: var(--navy-900); font-weight: 800; }

/* ---------- Modal de contacto (botão único, todas as páginas) ---------- */
.modal-form { display: grid; gap: 18px; }
.modal-form .form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; align-items: center; }

/* ---------- Tela de boas-vindas (uma vez por visita) ---------- */
html.welcome-splash-active, html.welcome-splash-active body { overflow: hidden; }
.welcome-splash { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: var(--white); opacity: 0; visibility: hidden; transition: opacity .4s ease; cursor: pointer; }
.welcome-splash.is-visible { opacity: 1; visibility: visible; }
.welcome-splash.is-hiding { opacity: 0; }
.welcome-splash-inner { text-align: center; padding: 24px; max-width: 360px; }
.welcome-splash-inner img { width: min(230px, 55vw); height: auto; margin: 0 auto 18px; display: block; }
.welcome-splash-msg { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--ink); line-height: 1.4; }
.welcome-splash-msg strong { color: var(--orange-500); }
.welcome-splash-bar { width: 130px; height: 4px; border-radius: 4px; background: var(--line); margin: 20px auto 0; overflow: hidden; }
.welcome-splash-bar span { display: block; height: 100%; width: 0; background: var(--orange-500); animation: welcomeSplashBar 2.2s linear forwards; }
@keyframes welcomeSplashBar { from { width: 0; } to { width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .welcome-splash { transition: none; }
  .welcome-splash-bar span { animation: none; width: 100%; }
}
