/* ============================
   MODALS (base global)
   ============================ */

/* ----------------------------
   SISTEMA ANTIGO (compat)
   .modal-overlay + .active + .modal-box
   ---------------------------- */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal-overlay.active{ display: flex; }

.modal-box{
  background: #fff;
  width: 100%;
  max-width: 420px;
  padding: 28px 30px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  position: relative;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn{
  from { opacity: 0; transform: translateY(-15px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------
   SISTEMA NOVO (unificado)
   .modal + .hidden + .modal-content
   ---------------------------- */
.modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
}

.modal.hidden{ display: none !important; }

.modal-content{
  background: #fff;
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: modalFadeIn 0.20s ease-out;
}

/* Header padrão: Lixeira | Título | Fechar */
.modal-topbar{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

.modal-topbar .modal-titlebar{
  text-align: center;
  background: #4c654f;
  color: #fff;
  padding: 6px 124px;
  font-size: 28px;
  letter-spacing: 1px;
}

@media (max-width: 600px){
  .modal-topbar{
    gap: 6px;
    padding: 5px 6px;
  }
  .modal-topbar .modal-titlebar{
    font-size: 22px;
    padding: 6px 10px;
  }
}

/* ----------------------------
   Trash menu (dropdown) — global
   ---------------------------- */
.trash-menu-wrap{
  position: relative;
  display: inline-block;
}

.trash-menu{
  position: absolute;
  top: 44px;
  left: 0;
  background: #eee;
  border: 1px solid rgba(0,0,0,.25);
  border-radius: 10px;
  padding: 6px;
  min-width: 170px;
  z-index: 7000;
}

.trash-menu-item{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.25);
  background: #fff;
  cursor: pointer;
  text-align: left;
  margin: 4px 0;
}

.trash-menu-item:hover{
  background: #f3f3f3;
}

/* Modais atrás do topo: invisíveis mas continuam abertos */
.modal.modal-behind{
  visibility: hidden;
  pointer-events: none;
}

.pwd-wrap{
  display: flex;
  gap: 8px;
  align-items: center;
}

.pwd-wrap > input{
  flex: 1;
}

.pwd-toggle{
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,.25);
  border-radius: 10px;
  background: #eee;
  cursor: pointer;
  white-space: nowrap;
}

/* =====================================================
   MOBILE — modais altos: permitir scroll SEM ficar preso
   (especialmente no modal Evento)
   ===================================================== */
@media (max-width: 768px){

  /* o overlay passa a permitir scroll e deixa de centrar verticalmente */
  .modal{
    align-items: flex-start !important;
    justify-content: center !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 12px 0; /* dá “ar” e evita colar ao topo */
  }

  /* o content ocupa a largura e limita a altura com margem */
  .modal-content{
    width: calc(100% - 24px) !important;
    max-height: none !important;      /* scroll passa a ser no overlay .modal */
    overflow: visible !important;     /* evita “scroll interno preso” */
    margin: 0 auto !important;
  }
}

/* =====================================================
   EVENTOS / ALERTAS / TODOS EVENTOS
   Aplicar o mesmo layout a modais que usam a mesma grelha/tabela
   ===================================================== */

#modalEventos .modal-content.modal-eventos,
#modalAlertas .modal-content.modal-eventos,
#modalTodosEventos .modal-content.modal-eventos{
  max-width: 700px;
}

#modalEventos .eventos-top,
#modalAlertas .eventos-top,
#modalTodosEventos .eventos-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 14px;
}

#modalEventos .eventos-titlebar,
#modalAlertas .eventos-titlebar,
#modalTodosEventos .eventos-titlebar{
  flex: 1;
  text-align:center;
  background:#4c654f;
  color:#fff;
  padding: 16px 16px;
  font-size: 26px;
  letter-spacing: 1px;
}

#modalEventos .eventos-hint,
#modalAlertas .eventos-hint,
#modalTodosEventos .eventos-hint{
  text-align:center;
  margin: 10px 0 14px;
}

#modalEventos .eventos-table-wrap,
#modalAlertas .eventos-table-wrap,
#modalTodosEventos .eventos-table-wrap{
  border: 1px solid rgba(0,0,0,.25);
  background:#fff;
}

#modalEventos .eventos-table,
#modalAlertas .eventos-table,
#modalTodosEventos .eventos-table{
  width:100%;
  border-collapse: collapse;
}

