/* ====================================
   Security Validation Styles
   Fumoccsa - Sistema de Seguridad
   Version: 1.0
   ==================================== */

/* Contenedor de mensajes de error */
#error-messages {
  margin-bottom: 1rem;
  max-width: 100%;
}

/* Estilos para alertas de error */
.alert {
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  border: 1px solid transparent;
  font-family: inherit;
}

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.alert-warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeaa7;
}

.alert-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.alert-info {
  color: #0c5460;
  background-color: #d1ecf1;
  border-color: #bee5eb;
}

/* Campos con errores de validación */
.form-control.error,
input.error,
textarea.error,
select.error {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.form-control.warning,
input.warning,
textarea.warning,
select.warning {
  border-color: #ffc107 !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

.form-control.success,
input.success,
textarea.success,
select.success {
  border-color: #28a745 !important;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Indicadores de seguridad */
.security-indicator {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
}

.security-indicator.secure {
  color: #28a745;
}

.security-indicator.warning {
  color: #ffc107;
}

.security-indicator.danger {
  color: #dc3545;
}

/* Contenedor de campo con indicador */
.field-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

/* Tooltip de ayuda para campos */
.field-tooltip {
  position: relative;
  display: inline-block;
}

.field-tooltip .tooltip-text {
  visibility: hidden;
  width: 220px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  margin-left: -110px;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 12px;
  line-height: 1.4;
}

.field-tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

.field-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Animaciones para validación */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.6s ease-in-out;
}

@keyframes pulse-error {
  0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.pulse-error {
  animation: pulse-error 1.5s ease-out;
}

@keyframes pulse-success {
  0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.pulse-success {
  animation: pulse-success 1.5s ease-out;
}

/* Indicador de carga para formularios */
.form-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.form-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #09295d;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1000;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Rate limiting indicator */
.rate-limit-warning {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 15px;
  font-size: 14px;
  font-weight: 500;
}

.rate-limit-warning::before {
  content: "⚠️ ";
  margin-right: 5px;
}

/* Mensaje de éxito */
.success-message {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 15px 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-weight: 500;
}

.success-message::before {
  content: "✅ ";
  margin-right: 8px;
}

/* Indicador de fortaleza de contraseña (para futuros usos) */
.password-strength {
  height: 4px;
  background-color: #e9ecef;
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 2px;
}

.password-strength-weak {
  background-color: #dc3545;
  width: 25%;
}

.password-strength-medium {
  background-color: #ffc107;
  width: 50%;
}

.password-strength-strong {
  background-color: #28a745;
  width: 75%;
}

.password-strength-very-strong {
  background-color: #20c997;
  width: 100%;
}

/* Contador de caracteres */
.char-counter {
  font-size: 12px;
  color: #6c757d;
  text-align: right;
  margin-top: 2px;
}

.char-counter.warning {
  color: #856404;
}

.char-counter.danger {
  color: #721c24;
}

/* Protección contra clickjacking */
.clickjack-protection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  z-index: 10000;
  display: none;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: #dc3545;
  font-weight: bold;
  text-align: center;
  backdrop-filter: blur(5px);
}

/* Overlay de seguridad */
.security-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
}

.security-message {
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Responsivo para dispositivos móviles */
@media (max-width: 768px) {
  .alert {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .field-tooltip .tooltip-text {
    width: 180px;
    margin-left: -90px;
    font-size: 11px;
  }
  
  .form-loading::after {
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-width: 2px;
  }
  
  .success-message,
  .rate-limit-warning {
    padding: 10px 12px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .field-tooltip .tooltip-text {
    width: 150px;
    margin-left: -75px;
    font-size: 10px;
    padding: 6px 8px;
  }
  
  .alert {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* Estados de hover y focus mejorados */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #09295d;
  box-shadow: 0 0 0 0.2rem rgba(9, 41, 93, 0.25);
}

input.error:focus,
textarea.error:focus,
select.error:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Estilos para el botón de envío */
.btn-submit-secure {
  position: relative;
  overflow: hidden;
}

.btn-submit-secure.disabled {
  pointer-events: none;
  opacity: 0.6;
}

/* Indicador de proceso de envío */
.sending-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  display: none;
}

.btn-submit-secure.sending .sending-indicator {
  display: block;
}

.btn-submit-secure.sending .btn-text {
  opacity: 0;
}
