/* Basic reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body */
body {
    font-family: Arial, sans-serif;
    color: #333;
    position: relative;
    z-index: 0;
    
}

body::before {
    content: "";
    position: fixed;
    inset: 0; /* equivale a top:0; right:0; bottom:0; left:0 */
    background-image: url('/backgroundazul.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;   /* impede que o fundo intercepte cliques */
    overflow: hidden;       /* evita que cause barras de rolagem */
}

html, body {
    overflow-x: hidden;
    overflow-y: auto;
}

/* Header and navigation menu */
header {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif, sans-serif;
    background-color: white;
    padding: 15px 0;
    text-align: center;
    
}



nav ul {
    list-style: none;
    display: flex;
    justify-content: space-between; /* Separates elements */
    padding: 0 20px;
}

/* Group first three links on the left */
.nav-left {
    display: flex;
    padding-left: 40px;
    gap: 20px; /* Adjust spacing between links */ 
}

.nav-left a {
   /* color: #586875;  Cor do link */
    text-decoration: none; /* Remove o sublinhado */
}

/* Move 'Marcaçoes' to the right */
.nav-right {
    margin-left: auto; /* Pushes it to the right */
    padding-right: 50px;
    position: relative;
    top: 10px;  /* Move um pouco para baixo , position relative é necessario */
}

/*Opçoes botao Marcações *******************************************/
nav ul li.marcacoes a {
   
    color: black;
    padding: 10px 18px;
    border-radius: 8px;    
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 2.2);
    border: 2px solid black;
}

nav ul li.marcacoes a:hover {
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.3);
}


/*********************************************************/
nav ul li {
    display: inline;
}

/* Fonte e cor dos links *******************************************/
nav ul li a {
    color:   black;
    text-decoration: none;
    font-size: 22px;
    padding: 10px;
}

nav ul li a:hover {
    border-bottom: 2px solid#272727;
}

html, body {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0; /* garantir que não há margens brancas */
}


/* Main section */

main {
    
    flex: 1;
}

.services-container {
    display: flex;
    flex-direction: column; /* vertical stack */
    align-items: flex-start; /* align left */
    gap: 20px;
    width: 100%;
}

.service-item {
    width: 500px;
    height: 120px;
    perspective: 1000px;
     width: 85%;
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.service-item:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 15px;
    box-sizing: border-box;
}

.card-back {
    transform: rotateY(180deg);
}

.service-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.front-content,
.back-content {
    margin-left: 15px;
    flex: 1;
}

.service-title {
    font-size: 1.7em;
    font-weight: bold;
    margin: 0;
    color: #333;
}

.service-text {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 0.95em;
    color: #555;
    margin: 0;
    text-align: justify;
}

/*****************************************************/


/* Footer */
footer {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    background-color: white;
    padding: 15px 0;
    text-align: center;
    margin-top: auto; /* Move o footer para baixo ou cima */
    font-size: 14px;
    color: #333;
}

