/**
 * N~Foque Cookie Compliance Styles
 * Integración estética corporativa (Montserrat, Navy #0b1726, Gold #c5a059, WCAG AA accesible)
 */

:root {
  --nf-ck-navy: #0b1726;
  --nf-ck-navy-hover: #162438;
  --nf-ck-navy-light: #1e293b;
  --nf-ck-text: #1e293b;
  --nf-ck-text-muted: #64748b;
  --nf-ck-border: #e2e8f0;
  --nf-ck-bg: #ffffff;
  --nf-ck-accent: #3a86ff;
  --nf-ck-shadow: 0 10px 30px rgba(11, 23, 38, 0.15);
}

.nf-cookie-hidden {
  display: none !important;
}

/* ==========================================================
   1. Primera Capa: Banner Fijo Inferior
   ========================================================== */
.nf-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999998;
  background-color: var(--nf-ck-bg);
  border-top: 1px solid var(--nf-ck-border);
  box-shadow: 0 -4px 25px rgba(11, 23, 38, 0.12);
  padding: 20px 24px;
  animation: nfCookieSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--nf-ck-text);
}

@keyframes nfCookieSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.nf-cookie-banner-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.nf-cookie-banner-content {
  flex: 1;
  min-width: 0;
}

.nf-cookie-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.nf-cookie-icon {
  color: var(--nf-ck-navy);
  flex-shrink: 0;
}

.nf-cookie-title {
  margin: 0 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--nf-ck-navy) !important;
  letter-spacing: -0.2px;
  line-height: 1.3 !important;
}

.nf-cookie-desc {
  margin: 0 !important;
  font-size: 13.5px !important;
  line-height: 1.55 !important;
  color: var(--nf-ck-text-muted) !important;
}

.nf-cookie-link {
  color: var(--nf-ck-navy) !important;
  text-decoration: underline !important;
  font-weight: 600 !important;
  transition: color 0.2s ease;
}

.nf-cookie-link:hover {
  color: var(--nf-ck-accent) !important;
}

.nf-cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ==========================================================
   Botones Universales (Igualdad Visual AEPD)
   ========================================================== */
.nf-btn {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  padding: 11px 20px !important;
  min-height: 44px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

/* Aceptar Todas: Azul Marino Sólido Corporativo */
.nf-btn-primary {
  background-color: var(--nf-ck-navy) !important;
  color: #ffffff !important;
  border: 2px solid var(--nf-ck-navy) !important;
}

.nf-btn-primary:hover {
  background-color: var(--nf-ck-navy-hover) !important;
  border-color: var(--nf-ck-navy-hover) !important;
  box-shadow: 0 4px 12px rgba(11, 23, 38, 0.2) !important;
}

/* Rechazar No Necesarias: Mismo peso y presencia (Requisito estricto AEPD) */
.nf-btn-secondary {
  background-color: #ffffff !important;
  color: var(--nf-ck-navy) !important;
  border: 2px solid var(--nf-ck-navy) !important;
}

.nf-btn-secondary:hover {
  background-color: #f1f5f9 !important;
  box-shadow: 0 4px 12px rgba(11, 23, 38, 0.08) !important;
}

/* Configurar: Botón terciario / ajustes */
.nf-btn-settings {
  background-color: transparent !important;
  color: var(--nf-ck-text-muted) !important;
  border: 1.5px solid #cbd5e1 !important;
}

.nf-btn-settings:hover {
  color: var(--nf-ck-navy) !important;
  border-color: var(--nf-ck-navy) !important;
  background-color: #f8fafc !important;
}

/* ==========================================================
   2. Segunda Capa: Modal de Configuración Granular
   ========================================================== */
.nf-cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}

.nf-cookie-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 23, 38, 0.65);
  backdrop-filter: blur(4px);
  animation: nfFadeIn 0.25s ease forwards;
}

@keyframes nfFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.nf-cookie-modal-card {
  position: relative;
  z-index: 2;
  background-color: #ffffff;
  border-radius: 12px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 45px rgba(11, 23, 38, 0.25);
  animation: nfModalZoom 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-sizing: border-box;
  overflow: hidden;
}

@keyframes nfModalZoom {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.nf-cookie-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--nf-ck-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fafbfc;
}

.nf-cookie-close-btn {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--nf-ck-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.nf-cookie-close-btn:hover {
  color: var(--nf-ck-navy);
  background-color: #e2e8f0;
}

.nf-cookie-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.nf-cookie-modal-intro {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--nf-ck-text-muted);
  margin-top: 0;
  margin-bottom: 20px;
}

/* Categorías */
.nf-cookie-category {
  background-color: #f8fafc;
  border: 1px solid var(--nf-ck-border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
  transition: border-color 0.2s ease;
}

.nf-cookie-category:last-child {
  margin-bottom: 0;
}

.nf-cookie-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 8px;
}

.nf-cookie-cat-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nf-cookie-cat-title {
  margin: 0 !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  color: var(--nf-ck-navy) !important;
}

.nf-cookie-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 4px;
}

.nf-badge-always-active {
  background-color: #e2e8f0;
  color: var(--nf-ck-navy);
}

.nf-badge-optional {
  background-color: #dbeafe;
  color: #1e40af;
}

.nf-cookie-cat-desc {
  margin: 0 !important;
  font-size: 12.8px !important;
  line-height: 1.5 !important;
  color: var(--nf-ck-text-muted) !important;
}

/* Toggle Switch */
.nf-cookie-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.nf-cookie-switch-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.nf-cookie-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s ease;
  border-radius: 24px;
}

.nf-cookie-switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.nf-cookie-switch-input:checked + .nf-cookie-switch-slider {
  background-color: var(--nf-ck-navy);
}

.nf-cookie-switch-input:checked + .nf-cookie-switch-slider:before {
  transform: translateX(20px);
}

.nf-cookie-switch-slider.disabled {
  cursor: not-allowed;
  background-color: #94a3b8;
}

.nf-cookie-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--nf-ck-border);
  background-color: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================
   3. Botón Flotante Permanente de Revocación
   ========================================================== */
.nf-cookie-reopen-btn {
  position: fixed;
  bottom: 22px;
  z-index: 999990;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--nf-ck-navy);
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 15px rgba(11, 23, 38, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
  outline: none;
}

.nf-cookie-reopen-btn:hover {
  transform: scale(1.1);
  background-color: var(--nf-ck-navy-hover);
}

.nf-reopen-bottom-left {
  left: 22px;
}

.nf-reopen-bottom-right {
  right: 22px;
}

/* ==========================================================
   4. Adaptabilidad Móvil (Responsive)
   ========================================================== */
@media (max-width: 768px) {
  .nf-cookie-banner {
    padding: 16px 18px;
  }

  .nf-cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .nf-cookie-banner-actions {
    flex-direction: column;
    width: 100%;
  }

  .nf-cookie-banner-actions .nf-btn {
    width: 100% !important;
  }

  .nf-cookie-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .nf-cookie-modal-footer .nf-btn {
    width: 100% !important;
  }
}
