/* ==========================================================================
   Cantinho Luso — Gestor de Consentimento de Cookies e RGPD ao Entrar no Site (V5)
   Conformidade: Regulamento Geral sobre a Proteção de Dados (RGPD - UE 2016/679)
   Diretiva Privacidade e Comunicações Eletrónicas (2002/58/CE) e Lei n.º 41/2004
   ========================================================================== */

/* Banner / Notificação de Cookies e RGPD */
#cl-consent-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: auto;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
  z-index: 10000000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#cl-consent-overlay.cl-active {
  display: flex;
  animation: clSlideUp 0.3s ease-out;
}

#cl-consent-overlay.cl-modal-mode {
  top: 0;
  background: rgba(16, 60, 47, 0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  align-items: center;
  pointer-events: auto;
}

@keyframes clSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Caixa Principal do Banner */
#cl-consent-card {
  pointer-events: auto;
  background: #ffffff;
  border-radius: 12px;
  border: 2px solid #ad7622;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  max-width: 660px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Topo do Modal */
.cl-header {
  background: #103c2f;
  color: #fff6e8;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 3px solid #ad7622;
}

.cl-header-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}

.cl-header-text {
  flex: 1 1 auto;
}

.cl-header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #f8deaa;
  letter-spacing: 0.3px;
}

.cl-header-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: #d6ccba;
}

/* Corpo do Modal */
.cl-body {
  padding: 22px 26px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.55;
  color: #2e2b27;
}

.cl-intro-text {
  margin: 0 0 16px;
  color: #3d3730;
}

.cl-intro-text a {
  color: #791923;
  font-weight: 600;
  text-decoration: underline;
}

/* Caixas de Categoria */
.cl-category {
  background: #fdfaf5;
  border: 1px solid #e7dcc9;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.cl-category-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cl-category-label {
  font-weight: 700;
  font-size: 14px;
  color: #103c2f;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cl-badge-req {
  background: #e8efe8;
  color: #103c2f;
  border: 1px solid #a3c4a8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.cl-category-desc {
  font-size: 12.5px;
  color: #5c5347;
  margin: 0;
  line-height: 1.45;
}

/* Switches de Alternância */
.cl-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cl-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cl-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #c9c0ae;
  transition: 0.2s;
  border-radius: 24px;
}

.cl-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.cl-switch input:checked + .cl-slider {
  background-color: #103c2f;
}

.cl-switch input:focus + .cl-slider {
  box-shadow: 0 0 0 2px #ad7622;
}

.cl-switch input:checked + .cl-slider:before {
  transform: translateX(20px);
}

.cl-switch input:disabled + .cl-slider {
  opacity: 0.65;
  cursor: not-allowed;
  background-color: #103c2f;
}

/* Painel de Preferências Expansível */
#cl-custom-options {
  display: none;
  margin-top: 14px;
  animation: clFadeIn 0.2s ease-out;
}

#cl-custom-options.cl-visible {
  display: block;
}

/* Rodapé de Ações */
.cl-footer {
  background: #f7eee0;
  border-top: 1px solid #e7dcc9;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cl-footer-actions-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: flex-end;
}

/* Botões do Diálogo */
.cl-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}

.cl-btn-accept-all {
  background: #103c2f;
  color: #ffffff;
  border-color: #0b2b21;
}

.cl-btn-accept-all:hover {
  background: #0b2b21;
  box-shadow: 0 2px 8px rgba(16, 60, 47, 0.35);
}

.cl-btn-essential-only {
  background: #ffffff;
  color: #791923;
  border-color: #caa870;
}

.cl-btn-essential-only:hover {
  background: #fdf5e8;
  border-color: #791923;
}

.cl-btn-toggle-options {
  background: transparent;
  color: #553b16;
  border-color: #d8cbbb;
  font-weight: 600;
}

.cl-btn-toggle-options:hover {
  background: #efe4d2;
  color: #103c2f;
}

/* Pequeno aviso de gestão permanente no rodapé */
.cl-manage-badge {
  display: inline-block;
  cursor: pointer;
  color: #804600;
  text-decoration: underline;
  font-size: 11px;
}

/* Responsividade Mobile */
@media (max-width: 640px) {
  .cl-header {
    padding: 14px 18px;
  }
  .cl-header-logo {
    width: 38px;
    height: 38px;
  }
  .cl-header-title {
    font-size: 16px;
  }
  .cl-body {
    padding: 16px 18px;
  }
  .cl-footer {
    padding: 14px 18px;
  }
  .cl-footer-actions-main {
    flex-direction: column;
    align-items: stretch;
  }
  .cl-action-btn {
    width: 100%;
    padding: 11px;
  }
}
