/* ==========================================================
   QUINTA DOS AVÓS LOURENÇO — STYLE SHEET (versão final corrigida)
   ========================================================== */

/* ---------- Variáveis de tema ---------- */
:root {
  --brand: #8B0000;
  --brand-dark: #a31c1c;
  --text: #222;
  --bg: #fff;
  --border: #eee;
  --muted: #777;
  --link: #8B0000;

  --cookie-accent: #006400;
  --cookie-accent-hover: #004f00;

  --whatsapp: #25D366;
  --wa-offset: 0px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--bg);
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* ==========================================================
   HEADER + NAV (MENU FIXO NO TOPO)
   ========================================================== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  box-shadow: none;
  transition:
    background-color .25s ease,
    border-color .25s ease,
    box-shadow .25s ease,
    transform .25s ease;
  will-change: transform;
}

.brand { margin-left: 90px; }
.brand a { color: #111; }
.logo { height: 100px; width: auto; background: transparent; border-radius: 8px; }

/* Transparente (sobre o hero) */
.topbar.is-overlay {
  background: transparent;
  border-bottom-color: transparent;
  box-shadow: none;
}
.topbar.is-overlay .menu a { color: #fff; }
.topbar.is-overlay .menu a.active { color: #fff; border-bottom-color: #fff; }
.topbar.is-overlay .menu-toggle { border-color: #fff; color: #fff; }
.topbar.is-overlay .logo { filter: drop-shadow(0 0 6px rgba(0,0,0,.35)); }

/* Sólido (fora do hero) */
.topbar.is-solid {
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.topbar.is-solid .menu a { color: #333; }
.topbar.is-solid .menu a.active { color: var(--brand); border-bottom-color: var(--brand); }
.topbar.is-solid .menu-toggle { border-color: var(--brand); color: var(--brand); }

/* Esconder/mostrar no scroll */
.topbar.is-hidden { transform: translateY(-100%); }
.topbar.menu-open { transform: none !important; }

/* Evitar “flash” branco ao esconder */
.topbar.is-hiding {
  background: transparent !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

/* Botão hambúrguer */
.menu-toggle {
  display: none;
  background: none; border: 1px solid var(--brand); color: var(--brand);
  border-radius: 8px; font-size: 22px; line-height: 1;
  padding: 6px 10px; cursor: pointer; transition: transform .2s ease;
}
.menu-toggle:active { transform: scale(0.9); }

/* Menu Desktop */
@media (min-width: 769px) {
  .menu {
    display: flex !important; justify-content: center; align-items: center;
    gap: 24px; flex: 1; text-align: center;
  }
  .menu a {
    display: inline-block; font-weight: 600; color: #333; padding: 4px 0;
    transition: color .25s, border-color .25s;
  }
  .menu a.active { color: var(--brand); border-bottom: 2px solid var(--brand); padding-bottom: 2px; }
}

/* Menu Mobile */
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .brand { margin-left: 0; }
  .logo { height: 70px; }
  .menu-toggle { display: block; margin-left: auto; }

  .menu {
    display: block;
    max-height: 0; overflow: hidden; opacity: 0; pointer-events: none;
    transition: max-height .35s ease, opacity .25s ease;
    background: #fff; border-top: 1px solid var(--border);
    width: 100%; text-align: center;
  }
  .menu a {
    display: block; padding: 14px 0; border-bottom: 1px solid var(--border);
    color: #333; font-weight: 600; text-align: center;
  }
  .menu.active { max-height: 420px; opacity: 1; pointer-events: auto; }
  .menu a.active { background: #f8f5f3; color: var(--brand); border-bottom: 1px solid #eedede; }

  .topbar.is-overlay .menu.active {
    background: #fff;
    border-top: 1px solid var(--border);
  }
  .topbar.is-overlay .menu.active a { color: #333; }
}

/* ==========================================================
   HERO COM IMAGEM DE FUNDO
   ========================================================== */
.hero {
  position: relative;
  background-image: url("../images/hero.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 110vh;
  display: grid;
  place-items: center;
  text-align: center;
  color: #fff;
  isolation: isolate;
  margin-top: 0;
  padding-top: calc(var(--topbar-h, 120px));
  scroll-margin-top: 90px;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), rgba(0,0,0,.35));
  z-index: -1;
}
.hero .container { max-width: 900px; padding: 2rem 1.25rem; }

/* Badge */
.badge {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 999px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.hero h1 {
  margin: 0 0 .5rem 0;
  font-size: clamp(32px, 4.5vw, 54px);
  line-height: 1.1;
  text-shadow: 0 2px 14px rgba(0,0,0,.4);
}
.hero p {
  margin: 0 0 1.1rem 0;
  font-size: clamp(16px, 1.6vw, 20px);
  color: #fff;
  text-shadow: 0 1px 10px rgba(0,0,0,.35);
}

/* Botões */
.btn {
  display: inline-block;
  padding: 12px 18px;
  border: 2px solid var(--brand);
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all .3s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }

.hero .btn { box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.hero .btn:not(.primary) { border-color: #fff; color: #fff; }
.hero .btn:not(.primary):hover { background: #fff; color: var(--brand); }

/* ==========================================================
   SECÇÕES / GALERIA / TESTEMUNHOS / FOOTER
   ========================================================== */
.section { padding: 10px 20px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
  padding: 32px 20px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  background: #fff;
  text-align: center;
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,.05); }
.card h3 { margin-top: 0; color: var(--brand); }

/* Testemunhos */
.titulo-testemunhos { text-align: center; font-size: 28px; margin-bottom: 20px; }
.testemunhos-slider { position: relative; max-width: 700px; margin: 30px auto; text-align: center; min-height: 150px; }
.slide { display: none; opacity: 0; transition: opacity .8s ease; }
.slide.active { display: block; opacity: 1; }
.note { color: #555; font-size: 14px; margin-top: 5px; }
.dots { text-align: center; margin-top: 15px; }
.dots span {
  height: 10px; width: 10px; margin: 0 5px;
  display: inline-block; background: #ccc;
  border-radius: 50%; cursor: pointer;
  transition: background .3s;
}
.dots span.active { background: var(--brand); }

/* Galeria */
.gallery {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.gallery img {
  width: 100%; height: 220px;
  object-fit: cover; border-radius: 8px;
  cursor: pointer; transition: transform .2s;
}
.gallery img:hover { transform: scale(1.03); }

.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.8);
  display: none; justify-content: center; align-items: center;
  z-index: 9999;
}
.lightbox img {
  max-width: 90%; max-height: 90%;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0,0,0,.6);
}

/* Rodapé + Redes Sociais */
.footer {
  border-top: 1px solid var(--border);
  padding: 10px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #fafafa;
}
.footer p { margin: 4px 0; }

.social-row {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}
.social-link:hover { transform: translateY(-2px); border-color: #ddd; background: #fafafa; }
.icon { width: 22px; height: 22px; display: block; fill: var(--brand); }

/* ==========================================================
   WHATSAPP E COOKIES
   ========================================================== */
.whatsapp-float {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--wa-offset));
  width: 60px; height: 60px;
  background: var(--whatsapp); border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; z-index: 9998;
  transition: transform .2s, background-color .2s, bottom .2s;
}
.whatsapp-float:hover { background: #1ebe5d; transform: scale(1.08); }
.whatsapp-float img { width: 34px; height: 34px; display: block; }

.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
  position: fixed;
  left: 1rem; right: 1rem; bottom: 1rem;
  background: #fff; color: #333;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  z-index: 9999;
}
.cookie-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 16px;
}
.cookie-text { margin: 0; line-height: 1.4; }
.btn-accept {
  margin-left: auto; padding: 8px 14px;
  border: 0; border-radius: 8px;
  background: var(--cookie-accent); color: #fff;
  cursor: pointer; font-weight: 600;
}
.btn-accept:hover { background: var(--cookie-accent-hover); }

/* ==========================================================
   SEM HERO
   ========================================================== */
/* SEM HERO: manter fundo branco, remover linha e sombra */
body:not(:has(.hero)) .topbar {
  background: #fff;
  border-bottom: none;
  box-shadow: none;
}

/* Garantir que mesmo se o JS aplicar .is-solid, continua sem linha/sombra */
body:not(:has(.hero)) .topbar.is-solid {
  border-bottom: none;
  box-shadow: none;
}

body:not(:has(.hero)) main,
body:not(:has(.hero)) .section:first-of-type { margin-top: 120px; }

/* ==========================================================
   PÁGINA: RESERVAS (layout e campos)
   ========================================================== */
.page-reservas .section { padding-top: 60px; } /* respira um pouco abaixo do topo fixo */
.page-reservas .container { max-width: 760px; margin-inline: auto; }

.page-reservas #bookingForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  background: #fff;
  border-radius: 12px;
  padding: 24px;

  /* ALTERAÇÃO 1: remover barra cinza e manter sombra */
  border: none !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.06) !important;
}

/* cada <p> do formulário passa a um campo */
.page-reservas #bookingForm > p { margin: 0; }

/* rótulos e inputs */
.page-reservas #bookingForm label { display: block; font-weight: 600; margin-bottom: 6px; color: #333; }
.page-reservas #bookingForm input,
.page-reservas #bookingForm select,
.page-reservas #bookingForm textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 16px;
  background: #fafafa;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}

/* foco acessível com a cor da marca */
.page-reservas #bookingForm input:focus,
.page-reservas #bookingForm select:focus,
.page-reservas #bookingForm textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

/* colunas (sem alterar HTML) */
.page-reservas #bookingForm p:has(#nome),
.page-reservas #bookingForm p:has(#email),
.page-reservas #bookingForm p:has(#telefone),
.page-reservas #bookingForm p:has(#alojamento),
.page-reservas #bookingForm p:has(#checkin),
.page-reservas #bookingForm p:has(#checkout),
.page-reservas #bookingForm p:has(#adultos),
.page-reservas #bookingForm p:has(#criancas) { grid-column: span 1; }

/* campos que devem ocupar a largura toda */
.page-reservas #bookingForm p:has(#mensagem),
.page-reservas #bookingForm p:has(button),
.page-reservas #status-ok,
.page-reservas #status-err,
.page-reservas #bookingForm p:has(#consent) { grid-column: 1 / -1; }

/* botão no estilo do site — ALTERAÇÃO 2: estados visuais */
.page-reservas #bookingForm button[type="submit"] {
  justify-self: center;
  min-width: 240px;
  position: relative;
  transition: background-color .3s, transform .2s, box-shadow .3s, opacity .2s;
}
.page-reservas #bookingForm button.is-loading {
  pointer-events: none;
  opacity: .85;
}
.page-reservas #bookingForm button.is-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 3px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: reservas-spin .9s linear infinite;
}
.page-reservas #bookingForm button.is-success {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
  transform: scale(1.02);
}
.page-reservas #bookingForm button.is-error {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
  animation: reservas-shake .25s ease-in-out 2;
}

