/**
 * LOPDP Consent Component Styles
 * Componente de Consentimiento de Protección de Datos
 * Ley Orgánica de Protección de Datos Personales (LOPDP) - Ecuador
 * 
 * Diseño responsivo integrado con Bootstrap 3 y estilos del sitio
 * Colores: #2a2d77 (principal), #6c757d (muted), #f0f0f0 (fondo)
 */

/* ============================================================
   CONTENEDOR PRINCIPAL DEL CONSENTIMIENTO
   ============================================================ */

.separator-lopdp {
  font-size: 16px;
  color: #2a2d77;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 15px 0 10px 0;
  border-bottom: 2px solid #2a2d77;
  margin: 25px 0 20px 0;
  font-family: "Asap", sans-serif;
}

/* ============================================================
   WRAPPER DEL CHECKBOX DE CONSENTIMIENTO
   ============================================================ */

.checkbox-consent-wrapper {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 20px 0 10px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-left: 4px solid #2a2d77;
    border-radius: 4px;
    transition: all 0.3s ease;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.checkbox-consent-wrapper:hover {
  background-color: #f5f5f5;
  border-left-color: #1a1d57;
}

.checkbox-consent-wrapper.has-error {
  border-left-color: #d9534f;
  background-color: #fff5f5;
  animation: shake 0.5s ease;
}

/* Anillo de enfoque accesible en el wrapper cuando el checkbox tiene foco.
   Reemplaza los handlers focus/blur que usaban .css() en lopdp-consent.js. */
.checkbox-consent-wrapper:focus-within {
  box-shadow: 0 0 0 3px rgba(42, 45, 119, 0.1);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* ============================================================
   ETIQUETA DEL CHECKBOX
   ============================================================ */

.checkbox-consent-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  font-weight: normal;
  margin-bottom: 0;
  user-select: none;
  flex-wrap: nowrap;
  min-width: 0;
}

.checkbox-consent-label input[type="checkbox"] {
  margin-right: 12px;
  margin-top: 4px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #2a2d77;
}

.checkbox-consent-label input[type="checkbox"]:focus {
  outline: 2px solid #2a2d77;
  outline-offset: 2px;
}

.checkbox-consent-label input[type="checkbox"]:checked {
  background-color: #2a2d77;
  border-color: #2a2d77;
}

/* ============================================================
   TEXTO DEL CHECKBOX
   ============================================================ */

.checkbox-text {
  flex: 1 1 0;
  font-size: 14px;
  line-height: 1.6;
  color: #222;
  font-weight: 400;
  font-family: "Roboto", Arial, sans-serif;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.checkbox-text a.link-terminos {
  color: #2a2d77;
  text-decoration: underline;
  font-weight: 600;
  transition: all 0.3s ease;
}

.checkbox-text a.link-terminos:hover {
  color: #1a1d57;
  text-decoration: none;
}

.checkbox-text a.link-terminos:focus {
  outline: 2px solid #2a2d77;
  outline-offset: 2px;
}

/* ============================================================
   TEXTO DE POLÍTICA CORTA (MUTED)
   ============================================================ */

.texto-politica-corta {
  font-size: 12px;
  color: #fffefe;
  line-height: 1.5;
  margin: 8px 0 0 0;
  font-style: italic;
  padding: 10px;
  background-color: #337ab7;
  border-radius: 3px;
  border-left: 2px solid #d9d9d9;
}

/* ============================================================
   BLOQUE DE ERRORES
   ============================================================ */

.checkbox-consent-wrapper .help-block.with-errors {
  color: #d9534f;
  font-size: 12px;
  margin-top: 8px;
  margin-left: 30px;
  margin-bottom: 0;
  display: block;
}

.checkbox-consent-wrapper .help-block.with-errors:empty {
  display: none;
}

.checkbox-consent-wrapper .help-block.with-errors::before {
  content: "⚠ ";
  font-weight: 600;
}

/* ============================================================
   GRUPO DE FORMULARIO INTEGRACIÓN
   ============================================================ */

.form-group.lopdp-consent-group {
  margin-bottom: 20px;
}

.form-group.lopdp-consent-group .form-group {
  margin-bottom: 0;
}

/* ============================================================
   RESPONSIVIDAD - TABLETS Y MÓVILES
   ============================================================ */

@media (max-width: 768px) {
  .separator-lopdp {
    font-size: 14px;
    padding: 12px 0 8px 0;
    margin: 20px 0 15px 0;
  }

  .checkbox-consent-wrapper {
    padding: 12px;
    margin: 15px 0 8px 0;
  }

  .checkbox-text {
    font-size: 13px;
  }

  .texto-politica-corta {
    margin-left: 0;
    font-size: 11px;
    margin-top: 12px;
    padding: 8px;
  }

  .checkbox-consent-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 3px;
  }
}

@media (max-width: 480px) {
  .separator-lopdp {
    font-size: 13px;
    padding: 10px 0 6px 0;
    margin: 15px 0 12px 0;
  }

  .checkbox-consent-wrapper {
    padding: 10px;
    border-left-width: 3px;
  }

  .checkbox-text {
    font-size: 12px;
  }


  .checkbox-consent-label input[type="checkbox"] {
    margin-right: 8px;
  }

  .texto-politica-corta {
    font-size: 10px;
    padding: 6px;
  }
}

/* ============================================================
   MODO OSCURO / ACCESIBILIDAD
   ============================================================ */

@media (prefers-color-scheme: dark) {
  .checkbox-consent-wrapper {
    background-color:whitesmoke
  }

  .checkbox-consent-wrapper:hover {
    background-color: #cdcdcd;
  }

  .checkbox-text {
    color: black;
    min-width: 0;
    word-break: break-word;
  }

  .texto-politica-corta {
    background-color: #337ab7;
    color: white;
  }
}

@media (prefers-reduced-motion: reduce) {
  .checkbox-consent-wrapper {
    transition: none;
  }

  .checkbox-text a.link-terminos {
    transition: none;
  }

  .checkbox-consent-wrapper.has-error {
    animation: none;
  }
}

/* ============================================================
   IMPRESIÓN
   ============================================================ */

@media print {
  .checkbox-consent-wrapper {
    border: 1px solid #2a2d77;
    page-break-inside: avoid;
  }

  .checkbox-text a.link-terminos {
    text-decoration: none;
  }

  .checkbox-text a.link-terminos::after {
    content: " (ver términos y condiciones)";
  }
}

/* El aviso de cookies no debe tapar los botones del modal de la firma: mientras el modal está abierto queda detrás de él */
body.modal-open .mfr-cc {
  z-index: 1030;
}