#modalEventos .eventos-table th,
#modalEventos .eventos-table td,
#modalAlertas .eventos-table th,
#modalAlertas .eventos-table td,
#modalTodosEventos .eventos-table th,
#modalTodosEventos .eventos-table td{
  border: 1px solid rgba(0,0,0,.25);
  padding: 10px 12px;
  text-align:left;
}

#modalEventos .eventos-table th,
#modalAlertas .eventos-table th,
#modalTodosEventos .eventos-table th{
  background:#7e9c7a;
  color:#000;
  font-weight: 600;
}

/* Hover nas linhas */
#modalEventos .eventos-row,
#modalAlertas .eventos-row,
#modalTodosEventos .eventos-row{
  cursor:pointer;
}
#modalEventos .eventos-row:hover,
#modalAlertas .eventos-row:hover,
#modalTodosEventos .eventos-row:hover{
  background: rgba(126,156,122,.14);
}

/* Mobile: esconder a última coluna (situação) quando existir */
@media (max-width: 768px){
  #modalEventos .eventos-table th:nth-child(3),
  #modalEventos .eventos-table td:nth-child(3),
  #modalAlertas .eventos-table th:nth-child(3),
  #modalAlertas .eventos-table td:nth-child(3),
  #modalTodosEventos .eventos-table th:nth-child(3),
  #modalTodosEventos .eventos-table td:nth-child(3){
    display:none;
  }
}

/* =========================================================
   MODAL "A minha ficha" — Layout v2 LIMPO (sem versão gigante)
   (isolado: só afeta #modal-profile)
   ========================================================= */

/* Pequena exceção: cantos arredondados só aqui */
#modal-profile .pf2-card,
#modal-profile input,
#modal-profile select,
#modal-profile textarea{
  border-radius: 12px !important;
}

/* content */
#modal-profile .modal-content{
  width: min(760px, 96vw) !important;
  max-width: none !important;
  background: #e7e2e2;
}

/* título: barra normal (não gigante) */
#modal-profile .login-titlebar{
  font-family: Arial, sans-serif;
  font-weight: 300;
  font-size: 44px;
  padding: 12px 14px;
  letter-spacing: .5px;
}

/* container geral */
#modal-profile .pf2-wrap{
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

/* topo: utilizador */
#modal-profile .pf2-toprow{
  display: grid;
  gap: 16px;
}

/* card utilizador */
#modal-profile .pf2-user-card{
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(0,0,0,.25);
  background: #f5f5f5;
}
#modal-profile .pf2-user-head{
  background: #4c654f;
  color: #fff;
  text-align: center;
  font-size: 18px;
  padding: 8px 10px;
}
#modal-profile .pf2-user-body{
  padding: 12px 10px 14px;
  text-align: center;
}
#modal-profile .pf2-user-name{
  font-size: 18px;
  font-weight: 600;
  opacity: .85;
  margin-bottom: 10px;
  word-break: break-word;
}
#modal-profile .pf2-user-hint{
  font-size: 14px;
  line-height: 1.2;
}

/* 3 cards em linha */
#modal-profile .pf2-row{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

#modal-profile .pf2-card{
  border: 1px solid rgba(0,0,0,.25);
  background: #d8cfb1;
  border-radius: 18px;
  padding: 16px;
  min-height: 86px;
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1.08;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

#modal-profile .pf2-btn{
  cursor: pointer;
}

#modal-profile .pf2-card-title{
  font-weight: 500;
}

#modal-profile .pf2-radio-row{
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 26px;
  font-size: 14px;
}

#modal-profile .pf2-radio{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#modal-profile .pf2-card-hint{
  margin-top: 8px;
  font-size: 12px;
  opacity: .8;
}

/* Mobile */
@media (max-width: 980px){
  #modal-profile .pf2-row{
    grid-template-columns: 1fr;
  }
  #modal-profile .login-titlebar{
    font-size: 34px;
  }
}


/* ============================
   Videoclips modal (home)
   ============================ */

.vc-modal-box{
  max-width: 520px !important;
  background: #e9e4e4;
}

.vc-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  padding: 18px 18px;
  background: transparent;
}

.vc-title{
  background: #4a6a57;
  color: #fff;
  padding: 10px 22px;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: .6px;
  border-radius: 0; /* igual ao mock */
  line-height: 1;
}