footer a {
    color: #333;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Esconde completamente o popup e o botão X em desktop 
.service-popup,
.close-popup {
  display: none !important;
}  */

.service-popup {
  display: none; /* escondido por padrão */
}

/* ===== MOBILE SMARTPHONE LAYOUT =========================================================== */
@media (max-width: 768px) {

 /* Ensure the burger button positions correctly */
  header nav {
    position: relative; /* allows absolute burger menu to be top-right */
    z-index: 2000;
  }

  /* Make list items vertical on mobile */

  /* Make all links same style */
  nav ul li {
    display: block;
    width: 100%;
    margin: 5px 0;      /* smaller spacing */
    text-align: left;
  }

  .nav-left {
    padding-left: 0;
    gap: 0; /* opcional: remove o espaçamento extra se quiser que fiquem bem justificados */
    flex-direction: column; /* já faz no seu CSS, mas reforça */
  }

/*
nav ul li.marcacoes {
    margin-left: 5;  /* Remove o margin-left: auto do desktop 
    padding-right: 0; /* Remove padding extra 
  }  */  

nav ul li.marcacoes a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 0;
  padding-left: 11px;  
  border: none;
  box-shadow: none;
  background: none;
  color: #007FFF;        /* tom mais suave que o preto puro */
  font-size: 18px;    /* igual aos outros links */
  font-weight: 500;   /* ligeiramente mais elegante */
}

  /* === MOBILE BURGER MENU (opened state) === */
nav ul {
  /* substituímos display:none por isto 👇 */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background-color: #ffffff;
  position: absolute;
  top: 7px; /* quanto maior mais se afasta do topo */
  left: 0;
  right: 0;
  padding: 15px 25px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;

  /* animação suave */
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.01s ease-out, opacity 0.1s ease-out;
}

/* quando o menu é aberto */
nav ul.active {
  max-height: 400px; /* ajusta conforme o número de itens */
  opacity: 1;
  transition: max-height 0.5s ease-in, opacity 0.3s ease-in;
}

/* === LINKS DENTRO DO MENU === */
nav ul li {
  width: 100%;
  padding: 10px 0;           /* menos espaçamento entre links */
  border-bottom: 1px solid #eee; /* linha separadora leve */
}

nav ul li:last-child {
  border-bottom: none;
}

nav ul li a {
  color: #222;
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.5px;
  display: block;
  width: 100%;
  transition: all 0.2s ease;
}

/* Hover estilizado */
nav ul li a:hover {
  color: #0077b6;          /* azul moderno */
  background-color: #f4f4f4;
  border-radius: 4px;
}


  /* === HAMBURGER MENU ICON (mobile) === */
.menu-toggle {
  position: absolute;
  top: 10px;     /* Quanto mais pequeno mais proximo do topo - sobe o menu  */
  right: 35px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 40px;
  height: 26px;
  cursor: pointer;
  background: none;     /* sem fundo branco */
  border: none;         /* sem borda */
  box-shadow: none;     /* sem sombra */
  z-index: 9999;        /* sobrepõe tudo */
}

.menu-toggle div {
  width: 100%;
  height: 4px;          /* espessura da linha */
  background-color: rgb(86, 83, 83); /* linhas pretas sólidas */
  margin: 0;            /* sem espaços extras */
  transition: all 0.3s ease;
  transform-origin: center; 
}

.menu-toggle.open div {
  display: none;
}

/* Mostra um X fixo no centro */
.menu-toggle.open::before {
  content: "X";
  font-size: 32px;
  color: black;
  position: absolute;
  top: -4px;
  right: 4px;
}

html, body {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}


  /* Background ligeiramente deslocado para baixo */
  body::before {
    background-position: center 10vh; /* desce um pouco o background */
  }


  /* Main content */
  main {
    flex: 1;            /* ocupa o espaço entre header e footer */
    display: flex;
    flex-direction: column;
    align-items: center;
   justify-content: flex-start; /* antes era center, muda para top */
    gap: 20px;
    padding: 0 10px;
    min-height: 100%;  
    margin-top: 15vh; /* 15% da altura do ecrã */
  }

  .services-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .service-item {
    width: 90%;
    max-width: 500px;
  }

  .card, .card-inner, .card-front, .card-back {
    width: 100%;
    height: auto;
  }

  .service-item {
    cursor: pointer;
}

  .card-front, .card-back { padding: 15px; }

  .service-image img { width: 80px; height: 80px; }

  .front-content, .back-content { margin-left: 10px; }

  .service-title { 
    font-size: 1.3em;
    width: 100%;             /* ocupa toda a largura do card */
    word-break: break-word;  /* permite quebrar palavras longas */
    white-space: normal; 
    text-align: center;
     }

  .service-text { font-size: 0.95em; }

/* === DESATIVA FLIP CARD NO MOBILE === */
.card-inner {
    transform: none !important;  /* desativa rotação */
}

.service-item:hover .card-inner {
    transform: none !important;  /* remove hover */
}

.card-back {
    display: none;  /* esconde o verso do card */
    visibility: hidden;
}

/* Popup mobile */
.service-popup {
    position: fixed;
    top: 10vh;           /* distancia do topo */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;    /* não ultrapassa 80% da altura da tela */
    overflow-y: auto;    /* permite scroll só dentro do popup se necessário */
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 12px;
    z-index: 2000;
    display: none;       /* inicialmente escondido */
    padding: 20px;
}


.popup-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.close-popup {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.popup-title {
    font-size: 1.5em;
    text-align: center;
    margin-bottom: 10px;
}

.popup-text {
    font-size: 1em;
    line-height: 1.4;
}

/* === DESKTOP: Esconde completamente === */
@media (min-width: 769px) {
  .service-popup {
    display: none !important;
  }
}

/* Só mostra o botão X e o popup no mobile quando estiverem ativos 
.service-popup.active {
  display: block !important;
}

.service-popup.active .close-popup {
  display: block;
}


*/


/* Footer fixo */
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background-color: white;
    padding: 10px;
    z-index: 1000;
  }

  footer a { display: inline; margin: 0 5px; }
}

/* Overlay escondido por padrão */
#portrait-warning {
    position: fixed;
    inset: 0; 
    background-color: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    text-align: center;
    padding: 20px;
}

#portrait-warning .warning-message {
    font-size: 1.5em;
    color: #333;
    font-weight: bold;
}

/* Impede scroll quando o aviso está ativo */
body.landscape-warning {
    overflow: hidden !important;
    height: 100vh;
}

/* Aplica blur em todo o conteúdo quando overlay ativo */
body.landscape-warning main,
body.landscape-warning header,
body.landscape-warning footer {
    filter: blur(5px);
    pointer-events: none; 
}  

/* Aplica layout mobile mesmo em landscape para telemóveis */
@media screen and (max-width: 1024px) and (orientation: landscape) {

html, body {
    overflow-y: auto;   /* habilita scroll vertical */
    height: auto;       /* ajusta altura */
  }

  main {
    padding: 0 15px;
    margin-top: 15vh;
    padding-bottom: 80px; /* espaço extra para footer */
  }

  .services-container {
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .service-item {
    width: 90%;
    max-width: 500px;
  }

  .service-title { font-size: 1.3em; }
  .service-text { font-size: 0.95em; }

  footer {
    position: relative;  /* não fixa mais no fundo */
  }

  
}