/* CookieFirst en modo stealth oculta su propio diálogo vía JS, con una
    ventana de tiempo en la que puede llegar a insertarse visible en el DOM
    antes de que su propio efecto de "stealth" lo oculte (confirmado en
    vídeo: parpadeo del banner original justo tras Aceptar/Rechazar). Lo
    ocultamos también por CSS, que se aplica antes que cualquier JS, para
    que ese parpadeo no pueda producirse nunca. Selector específico al
    diálogo del banner/panel (no a .cookiefirst-root en general, que
    también envuelve la tabla de cookies de /politica-de-cookies y esa sí
    debe seguir viéndose). */
dialog[data-id="cookiefirst-root"] {
  display: none !important;
}

#cc-banner, #cc-panel {
  display: none;
  position: fixed;
  z-index: 2147483000;
  left: 0;
  right: 0;
  bottom: 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(0,0,0,1);
}
#cc-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147482999;
  background: rgba(0,0,0,0.1);
}
#cc-banner {
  background: rgba(255,255,255,1);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  padding: 20px 24px;
}
#cc-banner .cc-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
}
#cc-banner h2, #cc-panel h2 {
  margin: 0 0 8px;
  font-size: 1.4em;
  font-weight: 700;
}
#cc-banner .cc-text, #cc-panel .cc-text { flex: 1 1 480px; }
#cc-banner .cc-text p, #cc-panel .cc-text p { margin: 0; }
#cc-banner a, #cc-panel a { color: inherit; text-decoration: underline; cursor: pointer; }
.cc-actions { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 1 420px; }
/* Aceptar y Rechazar mantienen el mismo peso visual (requisito AEPD). */
.cc-btn {
  border: 1px solid var(--primary-blue, #00008F);
  border-radius: 4px;
  font-family: "Source Sans Pro", inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s ease-in-out;
  flex: 1 1 0;
  min-width: 150px;
  text-align: center;
}
.cc-btn-primary, .cc-btn-secondary {
  background: var(--primary-blue, #00008F);
  color: rgba(255,255,255,1);
  border-color: var(--primary-blue, #00008F);
}
.cc-btn-primary:hover, .cc-btn-secondary:hover {
  background: var(--secondary-blue, #00005B);
  color: rgba(255,255,255,1);
  border-color: var(--secondary-blue, #00005B);
}

#cc-panel {
  top: 0;
  background: rgba(0,0,0,0);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#cc-panel .cc-box {
  background: rgba(255,255,255,1);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 28px;
  position: relative;
}
#cc-panel .cc-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: rgba(0,0,0,1);
}
#cc-panel .cc-close:hover { color: var(--primary-blue, #00008F); }
#cc-panel .cc-intro { margin-bottom: 16px; }
.cc-category { border-top: 1px solid var(--grey-light, #E1E1E1); padding: 14px 0; }
.cc-category:first-child { border-top: none; }
.cc-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cc-category-head strong { font-size: 1.05em; }
.cc-category-desc { margin-top: 8px; font-size: 0.95em; color: var(--text, #333); }
.cc-category-desc p { margin: 0 0 8px; }
.cc-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--secondary-grey, #CCC);
  border: none;
  cursor: pointer;
  flex: 0 0 auto;
}
.cc-switch[aria-checked="true"] { background: rgba(8,168,0,1); }
.cc-switch[disabled] { cursor: not-allowed; opacity: .6; }
.cc-switch span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: left .15s ease-in-out;
}
.cc-switch[aria-checked="true"] span { left: 20px; }
#cc-panel .cc-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
#cc-panel .cc-panel-actions .cc-btn-full { flex: 1 1 100%; }
#cc-panel .cc-panel-actions-row { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 100%; }

/* Cabecera del panel: título + enlace a la política de privacidad. */
#cc-panel .cc-panel-toprow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 32px 16px 0;
}
#cc-panel #cc-panel-title { font-size: 1.4em; font-weight: 700; }
#cc-panel .cc-panel-toprow a { font-size: 13px; }

/* Pestañas (Configuración / Cookies / Política de cookies). */
#cc-panel .cc-tabs {
  display: flex;
  border-bottom: 1px solid var(--grey-light, #E1E1E1);
  margin-bottom: 16px;
}
#cc-panel .cc-tab {
  flex: 1 1 0;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 10px 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--dark-grey, #666);
  cursor: pointer;
}
#cc-panel .cc-tab:hover { color: rgba(0,0,0,1); }
#cc-panel .cc-tab.active { color: var(--primary-blue, #00008F); border-bottom-color: var(--primary-blue, #00008F); }
#cc-panel .cc-tab-panel[hidden] { display: none; }

#cc-panel .cc-categorias-title { margin: 0 0 4px; font-weight: 700; }
#cc-panel .cc-categorias-title + .cc-category { border-top: none; }

/* Acordeón de categorías: el título/flecha despliega, el switch no. */
.cc-category-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.cc-chevron { display: inline-block; transition: transform .15s ease-in-out; }
.cc-category-toggle[aria-expanded="true"] .cc-chevron { transform: rotate(180deg); }
.cc-category-more[hidden] { display: none; }

.cc-shared-title { font-weight: 700; color: rgba(0,0,0,1); }
.cc-shared-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--grey-light, #E1E1E1);
  border-radius: 4px;
  padding: 8px 12px;
}
.cc-shared-name { font-weight: 700; color: rgba(0,0,0,1); }

#cc-panel .cc-cookie-list-note { font-size: 13px; color: var(--dark-grey, #666); }
#cc-panel .cc-cookie-list-note[hidden] { display: none; }
#cc-panel #cc-cookies-table-mirror,
#cc-panel #cookiefirst-policy-page { font-size: 13px; overflow-x: auto; }

#cc-panel .cc-branding {
  margin-top: 16px;
  font-size: 11px;
  color: #777;
  text-align: center;
}
#cc-panel .cc-branding a { color: inherit; }
@media (max-width: 700px) {
  #cc-banner .cc-inner { flex-direction: column; align-items: stretch; }
  /* En columna, los "flex: 1 1 480px"/"420px" de .cc-text/.cc-actions
      (pensados como base de ANCHO en fila) pasan a ser una base de ALTURA
      — de ahí el hueco enorme bajo el texto y los botones gigantes que
      se estiraban para llenarla. Se fija la altura de ambos al contenido. */
  #cc-banner .cc-text { flex: 0 0 auto; }
  .cc-actions { flex: 0 0 auto; justify-content: stretch; align-items: stretch; }
  .cc-btn { flex: 1 1 auto; align-self: auto; text-align: center; }
}