.vc-close{
  background: #cfcfcf;
  border: 1px solid rgba(0,0,0,.25);
  border-radius: 12px;
  padding: 10px 18px;
  cursor:pointer;
  font-size: 18px;
}

.vc-body{
  padding: 4px 22px 22px;
}

.vc-list{
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  color: #1a1a1a;
  font-size: 20px;
  line-height: 1.35;
}

.vc-list li{
  margin: 6px 0;
}

.vc-list a{
  display:flex;
  align-items:center;
  gap: 10px;
  color:#1a1a1a;
  text-decoration:none;
}

.vc-list a:hover{
  text-decoration: underline;
}

.vc-ico{
  width: 22px;
  height: 14px;
  background: #4a6a57;
  border-radius: 3px;
  display:inline-block;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.18);
}

.vc-actions{
  margin-top: 18px;
  display:flex;
  justify-content:center;
}

.vc-primary{
  display:inline-block;
  background:#4a6a57;
  color:#fff;
  padding: 12px 26px;
  border-radius: 14px;
  text-decoration:none;
  font-weight: 700;
}

.vc-primary:hover{
  filter: brightness(1.05);
}

@media (max-width: 768px){
  .vc-modal-box{ max-width: 96vw !important; }
  .vc-title{ font-size: 32px; padding: 10px 16px; }
  .vc-list{ font-size: 18px; }
}
.modal.hidden,
.modal[hidden]{
  display:none !important;
}
/* =========================================================
   MODAL "A minha ficha" — OVERRIDE FINAL (layout pedido)
   ========================================================= */

#modal-profile .modal-content.modal-profile{
  width: min(760px, 96vw) !important;
  max-width: none !important;
  background: #e7e2e2 !important;
}

/* Topo: barra verde + botão fechar à direita (como no resto do programa) */
#modal-profile .pfv2-top{
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  gap: 14px !important;
  align-items: start !important;
  margin-bottom: 14px !important;
}

#modal-profile .pfv2-titlebar{
  background: #4c654f !important;
  color: #fff !important;
  text-align: center !important;
  font-family: Arial, sans-serif !important;
  font-weight: 300 !important;
  font-size: 56px !important;
  line-height: 1.05 !important;
  padding: 12px 14px !important;
  letter-spacing: .5px !important;
}

/* Caixa grande */
#modal-profile .pfv2-box{
  border: 2px solid rgba(0,0,0,.25);
  background: #eee;
  border-radius: 18px;
  padding: 16px 16px 18px;
}

/* “Utilizador: Nome” */
#modal-profile .pfv2-who{
  padding: 10px 10px 14px;
}

#modal-profile .pfv2-who-row{
  font-size: 26px;
  font-family: Arial, sans-serif;
  line-height: 1.1;
}

#modal-profile .pfv2-who-label{
  font-weight: 400;
  margin-right: 8px;
}

#modal-profile .pfv2-who-name{
  font-weight: 700;
}

#modal-profile .pfv2-who-hint{
  margin-top: 8px;
  font-size: 22px;
  font-family: Arial, sans-serif;
}

/* 3 botões/cards */
#modal-profile .pfv2-row{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 10px;
}

#modal-profile .pfv2-card{
  border: 1px solid rgba(0,0,0,.25);
  background: #d8cfb1;
  border-radius: 18px;
  padding: 16px;
  min-height: 90px;
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1.08;
  text-align: center;
}

#modal-profile .pfv2-btn{
  cursor: pointer;
}

/* Card alertas: título + radios ao lado (como pediste) */
#modal-profile .pfv2-card-grid{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

#modal-profile .pfv2-card-title{
  font-weight: 500;
}

#modal-profile .pfv2-radios{
  display: grid;
  gap: 8px;
  justify-items: start;
  font-size: 16px;
}

#modal-profile .pfv2-radio{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#modal-profile .pfv2-card-hint{
  margin-top: 10px;
  font-size: 12px;
  opacity: .8;
}

/* Mobile */
@media (max-width: 980px){
  #modal-profile .pfv2-titlebar{ font-size: 44px !important; }
  #modal-profile .pfv2-row{ grid-template-columns: 1fr; }
  #modal-profile .pfv2-card-grid{ grid-template-columns: 1fr; justify-items: center; }
  #modal-profile .pfv2-radios{ justify-items: center; }
}
/* =========================================================
   OVERRIDE FINAL — MODAL "Alterar Password" (#modal-change)
   ========================================================= */