/* mensagens */
.page-reservas #status-ok,
.page-reservas #status-err { text-align: center; font-weight: 600; }

/* responsivo: 1 coluna em ecrãs pequenos */
@media (max-width: 720px) {
  .page-reservas #bookingForm { grid-template-columns: 1fr; }
}

/* ===== Página Reservas: checkbox e botão ===== */
.page-reservas #bookingForm p:has(#consent) {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}
.page-reservas #bookingForm #consent {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}
.page-reservas #bookingForm label { font-weight: 400; }

/* Animações auxiliares */
@keyframes reservas-spin { to { transform: rotate(360deg); } }
@keyframes reservas-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}


/* ===== Reservas: remover a barra cinza entre o formulário e a secção seguinte ===== */
.page-reservas hr,
.page-reservas .section hr,
.page-reservas .container > hr,
.page-reservas [role="separator"] {
  display: none !important;
  border: 0 !important;
  height: 0 !important;
  margin: 0 !important;
}

/* ===========================
   RESERVAS — Simulador (scoped)
   =========================== */

/* Cartão do simulador alinhado ao look do site */
#simulador-precos.simulador{
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:0 4px 14px rgba(0,0,0,.06);
  padding:16px;
}

/* Grid do simulador mantém-se responsivo */
#simulador-precos .sim-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px 20px;
}
@media (max-width: 800px){
  #simulador-precos .sim-grid{ grid-template-columns:1fr; }
}

