/* Replai - Cookie Consent (front) */

.replai-cc {
  --replai-cc-accent: #1775ED;
  position: fixed;
  z-index: 2147483000;
  left: 0;
  right: 0;
  display: none;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.replai-cc *,
.replai-cc *::before,
.replai-cc *::after { box-sizing: border-box; }

/* El atributo hidden debe ocultar de verdad (algunas reglas con display lo pisan). */
.replai-cc [hidden] { display: none !important; }

.replai-cc.replai-cc-visible { display: block; }

/* Posición */
.replai-cc-bottom { bottom: 0; }
.replai-cc-bottom .replai-cc-card { border-radius: 0; }
.replai-cc-box { bottom: 20px; max-width: 420px; }
.replai-cc-box.replai-cc-side-right { left: auto; right: 20px; }
.replai-cc-box.replai-cc-side-left { right: auto; left: 20px; }

/* Tarjeta */
.replai-cc-card {
  margin: 0 auto;
  max-width: 1180px;
  padding: 20px 22px;
  background: #fff;
  color: #1c2430;
  border-radius: 16px;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.14);
}
.replai-cc-box .replai-cc-card { max-width: 100%; }

.replai-cc-theme-dark .replai-cc-card { background: #161c26; color: #e9edf3; }

.replai-cc-title { margin: 0 0 6px; font-size: 17px; font-weight: 800; }
.replai-cc-message { margin: 0; font-size: 14px; line-height: 1.5; opacity: 0.9; }

.replai-cc-links { margin-top: 8px; font-size: 12px; }
.replai-cc-links a { color: var(--replai-cc-accent); text-decoration: none; }
.replai-cc-links a:hover { text-decoration: underline; }

/* Preferencias */
.replai-cc-prefs {
  margin-top: 14px;
  display: grid;
  gap: 10px;
  /* Limitar la altura para que, con mucho detalle de cookies, no se salga de
     la pantalla: se hace scroll dentro de la zona de info. */
  max-height: min(48vh, 460px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}
.replai-cc-cat {
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 12px;
  padding: 10px 12px;
}
.replai-cc-theme-dark .replai-cc-cat { border-color: rgba(255, 255, 255, 0.12); }
.replai-cc-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.replai-cc-cat-name { font-weight: 700; font-size: 14px; }
.replai-cc-cat-desc { margin-top: 4px; font-size: 12px; opacity: 0.75; line-height: 1.45; }
.replai-cc-always { font-size: 11px; font-weight: 700; color: var(--replai-cc-accent); }

/* Título de categoría con desplegable + contador (estilo declaración) */
.replai-cc-cat-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.replai-cc-cat-toggle {
  appearance: none;
  background: none;
  border: none;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  color: inherit;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
}
.replai-cc-cat-toggle:hover { background: rgba(0, 0, 0, 0.06); }
.replai-cc-theme-dark .replai-cc-cat-toggle:hover { background: rgba(255, 255, 255, 0.1); }
.replai-cc-cat-chevron { transition: transform 0.2s ease; display: block; }
.replai-cc-cat-open .replai-cc-cat-toggle .replai-cc-cat-chevron { transform: rotate(180deg); }
.replai-cc-cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
}
.replai-cc-theme-dark .replai-cc-cat-count { background: rgba(255, 255, 255, 0.14); }

/* Detalle: proveedores (colapsables) y cookies */
.replai-cc-cat-cookies { margin-top: 10px; display: grid; gap: 10px; }
.replai-cc-prov {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  overflow: hidden;
}
.replai-cc-theme-dark .replai-cc-prov { border-color: rgba(255, 255, 255, 0.14); }
.replai-cc-prov-toggle {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  padding: 12px 14px;
  text-align: left;
}
.replai-cc-prov-toggle:hover { background: rgba(0, 0, 0, 0.03); }
.replai-cc-theme-dark .replai-cc-prov-toggle:hover { background: rgba(255, 255, 255, 0.05); }
.replai-cc-prov-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.replai-cc-prov-name { font-weight: 700; font-size: 14px; }
.replai-cc-prov-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 11px;
  font-weight: 700;
}
.replai-cc-theme-dark .replai-cc-prov-count { background: rgba(255, 255, 255, 0.14); }
.replai-cc-prov-chevron { flex: none; transition: transform 0.2s ease; }
.replai-cc-prov-open .replai-cc-prov-chevron { transform: rotate(180deg); }
.replai-cc-prov-body { padding: 0 14px 12px; }
.replai-cc-prov-link {
  display: inline-block;
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--replai-cc-accent);
  text-decoration: none;
}
.replai-cc-prov-link:hover { text-decoration: underline; }
.replai-cc-ck {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.replai-cc-theme-dark .replai-cc-ck { background: rgba(255, 255, 255, 0.06); }
.replai-cc-ck-name { font-weight: 700; font-size: 13px; }
.replai-cc-ck-desc { font-size: 12px; opacity: 0.8; margin-top: 3px; line-height: 1.45; }
.replai-cc-ck-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-size: 12px;
  opacity: 0.9;
}

