/* Importamos las variables root */
@import "../../css/root_main.css";

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-primary);
  background: linear-gradient(
    135deg,
    var(--background-primary),
    var(--background-secondary)
  );
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}



/* ================================================================================
   📦 LOADING OVERLAY
   ================================================================================*/

#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
  color: var(--text-primary);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loading-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* ================================================================================
   🏗️ ESTRUCTURA PRINCIPAL
   ================================================================================*/

.main-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  align-items: start;
}

/* ================================================================================
   📱 SECCIÓN MRZ/OCR
   ================================================================================*/

.mrz-section {
  background: var(--background-secondary);
  border-radius: 25px;
  padding: 40px;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(239, 165, 5, 0.1);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 20px;
  height: fit-content;
}

.mrz-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 25px 25px 0 0;
}

.mrz-title {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 30px;
  text-align: center;
  justify-content: center;
}

.mrz-title .icon-large {
  width: 32px;
  height: 32px;
}

/* ================================================================================
   📊 ESTADO OCR Y PASOS
   ================================================================================*/

.ocr-status {
  background: var(--background-success-light);
  border: 1px solid var(--color-success);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 25px;
  text-align: center;
}

.status-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--color-success);
  font-weight: 600;
  margin-bottom: 5px;
}

.status-header .icon-success {
  width: 20px;
  height: 20px;
}

.ocr-status small {
  color: var(--color-success);
  opacity: 0.8;
}

.mrz-step {
  background: var(--background-tertiary);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 25px;
  border: 2px solid var(--border-color-light);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.mrz-step.active {
  border-color: var(--primary-color);
  background: var(--background-info-light);
  box-shadow: 0 0 30px rgba(239, 165, 5, 0.2);
}

.mrz-step.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
}

.step-title {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: var(--gradient-primary);
  color: var(--background-primary);
  font-weight: 700;
  font-size: 1.2rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 4px 15px var(--primary-color-alpha-30);
}

.step-title h3 {
  font-size: 1.3rem;
  font-weight: 600;
}

.step-title p {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ================================================================================
   🔘 BOTONES MRZ
   ================================================================================*/

.mrz-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

.mrz-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 25px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  min-width: 160px;
}

.mrz-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-btn-shine);
  transition: left 0.5s ease;
}

.mrz-btn:hover::before {
  left: 100%;
}

.mrz-btn-primary {
  background: var(--gradient-primary);
  color: var(--background-primary);
  box-shadow: 0 4px 15px var(--primary-color-alpha-30);
}

.mrz-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-color-alpha-50);
}

.mrz-btn-secondary {
  background: var(--background-tertiary);
  color: var(--primary-color);
  border: 2px solid var(--border-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mrz-btn-secondary:hover {
  background: var(--background-btn-hover);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.mrz-btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.mrz-btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.5);
}

.btn-icon {
  width: 20px;
  height: 20px;
}

/* ================================================================================
   📷 CÁMARA Y CAPTURA
   ================================================================================*/

.camera-container {
  position: relative;
  background: var(--background-primary);
  border-radius: 15px;
  overflow: hidden;
  margin: 20px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 2px solid var(--border-color);
}

#video {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}

.camera-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: var(--text-primary);
  padding: 20px;
  border-radius: 15px;
  text-align: center;
  border: 2px dashed var(--primary-color);
  backdrop-filter: blur(5px);
}

.overlay-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* ================================================================================
   📁 ÁREA DE SUBIDA
   ================================================================================*/

.upload-area {
  background: var(--background-tertiary);
  border: 3px dashed var(--border-color);
  border-radius: 20px;
  padding: 40px 20px;
  text-align: center;
  margin: 20px 0;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: var(--background-info-light);
  transform: translateY(-2px);
}

.upload-area.dragover {
  border-color: var(--primary-color);
  background: var(--background-info-light);
  box-shadow: 0 0 30px rgba(239, 165, 5, 0.3);
}

.upload-icon .icon-upload {
  width: 48px;
  height: 48px;
  color: var(--primary-color);
  margin-bottom: 15px;
}

/* ================================================================================
   ✅ RESULTADO MRZ
   ================================================================================*/

.mrz-result {
  background: var(--background-success-light);
  border: 2px solid var(--color-success);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  animation: resultSlideIn 0.8s ease;
}

