/* ============================================================
   COOKIE-BANNER.CSS · Inteligencia Energía · v4.1
   ============================================================
   Estilos del banner de cookies usando la paleta corporativa.
   Mobile-first, accesible, sin animaciones agresivas.
   ============================================================ */

/* Overlay con fondo semi-transparente */
.ie-cb-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(14, 31, 58, 0.6); /* var(--ie-blue-900) con alpha */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.ie-cb-overlay[hidden] { display: none !important; }

/* El atributo HTML hidden tiene que ganar siempre, incluso sobre display:flex */
.ie-cb-categorias[hidden],
.ie-cb-actions-save[hidden],
.ie-cb-actions[hidden] {
  display: none !important;
}

/* Banner: aparece desde abajo */
.ie-cb-banner {
  width: 100%;
  max-width: 760px;
  background: #FFFFFF;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(14, 31, 58, 0.25);
  max-height: 92vh;
  overflow-y: auto;
  animation: ieCbSlideUp 280ms ease-out;
}

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

.ie-cb-content {
  padding: 1.5rem 1.75rem 1.75rem;
}

/* Título */
.ie-cb-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0E1F3A; /* var(--ie-blue-900) */
  margin: 0 0 0.65rem;
  line-height: 1.3;
}

/* Descripción */
.ie-cb-desc {
  font-size: 0.95rem;
  color: #374151;
  line-height: 1.55;
  margin: 0 0 1.25rem;
}
.ie-cb-desc a {
  color: #3b6d11; /* var(--ie-green-700) */
  text-decoration: underline;
  font-weight: 500;
}
.ie-cb-desc a:hover {
  color: #2e5510;
}
.ie-cb-desc strong {
  font-weight: 700;
  color: #0E1F3A;
}

/* Categorías de cookies */
.ie-cb-categorias {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: #F9FAFB;
  border-radius: 10px;
  border: 1px solid #E5E7EB;
}
.ie-cb-cat {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.ie-cb-cat-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}
.ie-cb-cat-head input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: #5BAA1D; /* var(--ie-green-500) */
  cursor: pointer;
}
.ie-cb-cat-head input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}
.ie-cb-cat-name {
  font-weight: 600;
  color: #0E1F3A;
  font-size: 1rem;
  flex: 1;
}
.ie-cb-cat-badge {
  font-size: 0.72rem;
  color: #6B7280;
  background: #E5E7EB;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ie-cb-cat-desc {
  font-size: 0.85rem;
  color: #6B7280;
  margin: 0 0 0 1.85rem;
  line-height: 1.5;
}

/* Botones de acción */
.ie-cb-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.ie-cb-actions-save {
  display: flex;
  justify-content: flex-end;
}

.ie-cb-btn {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
  text-align: center;
  line-height: 1.3;
}

/* CRÍTICO (AEPD): los tres botones tienen igual peso visual */
.ie-cb-btn-accept {
  background: #5BAA1D;
  color: #FFFFFF;
  border-color: #5BAA1D;
}
.ie-cb-btn-accept:hover {
  background: #3b6d11;
  border-color: #3b6d11;
}

.ie-cb-btn-reject {
  background: #FFFFFF;
  color: #374151;
  border-color: #D1D5DB;
}
.ie-cb-btn-reject:hover {
  background: #F3F4F6;
  border-color: #9CA3AF;
}

.ie-cb-btn-config {
  background: #FFFFFF;
  color: #374151;
  border-color: #D1D5DB;
}
.ie-cb-btn-config:hover {
  background: #F3F4F6;
  border-color: #9CA3AF;
}

.ie-cb-btn-save {
  background: #5BAA1D;
  color: #FFFFFF;
  border-color: #5BAA1D;
  flex: 0 0 auto;
  min-width: 200px;
}
.ie-cb-btn-save:hover {
  background: #3b6d11;
  border-color: #3b6d11;
}

/* Foco visible para accesibilidad */
.ie-cb-btn:focus-visible {
  outline: 3px solid #F59E0B;
  outline-offset: 2px;
}

/* Icono flotante permanente para regresar al banner */
.ie-cb-toggle {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid #E5E7EB;
  box-shadow: 0 2px 8px rgba(14, 31, 58, 0.15);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 99998;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ie-cb-toggle:hover {
  background: #F9FAFB;
  border-color: #5BAA1D;
  transform: scale(1.05);
}
.ie-cb-toggle:focus-visible {
  outline: 3px solid #F59E0B;
  outline-offset: 2px;
}

/* Móvil */
@media (max-width: 580px) {
  .ie-cb-banner {
    max-height: 95vh;
    border-radius: 14px 14px 0 0;
  }
  .ie-cb-content {
    padding: 1.25rem 1.15rem 1.4rem;
  }
  .ie-cb-title {
    font-size: 1.15rem;
  }
  .ie-cb-desc {
    font-size: 0.9rem;
  }
  .ie-cb-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .ie-cb-btn {
    width: 100%;
    flex: 0 0 auto;
    padding: 0.95rem 1rem;
  }
  .ie-cb-cat-desc {
    font-size: 0.82rem;
  }
  .ie-cb-toggle {
    bottom: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
  }
}

/* Modo oscuro respetuoso (si el sistema lo prefiere) */
@media (prefers-color-scheme: dark) {
  /* Mantenemos modo claro siempre — el banner debe ser legible y
     consistente. Solo ajustamos el icono flotante para visibilidad. */
  .ie-cb-toggle {
    background: #FFFFFF;
  }
}

/* Reducir animaciones si el usuario lo pide */
@media (prefers-reduced-motion: reduce) {
  .ie-cb-banner {
    animation: none;
  }
  .ie-cb-toggle {
    transition: none;
  }
  .ie-cb-toggle:hover {
    transform: none;
  }
}
