:root {
  /* =========================================================
     CORES DA MARCA
     ========================================================= */
  --brand-green: #064e3b;
  --brand-green-light: #0d7455;
  --brand-cream: #f8e7c9;
  --brand-cream-dark: #e3cc9e;

  /* =========================================================
     TEMA CLARO
     ========================================================= */
  --bg-main: #ffffff;
  --bg-alt: #faf8f5;
  --bg-card: #f3efe6;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;

  --header-bg: var(--brand-green);
  --header-text: #ffffff;

  --hero-bg-start: var(--brand-green);
  --hero-bg-end: var(--brand-green-light);

  --section-title-color: var(--brand-green);
  --component-accent: var(--brand-green);
  --component-accent-text: var(--brand-green);
  --today-bg: rgba(6, 78, 59, 0.08);

  /* Estado do horário */
  --color-open: #059669;
  --bg-open: #d1fae5;
  --color-closing: #d97706;
  --bg-closing: #fef3c7;
  --color-closed: #dc2626;
  --bg-closed: #fee2e2;
  --color-service: #ffffff;
  --bg-service: #652b65;

  /* Layout */
  --wrapper-width: 900px;
  --page-padding: 1.5rem;
  --section-spacing: 3.5rem;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

/* =========================================================
   TEMA ESCURO — ÚNICO BLOCO DE DARK MODE
   ========================================================= */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: #0a1411;
    --bg-alt: #10201b;
    --bg-card: #162c25;
    --text-main: #f3f4f6;
    --text-muted: #a7b0ac;
    --border-color: #1e3a32;

    --header-bg: #043327;
    --header-text: #ffffff;

    --hero-bg-start: #043327;
    --hero-bg-end: #0c4d3b;

    --section-title-color: var(--brand-cream);
    --component-accent: var(--brand-cream);
    --component-accent-text: var(--brand-green-light);
    --today-bg: rgba(248, 231, 201, 0.08);

    --bg-open: #064e3b;
    --color-open: #a7f3d0;
    --bg-closing: #78350f;
    --color-closing: #fde68a;
    --bg-closed: #7f1d1d;
    --color-closed: #fca5a5;
    --bg-service: #652b65;
    --color-service: #ffffff;
  }
}

/* =========================================================
   RESET / BASE
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
  touch-action: pan-x pan-y;
}

body {
  margin: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

img {
  display: block;
  max-width: 100%;
}

a,
a:active,
a:link,
a:hover,
a:visited {
  font-weight: inherit;
  text-decoration: inherit;
  text-transform: inherit;
}

.wrapper {
  width: min(100% - (var(--page-padding) * 2), var(--wrapper-width));
  margin-inline: auto;
}

/* =========================================================
   MÁSCARA CSS REUTILIZÁVEL PARA ÍCONES SVG PRETOS
   ========================================================= */
.icon-mask {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  flex-shrink: 0;
}

/* Mapeamento de ficheiros SVG na pasta images/icons/ */
.icon-phone {
  -webkit-mask-image: url('../images/icons/phone-fill.svg');
  mask-image: url('../images/icons/phone-fill.svg');
}

.icon-pin {
  -webkit-mask-image: url('../images/icons/pin-fill.svg');
  mask-image: url('../images/icons/pin-fill.svg');
}

.icon-clock {
  -webkit-mask-image: url('../images/icons/clock-fill.svg');
  mask-image: url('../images/icons/clock-fill.svg');
}

.icon-colesterol {
  -webkit-mask-image: url('../images/icons/colesterol_glicemia_trigliceridos.svg');
  mask-image: url('../images/icons/colesterol_glicemia_trigliceridos.svg');
}

.icon-peso {
  -webkit-mask-image: url('../images/icons/controlo_peso.svg');
  mask-image: url('../images/icons/controlo_peso.svg');
}

.icon-pim {
  -webkit-mask-image: url('../images/icons/pim.svg');
  mask-image: url('../images/icons/pim.svg');
}