/* Labels e tipografia */
#simulador-precos label{
  display:block;
  font-weight:600;
  margin-bottom:6px;
  color:#333;
}

/* Inputs arredondados consistentes com o site */
#simulador-precos .round-field{
  width:100%;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fafafa;
  color:var(--text);
  font-size:16px;
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:textfield;
  -webkit-text-fill-color:currentColor;
}
#simulador-precos input[type="date"].round-field{ height:52px; }
#simulador-precos input[type="date"]::-webkit-date-and-time-value{ text-align:left; }

/* Foco com cor da marca (igual ao resto do site) */
#simulador-precos .round-field:focus{
  outline:none;
  border-color:var(--brand);
  background:#fff;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

/* Spinners (setas ↑/↓) dentro do input — alinhados e no tema */
#simulador-precos .with-spinner{ position:relative; }
#simulador-precos .with-spinner .round-field{ padding-right:62px; caret-color:transparent; }
#simulador-precos .with-spinner .spinner{
  position:absolute; right:8px; top:6px; bottom:6px;
  width:36px;
  display:flex; flex-direction:column; justify-content:center; gap:6px;
  pointer-events:auto;
}
#simulador-precos .with-spinner .spinner button{
  width:100%; height:24px;
  display:flex; align-items:center; justify-content:center;
  font-size:16px; line-height:1;
  color:var(--brand);
  background:#fff;
  border:1px solid var(--border);
  border-radius:8px;
  cursor:pointer;
  transition: background-color .2s, transform .08s, border-color .2s, color .2s;
}
#simulador-precos .with-spinner .spinner button:hover{
  background:#faf5f5; /* ligeiro tom coerente com a marca */
  border-color:#e7c6c6;
}
#simulador-precos .with-spinner .spinner button:active{
  transform: translateY(1px);
}
/* Caso estejas a usar SVGs nos botões (chevrons), ficam centrados e nítidos */
#simulador-precos .with-spinner .spinner svg{
  width:16px; height:16px; display:block; pointer-events:none;
}