@keyframes resultSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--color-success);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.icon-success-large {
  width: 28px;
  height: 28px;
}

.age-display {
  background: var(--background-secondary);
  border-radius: 15px;
  padding: 25px;
  margin: 20px 0;
  border: 1px solid var(--color-success);
}

.privacy-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-success);
  font-weight: 600;
  margin-bottom: 10px;
}

.icon-privacy {
  width: 18px;
  height: 18px;
}

/* ================================================================================
   📝 FORMULARIO PRINCIPAL
   ================================================================================*/

.form-container {
  background: var(--background-secondary);
  border-radius: 25px;
  padding: 40px;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(239, 165, 5, 0.1);
  backdrop-filter: blur(20px);
}

.form-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 25px 25px 0 0;
}

.form-header {
  text-align: center;
  margin-bottom: 40px;
}

.form-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 15px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.form-header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  opacity: 0.9;
}

/* ================================================================================
   🎯 CAMPOS DEL FORMULARIO
   ================================================================================*/

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  position: relative;
  margin-bottom: 25px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-control {
  width: 100%;
  padding: 18px 20px;
  border: 2px solid var(--border-color-input);
  border-radius: 12px;
  background: var(--background-tertiary);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.4s ease;
  outline: none;
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

.form-control:focus {
  border-color: var(--primary-color);
  background: var(--background-input-focus);
  box-shadow: 0 0 0 4px var(--primary-color-alpha-20);
  transform: translateY(-1px);
}

.form-control:valid {
  border-color: var(--color-success);
  background: var(--background-valid);
}

.form-control:invalid:not(:placeholder-shown) {
  border-color: var(--color-error);
  background: var(--background-invalid);
}

/* Select específico */
select.form-control {
  cursor: pointer;
  background-image: var(--bg-image-select);
  background-position: var(--bg-position-select);
  background-size: var(--bg-size-select);
  background-repeat: var(--bg-repeat-none);
  appearance: none;
}

.form-label {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 1rem;
}

.form-text {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  opacity: 0.8;
}

/* ================================================================================
   🔒 CAMPOS DE CONTRASEÑA INDIVIDUALES
   ================================================================================*/

.password-fields {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 15px 0;
  flex-wrap: wrap;
}

.password-char,
.password-char-confirm {
  width: 50px;
  height: 50px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  border: 2px solid var(--border-color-input);
  border-radius: 10px;
  background: var(--background-tertiary);
  color: var(--text-primary);
  transition: all 0.3s ease;
  outline: none;
}

.password-char:focus,
.password-char-confirm:focus {
  border-color: var(--primary-color);
  background: var(--background-input-focus);
  box-shadow: 0 0 0 3px var(--primary-color-alpha-20);
  transform: scale(1.1);
}

.password-char.valid,
.password-char-confirm.valid {
  border-color: var(--color-success);
  background: var(--background-valid);
}

.password-char.invalid,
.password-char-confirm.invalid {
  border-color: var(--color-error);
  background: var(--background-invalid);
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

.password-match-indicator {
  margin-top: 15px;
  padding: 12px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
}

.password-match-indicator.show {
  opacity: 1;
}

.password-match-indicator.match {
  background: var(--background-success-light);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.password-match-indicator.no-match {
  background: var(--background-error-light);
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

/* ================================================================================
   ✅ TÉRMINOS Y CONDICIONES
   ================================================================================*/

.terms-container {
  background: var(--background-tertiary);
  border-radius: 15px;
  padding: 25px;
  border: 1px solid var(--border-color-light);
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 15px;
  position: relative;
}

.checkbox-group:last-child {
  margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary-color);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.checkbox-label {
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.5;
  font-size: 0.95rem;
}

.checkbox-label .link {
  color: var(--primary-color);
  text-decoration: underline;
  font-weight: 600;
  transition: color 0.3s ease;
}

.checkbox-label .link:hover {
  color: var(--primary-color-hover);
}

/* ================================================================================
   🔘 VALIDACIÓN VISUAL
   ================================================================================*/

.validation-icon {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  opacity: 0;
  transition: all 0.3s ease;
}

.form-group .form-control:valid ~ .validation-icon {
  opacity: 1;
  color: var(--color-success);
}

.form-group .form-control:valid ~ .validation-icon::before {
  content: "✓";
  font-weight: bold;
}

.form-group .form-control:invalid:not(:placeholder-shown) ~ .validation-icon {
  opacity: 1;
  color: var(--color-error);
}

.form-group
  .form-control:invalid:not(:placeholder-shown)
  ~ .validation-icon::before {
  content: "✗";
  font-weight: bold;
}

/* ================================================================================
   🚨 ALERTAS Y MENSAJES
   ================================================================================*/

.alert {
  border-radius: 12px;
  padding: 18px 24px;
  margin-bottom: 25px;
  font-weight: 500;
  text-align: center;
  border: 1px solid transparent;
  animation: alertSlideIn 0.5s ease;
}

@keyframes alertSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: var(--success-gradient, var(--background-success-light));
  color: white;
  border-color: var(--color-success);
}

.alert-danger {
  background: var(--danger-color, var(--background-error-light));
  color: white;
  border-color: var(--color-error);
}

/* ================================================================================
   🔘 BOTÓN DE ENVÍO Y FOOTER
   ================================================================================*/

.btn-futuristic.btn-small {
  width: 100%;
  padding: 20px 30px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 15px;
  color: var(--background-primary);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 25px var(--primary-color-alpha-30);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-futuristic:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--color-gray);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-futuristic:not(:disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px var(--primary-color-alpha-50);
}

.form-footer {
  text-align: center;
  margin-top: 25px;
}

.form-footer p {
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.form-footer .link {
  color: var(--primary-color);
  text-decoration: underline;
  font-weight: 600;
}

.form-footer .link:hover {
  color: var(--primary-color-hover);
}

.security-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 15px;
}

.icon-security {
  width: 16px;
  height: 16px;
}

/* ================================================================================
   📱 RESPONSIVE DESIGN
   ================================================================================*/

@media (max-width: 1200px) {
  .main-container {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 30px 15px;
  }

  .mrz-section {
    position: relative;
    order: 1;
  }

  .form-container {
    order: 2;
  }
}

@media (max-width: 768px) {
  .main-container {
    padding: 20px 10px;
  }

  .mrz-section,
  .form-container {
    padding: 30px 25px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .mrz-controls {
    flex-direction: column;
    gap: 12px;
  }

  .mrz-btn {
    width: 100%;
    min-width: auto;
  }

  .step-title {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .password-fields {
    gap: 8px;
  }

  .password-char,
  .password-char-confirm {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .form-header h1 {
    font-size: 2.2rem;
  }
}

@media (max-width: 480px) {
  .mrz-section,
  .form-container {
    padding: 25px 20px;
    border-radius: 20px;
  }

  .mrz-title {
    font-size: 1.5rem;
    flex-direction: column;
    gap: 10px;
  }

  .form-header h1 {
    font-size: 1.9rem;
  }

  .form-control {
    padding: 16px 18px;
    font-size: 0.95rem;
  }

  .password-fields {
    gap: 6px;
  }

  .password-char,
  .password-char-confirm {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }

  .step-number {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .upload-area {
    padding: 30px 15px;
  }

  #video {
    height: 250px;
  }
}

@media (max-width: 360px) {
  .mrz-section,
  .form-container {
    padding: 20px 15px;
  }

  .password-fields {
    gap: 4px;
  }

  .password-char,
  .password-char-confirm {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .form-header h1 {
    font-size: 1.7rem;
  }

  .mrz-title {
    font-size: 1.3rem;
  }
}

/* ================================================================================
   🎨 ANIMACIONES ADICIONALES
   ================================================================================*/

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mrz-section {
  animation: fadeInUp 0.8s ease 0.2s both;
}

.form-container {
  animation: fadeInUp 0.8s ease 0.4s both;
}

/* ================================================================================
   🎨 ICONOS HELPER
   ================================================================================*/

.icon-small {
  width: 16px;
  height: 16px;
}

.icon-inline {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 5px;
}

.icon-info {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  opacity: 0.8;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ================================================================================
   🌙 MODO OSCURO MEJORADO
   ================================================================================*/

@media (prefers-color-scheme: dark) {
  body.futuristic-background {
    --background-primary: #0a0a0a;
    --background-secondary: #111111;
    --background-tertiary: #1a1a1a;
  }

  .mrz-section,
  .form-container {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6),
      0 0 0 1px rgba(239, 165, 5, 0.15);
  }
}