#modal-change .modal-content.modal-login{
  width: min(860px, 96vw) !important;
  background: #e7e2e2 !important;
}

/* Topo igual ao padrão (barra verde centrada + Fechar à direita) */
#modal-change .login-top{
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  gap: 14px !important;
  align-items: start !important;
  margin-bottom: 18px !important;
}

#modal-change .login-titlebar{
  justify-self: center !important;
  width: min(560px, 80%) !important;
  background: #4c654f !important;
  color: #fff !important;
  text-align: center !important;
  font-family: Arial, sans-serif !important;
  font-weight: 300 !important;
  font-size: 46px !important;
  line-height: 1.05 !important;
  padding: 12px 18px !important;
}

#modal-change [data-close="modal-change"]{
  justify-self: end !important;
}

/* Campos alinhados */
#modal-change .login-grid{
  margin: 0 auto !important;
  width: min(720px, 92%) !important;
  display: grid !important;
  grid-template-columns: 260px 1fr !important;
  gap: 18px 18px !important;
  align-items: center !important;
}

#modal-change .login-label{
  font-size: 24px !important;
  font-weight: 300 !important;
  text-align: right !important;
  padding-right: 10px !important;
}

#modal-change .login-input{
  height: 38px !important;
  font-size: 18px !important;
  padding: 8px 10px !important;
  border: 2px solid rgba(0,0,0,.45) !important;
  background: #fff !important;
}

/* password + botões mostrar */
#modal-change .pwd-wrap{
  display: grid !important;
  grid-template-columns: 1fr 130px !important;
  gap: 12px !important;
  align-items: center !important;
}

#modal-change .pwd-toggle{
  height: 44px !important;
  font-size: 18px !important;
  border-radius: 16px !important;
}

/* Gravar centrado */
#modal-change .login-actions{
  display: flex !important;
  justify-content: center !important;
  margin-top: 40px !important;
}

#modal-change #btnChangeSubmit{
  min-width: 220px !important;
}
#modal-change #btnChangeSubmit{
  height: 72px !important;      /* mais alto */
  font-size: 24px !important;   /* texto maior (ajusta se quiseres) */
  font-weight: 100 !important;
  border-radius: 18px !important;
  padding: 0 34px !important;
}

/* Mobile */
@media (max-width: 820px){
  #modal-change .login-titlebar{ font-size: 44px !important; width: min(520px, 92%) !important; }
  #modal-change .login-grid{ grid-template-columns: 1fr !important; }
  #modal-change .login-label{ text-align: left !important; padding-right: 0 !important; font-size: 22px !important; }
  #modal-change .pwd-wrap{ grid-template-columns: 1fr !important; }
}

/* ===== Modal QA Reauth (P/R) ===== */

.modal-qa-reauth-content{
  width: min(520px, calc(100vw - 28px));   /* evita overflow no telemóvel */
  max-width: 520px;
  box-sizing: border-box;
  overflow-x: hidden;                       /* impede scroll lateral */
}

.modal-qa-reauth-content *{
  box-sizing: border-box;                   /* muito importante para não estourar largura */
}

.qa-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  background: #4c654f;
  border-radius: 14px;
  padding: 14px 16px;
}

.qa-titlebar{
  color: #fff;
  font-size: 30px;        /* ajusta aqui */
  font-weight: 600;
  line-height: 1.05;
  margin: 0;
}

/* Grelha das perguntas/respostas */
.qa-grid{
  margin-top: 14px;
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 10px 12px;
  align-items: center;
}

/* Em ecrãs pequenos, evita excesso */
@media (max-width: 520px){
  .qa-titlebar{ font-size: 22px; }
  .qa-grid{ grid-template-columns: 54px 1fr; }
}

.qa-lab{
  font-weight: 700;
}

.qa-field{ min-width: 0; }   /* permite o conteúdo encolher sem criar overflow */

.qa-question{
  width: 100%;
  background: #eee;
  border: 1px solid rgba(0,0,0,.25);
  border-radius: 10px;
  padding: 10px 12px;
  overflow-wrap: anywhere;    /* impede “estourar” */
}

.qa-input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.35);
}

.qa-actions{
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.qa-btn-main{
  min-width: 220px;
}