/* KPIs e total — discreto e coerente */
#simulador-precos .sim-kpi .k{
  background:#fff;
  border:1px dashed var(--border);
  border-radius:10px;
}
#simulador-precos .sim-total{
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
}

/* Mensagens de erro por campo (inline) e realce de erro */
#simulador-precos .round-field.field-error{
  border-color:var(--brand) !important;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent) !important;
  background:#fff;
}
#simulador-precos label.label-error{ color:var(--brand); }
#simulador-precos .field-hint{
  display:block;
  font-size:12px;
  margin-top:6px;
  color:var(--brand);
}
#simulador-precos .field-hint[hidden]{ display:none; }

/* Consentimentos — realce quando faltarem */
#simulador-precos .consent-line.label-error{
  color:var(--brand);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
  border-radius:12px;
  padding:6px;
}
#simulador-precos .consent-line input[type="checkbox"]{
  accent-color: var(--brand);
}

/* Botão principal já herda .btn.primary do site; pequenos estados */
#simulador-precos .btn.primary.is-loading{
  pointer-events:none; opacity:.85; position:relative;
}
#simulador-precos .btn.primary.is-loading::after{
  content:""; position:absolute; top:50%; left:50%;
  width:18px; height:18px; margin:-9px 0 0 -9px;
  border:3px solid #fff; border-top-color:transparent;
  border-radius:50%; animation: reservas-spin .9s linear infinite;
}
#simulador-precos .btn.primary.is-success{
  background:#16a34a; border-color:#16a34a; color:#fff;
  transform:scale(1.02);
}
#simulador-precos .btn.primary.is-error{
  background:#b91c1c; border-color:#b91c1c; color:#fff;
  animation: reservas-shake .25s ease-in-out 2;
}

/* Ajustes mobile: espaço e alinhamento perfeito dos “balões” */
@media (max-width: 720px){
  #simulador-precos .with-spinner .spinner{ right:8px; top:8px; bottom:8px; }
  #simulador-precos .with-spinner .spinner button{ height:26px; }
}

/* Reutiliza as animações já definidas no CSS global (fallback se não existir) */
@keyframes reservas-spin { to { transform: rotate(360deg); } }
@keyframes reservas-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }

   
}
/* ===== Remover hairline sob o menu em páginas sem hero ===== */
body:not(:has(.hero)) .topbar,
body:not(:has(.hero)) .topbar.is-solid,
body:not(:has(.hero)) .topbar.is-hiding,
body:not(:has(.hero)) .topbar.is-hidden {
  background: #fff !important;
  border-bottom: 0 !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

/* Evita a “cicatriz” de 1px durante a transição (promove a camada) */
.topbar {
  backface-visibility: hidden;       /* evita artefacto ao transladar */
  transform: translateZ(0);          /* promove para layer própria */
}

/* (opcional) se ainda vires linha em alguns devices, ativa também: */
/*
.topbar { outline: 1px solid transparent; } 
*/
/* Ajustes do HERO no mobile */
@media (max-width: 768px) {
  .hero {
    /* Foca a parte esquerda da foto */
    background-position: 20% center; /* experimenta 10% / 15% / 25% */

    /* Evita que fique exageradamente alto em ecrãs pequenos */
    min-height: 90vh;

    /* O teu padding-top usa var(--topbar-h, 120px) que no mobile pode ser demais.
       Dá-lhe um teto mais baixo para não “comer” a imagem. */
    padding-top: clamp(70px, 12vw, 100px);
  }
}

/* Afinar ainda mais para telemóveis pequenos */
@media (max-width: 480px) {
  .hero {
    background-position: 15% center; /* ainda mais à esquerda em ecrãs muito estreitos */
    min-height: 85vh;
  }
}

/* ===== Contactos: centrar texto sem afetar o mapa ===== */
.contactos h1,
.contactos p {
  text-align: center;
  margin: 6px auto;
  line-height: 1.6;
  max-width: 720px;
}

.contactos .note {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  color: #555;
}

/* Garantir que o mapa ocupa a largura normal */
.contactos iframe {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  margin: 20px 0 0 0;
}