.icon-tensao {
  -webkit-mask-image: url('../images/icons/tensao_arterial.svg');
  mask-image: url('../images/icons/tensao_arterial.svg');
}

.icon-materno {
  -webkit-mask-image: url('../images/icons/aconselhamento_materno.svg');
  mask-image: url('../images/icons/aconselhamento_materno.svg');
}

.icon-nutricao {
  -webkit-mask-image: url('../images/icons/consultas_nutricao.svg');
  mask-image: url('../images/icons/consultas_nutricao.svg');
}

.icon-solares {
  -webkit-mask-image: url('../images/icons/dermocosmetica_solares.svg');
  mask-image: url('../images/icons/dermocosmetica_solares.svg');
}

.icon-map-google {
  -webkit-mask-image: url('../images/icons/map_google.svg');
  mask-image: url('../images/icons/map_google.svg');
}

.icon-map-apple {
  -webkit-mask-image: url('../images/icons/map_apple.svg');
  mask-image: url('../images/icons/map_apple.svg');
}

.icon-map-osm {
  -webkit-mask-image: url('../images/icons/map_osm.svg');
  mask-image: url('../images/icons/map_osm.svg');
}

.icon-lingua {
  -webkit-mask-image: url('../images/icons/lingua.svg');
  mask-image: url('../images/icons/lingua.svg');
}

/* =========================================================
   SECÇÕES
   ========================================================= */
.section {
  width: 100%;
  padding: var(--section-spacing) 0;
  border-bottom: 1px solid var(--border-color);
}

.section-main {
  background-color: var(--bg-main);
}

.section-alt {
  background-color: var(--bg-alt);
}

.section h2 {
  margin: 0 0 1.25rem;
  color: var(--section-title-color);
  font-size: clamp(1.65rem, 1.45rem + 0.75vw, 2rem);
  line-height: 1.2;
}

/* =========================================================
   HEADER
   ========================================================= */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
  padding-top: max(1rem, env(safe-area-inset-top));
  background-color: var(--header-bg);
  color: var(--header-text);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
}

.header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

#backToTop{
  width: 280px;
  max-width: 100%;
  aspect-ratio: 280 / 70;
  padding: 0;
  border: 0;
  background-color: var(--brand-cream);
  -webkit-mask: url("../images/logo_longo_2.svg") center / contain no-repeat;
  mask: url("../images/logo_longo_2.svg") center / contain no-repeat;
}

/* =========================================================
   ESTADO DO HORÁRIO
   ========================================================= */
.status-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-md);
  text-align: right;
}

.status-main-text {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-main-text::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background-color: currentColor;
}

.status-sub-text {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.9;
  white-space: nowrap;
  margin-top: -0.45rem;
}

.status-badge.open {
  background-color: var(--bg-open);
  color: var(--color-open);
}

.status-badge.closing-soon {
  background-color: var(--bg-closing);
  color: var(--color-closing);
}

.status-badge.closed {
  background-color: var(--bg-closed);
  color: var(--color-closed);
}

.status-badge.service {
  background-color: var(--bg-service);
  color: var(--color-service);
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  padding: 4rem 0;
  border-bottom: 0;
  background: linear-gradient(135deg, var(--hero-bg-start) 0%, var(--hero-bg-end) 100%);
  color: #ffffff;
}

.hero-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.hero-content,
.hero-image-container {
  flex: 1;
  min-width: 0;
}

.hero-content h2 {
  margin-bottom: 1rem;
  color: var(--brand-cream);
  font-size: clamp(2.15rem, 1.7rem + 2vw, 3.25rem);
  line-height: 1.1;
}

.hero-tagline {
  max-width: 42rem;
  margin: 0 0 1.75rem;
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.2rem);
  opacity: 0.95;
}

.hero-image-container {
  width: 100%;
  max-width: 420px;
}

.hero-image {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 3px solid rgba(248, 231, 201, 0.3);
  border-radius: var(--radius-lg);
}

.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600 !important;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background-color: var(--brand-cream);
  color: var(--brand-green) !important;
}