/* Switch */
.replai-cc-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.replai-cc-switch input { opacity: 0; width: 0; height: 0; }
.replai-cc-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #cbd2dc; border-radius: 999px; transition: background 0.2s;
}
.replai-cc-slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: transform 0.2s;
}
.replai-cc-switch input:checked + .replai-cc-slider { background: var(--replai-cc-accent); }
.replai-cc-switch input:checked + .replai-cc-slider::before { transform: translateX(18px); }

/* Acciones */
.replai-cc-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
/* Resets defensivos para que el tema del sitio no rompa los botones del banner
   (algunos temas fuerzan fondo/color/mayúsculas en todos los <button>). */
.replai-cc .replai-cc-btn {
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  text-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.2;
  min-width: 0;
  width: auto;
  height: auto;
  margin: 0;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.replai-cc-theme-dark .replai-cc-btn { border-color: rgba(255, 255, 255, 0.2); }
.replai-cc .replai-cc-btn:hover { opacity: 0.85; }
/* Botón principal: color de acento garantizado por encima del tema. */
.replai-cc .replai-cc-btn.replai-cc-primary {
  background: var(--replai-cc-accent, #1775ED) !important;
  border: 1px solid var(--replai-cc-accent, #1775ED) !important;
  color: #fff !important;
}

/* Botón flotante de reapertura: SOLO la galleta (30px). Al pulsar abre el
   cuadro de preferencias. No se abre en hover. */
.replai-cc-float {
  --replai-cc-accent: #1775ED;
  position: fixed;
  bottom: 22px;
  z-index: 2147482000;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  cursor: pointer;
  background: var(--replai-cc-accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}
.replai-cc-float * { box-sizing: border-box; }
.replai-cc-float .replai-cc-float-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.replai-cc-float .replai-cc-float-ic svg { display: block; width: 30px; height: 30px; }

/* Tamaños del botón flotante (por defecto: Medio). */
.replai-cc-float-size-small { width: 38px; height: 38px; }
.replai-cc-float-size-small .replai-cc-float-ic svg { width: 22px; height: 22px; }
.replai-cc-float-size-medium { width: 48px; height: 48px; }
.replai-cc-float-size-medium .replai-cc-float-ic svg { width: 30px; height: 30px; }
.replai-cc-float-size-large { width: 56px; height: 56px; }
.replai-cc-float-size-large .replai-cc-float-ic svg { width: 36px; height: 36px; }

/* Tooltip visual del botón flotante (aparece al pasar por encima). */
.replai-cc-float-tip {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.94);
  white-space: nowrap;
  background: #161c26;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 8px 11px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.replai-cc-float:hover .replai-cc-float-tip,
.replai-cc-float:focus-visible .replai-cc-float-tip {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}
.replai-cc-float.replai-cc-side-right .replai-cc-float-tip { right: calc(100% + 12px); }
.replai-cc-float.replai-cc-side-left .replai-cc-float-tip { left: calc(100% + 12px); }
.replai-cc-float-tip::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
}
.replai-cc-float.replai-cc-side-right .replai-cc-float-tip::after { left: 100%; border-left-color: #161c26; }
.replai-cc-float.replai-cc-side-left .replai-cc-float-tip::after { right: 100%; border-right-color: #161c26; }

/* Abajo: domo apoyado en el borde inferior (esquina derecha o izquierda). */
.replai-cc-float-bottom {
  bottom: 0;
  border-radius: 999px 999px 0 0;
}
.replai-cc-float-bottom.replai-cc-side-right { right: 26px; left: auto; }
.replai-cc-float-bottom.replai-cc-side-left { left: 26px; right: auto; }

/* Lateral: domo que sale del borde derecho o izquierdo. */
.replai-cc-float-side.replai-cc-side-right { right: 0; left: auto; border-radius: 999px 0 0 999px; }
.replai-cc-float-side.replai-cc-side-left { left: 0; right: auto; border-radius: 0 999px 999px 0; }

/* Pie: logo REPLAI a la izquierda y botones a la derecha, en la misma línea
   cuando hay sitio; envuelve en pantallas estrechas. */
.replai-cc-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
}
.replai-cc-footer .replai-cc-actions { margin-top: 0; margin-left: auto; }
.replai-cc-footer .replai-cc-brand { margin-top: 0; }

/* Marca REPLAI en el banner */
.replai-cc-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 11px;
  line-height: 1;
  color: inherit;
  opacity: 0.7;
  text-decoration: none;
  transition: opacity 0.15s;
}
.replai-cc-brand:hover { opacity: 1; }
.replai-cc-brand img { height: 16px; width: auto; display: block; }
.replai-cc-brand-tx { font-weight: 600; letter-spacing: 0.02em; }

/* Enlace del shortcode */
.replai-cc-reopen-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Tabla de declaración de cookies */
.replai-cc-declaration {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.replai-cc-declaration th,
.replai-cc-declaration td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  vertical-align: top;
}
.replai-cc-declaration th { font-weight: 700; }

@media (max-width: 640px) {
  .replai-cc-box { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .replai-cc-actions .replai-cc-btn { flex: 1 1 auto; text-align: center; }
}
