/* Q-Node Consent Banner · CMP propio compliance básico RGPD/LSSI-CE
 * Reemplaza Cookiebot temporalmente · sin dependencia externa
 * Soporta GTM Consent Mode v2 · localStorage persistencia
 */

#qnode-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 4px solid #1e40af;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.15);
  z-index: 99999;
  padding: 20px 24px;
  font-family: -apple-system, system-ui, "Segoe UI", sans-serif;
  color: #1f2937;
  display: none;
  animation: qnode-consent-slideup 0.4s ease-out;
}
#qnode-consent-banner.show { display: block; }

@keyframes qnode-consent-slideup {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

#qnode-consent-banner .qnc-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
}

@media (max-width: 768px) {
  #qnode-consent-banner { padding: 16px; }
  #qnode-consent-banner .qnc-inner {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

#qnode-consent-banner .qnc-text { font-size: 14px; line-height: 1.5; }
#qnode-consent-banner .qnc-text strong { color: #1e40af; }
#qnode-consent-banner .qnc-text a {
  color: #1e40af;
  text-decoration: underline;
  font-weight: 600;
}

#qnode-consent-banner .qnc-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  #qnode-consent-banner .qnc-actions {
    width: 100%;
    flex-direction: column;
  }
}

#qnode-consent-banner button {
  border: none;
  padding: 12px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

#qnc-accept-all {
  background: #1e40af;
  color: white;
}
#qnc-accept-all:hover { background: #1e3a8a; }

#qnc-reject-all {
  background: #f3f4f6;
  color: #374151;
}
#qnc-reject-all:hover { background: #e5e7eb; }

#qnc-customize {
  background: transparent;
  color: #1e40af;
  text-decoration: underline;
  padding: 12px 12px;
}

/* Modal preferencias */
#qnode-consent-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
#qnode-consent-modal.show { display: flex; }

#qnode-consent-modal .qnm-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  font-family: -apple-system, system-ui, sans-serif;
  color: #1f2937;
}

#qnode-consent-modal h2 {
  color: #1e40af;
  margin: 0 0 8px 0;
  font-size: 24px;
}
#qnode-consent-modal .qnm-intro {
  color: #6b7280;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

#qnode-consent-modal .qnm-cat {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
#qnode-consent-modal .qnm-cat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
}
#qnode-consent-modal .qnm-cat-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

#qnode-consent-modal .qnm-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
#qnode-consent-modal .qnm-toggle.active { background: #1e40af; }
#qnode-consent-modal .qnm-toggle.disabled { background: #1e40af; opacity: 0.6; cursor: not-allowed; }
#qnode-consent-modal .qnm-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
#qnode-consent-modal .qnm-toggle.active::after,
#qnode-consent-modal .qnm-toggle.disabled::after {
  transform: translateX(20px);
}

#qnode-consent-modal .qnm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}
#qnode-consent-modal .qnm-actions button {
  border: none;
  padding: 12px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
#qnm-save { background: #1e40af; color: white; }
#qnm-save:hover { background: #1e3a8a; }
#qnm-modal-close { background: #f3f4f6; color: #374151; }

/* Floating reopen button (post consent) */
#qnode-consent-reopen {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  cursor: pointer;
  z-index: 99998;
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: none;
  align-items: center;
  justify-content: center;
}
#qnode-consent-reopen.show { display: flex; }
#qnode-consent-reopen:hover { background: #f9fafb; }