.btn-primary:hover {
  background-color: var(--brand-cream-dark);
}

.btn-outline {
  border: 2px solid var(--brand-cream);
  background-color: transparent;
  color: var(--brand-cream);
}

.btn-outline:hover {
  background-color: rgba(248, 231, 201, 0.15);
}

/* =========================================================
   SOBRE A FARMÁCIA
   ========================================================= */

.about-text p {
  margin: 0 0 1.1rem;
  color: var(--text-main);
  font-size: 1.05rem;
}

.about-text p a{
  color: var(--text-main);
}

.about-text p:last-of-type {
  margin-bottom: 1.75rem;
}

.values-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.value-badge {
  padding: 0.25rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background-color: var(--bg-card);
  color: var(--component-accent-text);
  font-size: 0.95rem;
  font-weight: 700;
}

/* =========================================================
   SERVIÇOS
   ========================================================= */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
  
.service-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background-color: var(--bg-card);
  transition: 250ms;
  box-shadow: 0 5px 5px rgba(0,0,0,0.15);
  /*
  border-left: 4px solid var(--component-accent);
  */
}

.service-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 8px 8px rgba(0,0,0,0.35);
  transition: 150ms;
}

.service-card .icon-mask {
  width: 40px;
  height: 40px;
  background-color: var(--component-accent);
}

.service-card h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.1rem;
  line-height: 1.3;
}

.service-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* =========================================================
   HORÁRIO
   ========================================================= */
.schedule-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.schedule-item {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 1rem;
}

.schedule-item:last-child {
  border-bottom: 0;
}

.schedule-item.today {
  color: var(--color-open);
  font-weight: 700;
}

/* =========================================================
   CONTACTOS & POPUP DE MAPAS
   ========================================================= */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-item span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.info-item a,
.info-item p {
  margin: 0;
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
}

.info-item p.info-subtext {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.info-item a:hover {
  text-underline-offset: 0.2em;
}

.btn-maps-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--component-accent);
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--component-accent-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-maps-trigger:hover {
  background-color: var(--today-bg);
}

/* Modal <dialog> */
.maps-dialog {
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background-color: var(--bg-main);
  color: var(--text-main);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  max-width: 400px;
  width: 90%;
}

.maps-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.maps-dialog-content {
  padding: 1.5rem;
}

.maps-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.maps-dialog-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-main);
}

.btn-close-dialog {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.btn-close-dialog:hover {
  color: var(--text-main);
  background-color: var(--bg-card);
}

.maps-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.map-option-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.map-option-btn .icon-mask {
  width: 22px;
  height: 22px;
  background-color: var(--component-accent);
}

.map-option-btn:hover {
  border-color: var(--component-accent);
  transform: translateY(-1px);
}

/* =========================================================
   FOOTER & SELETOR DE IDIOMA DISCRETO
   ========================================================= */
footer {
  padding: 2.5rem 0;
  background-color: var(--bg-main);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

footer p {
  margin: 0;
}

footer a {
  color: inherit !important;
}

.lang-selector{
  display: flex;
  align-items: center;
  gap: 0.5em
}

.lang-selector select {
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* =========================================================
   RESPONSIVIDADE
   ========================================================= */
@media (min-width: 768px) {
  .hero-grid {
    flex-direction: row;
    justify-content: space-between;
  }
}

@media (max-width: 767px) {
  .hero-content {
    text-align: center;
  }

  .hero-tagline {
    margin-inline: auto;
  }

  .cta-buttons {
    justify-content: center;
  }

  .footer-wrapper {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 600px) {
  :root {
    --page-padding: 1rem;
    --section-spacing: 3rem;
  }

  .brand h1 {
    font-size: 1.05rem;
  }

  .status-badge {
    padding-inline: 0.65rem;
  }

  .status-main-text {
    font-size: 0.78rem;
  }

  .status-sub-text {
    font-size: 0.68rem;
  }

  .cta-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .schedule-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
  }
}

/* =========================================================
   ACESSIBILIDADE: REDUZIR ANIMAÇÕES
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
