/* ==================================================
   VARIABLES GLOBALES – PALETA INSTITUCIONAL
   ================================================== */
:root {
  --primary-color: #0d6efd;              /* Azul Bootstrap */
  --primary-dark: #0a4a8f;               /* Azul corporativo SEMADES */
  --brand-accent: #7a0b45;               /* Rosa/morado institucional */
  --brand-gradient-start: #9e1a7d;
  --brand-gradient-end: #d30fa8;

  --light-bg: #f8fafc;
  --white-bg: #ffffff;
  --text-dark: #212529;
  --text-light: #64748b;
  --border-color: #dee2e6;

  --border-radius: 0.75rem;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --focus-outline: 2px solid var(--primary-color);

  --gradient-primary: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));
  --gradient-secondary: linear-gradient(135deg, #7e1166, #d81d9a);
}

/* ==================================================
   ESTILOS BASE Y ACCESIBILIDAD
   ================================================== */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-dark);
  background-color: var(--light-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

main {
  flex-grow: 1;
  padding-top: 2rem;
}

a {
  text-decoration: none;
}

/* Accesibilidad: enfoque visible para navegación por teclado */
*:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
  border-radius: var(--border-radius);
}

/* ==================================================
   UTILIDADES
   ================================================== */
.transition {
  transition: all 0.3s ease;
}

.text-brand {
  color: var(--brand-accent) !important;
}

.bg-brand-gradient {
  background-color: var(--brand-accent); /* fallback */
  background: var(--gradient-primary);
}

/* ==================================================
   NAVBAR
   ================================================== */
.navbar {
  background: 
    url('../img/cardbody.png') center / cover no-repeat !important;
  position: relative;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 1030;
}

/* Logo */
.logo-custom {
  max-height: 100px;
  object-fit: contain;
}

/* Espacio superior para compensar navbar fixed */
.espacio-superior {
  height: 0px;
}

/* ==================================================
   TARJETAS Y ENCABEZADOS
   ================================================== */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  background-color: var(--brand-accent); /* fallback */
  background: var(--gradient-primary);
  color: white;
  padding: 1.25rem;
  text-align: center;
  border: none;
}

/* ==================================================
   FORMULARIO – ESTILOS PRINCIPALES
   ================================================== */
.form-title-chip {
  display: inline-flex;
  align-items: center;
  background-color: var(--brand-accent); /* fallback */
  background: var(--gradient-primary);
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.form-control,
.form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.6rem 1rem;
  font-size: 1rem;
  transition: all 0.25s ease;
}

.input-group {
  display: flex;
}

.input-group-text {
  background-color: #f1f3f5;
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.form-control,
.form-select {
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  border-left: none;
}

/* ESTADOS DE VALIDACIÓN – VERDE / ROJO */
.form-control:valid:not(:focus),
.form-select:valid:not(:focus) {
  border-color: #198754 !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25rem;
  padding-right: 2.75rem;
}

.form-control:invalid:not(:focus):not(:placeholder-shown),
.form-select:invalid:not(:focus):not(:placeholder-shown) {
  border-color: #dc3545 !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.4.4.4-.4'/%3e%3cpath d='M6 7v1'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25rem;
  padding-right: 2.75rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  outline: none;
}

/* Feedback de errores personalizado */
.invalid-feedback {
  display: block;
  font-size: 0.875rem;
  color: #dc3545;
  margin-top: 0.25rem;
}

/* ==================================================
   BOTONES
   ================================================== */
.btn-primary {
  background: 
    url('../img/FondoBackground.png') center / cover no-repeat !important;
  border: none;
  color: white;
  font-weight: 600;
  padding: 0.8rem 1.5rem;
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(158, 26, 125, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(158, 26, 125, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  transform: none;
  cursor: not-allowed;
}

.btn-outline-danger {
  border-color: #dc3545;
  color: #dc3545;
}

/* ==================================================
   FOOTER
   ================================================== */
.footer-custom {
  background-color: var(--brand-accent); /* fallback */
  background: var(--gradient-primary);
  color: rgba(255, 255, 255, 0.85);
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer-custom a {
  color: white;
  transition: color 0.2s ease;
}

.footer-custom a:hover {
  color: #ffd6e7;
}

.footer-custom .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.6);
  color: white;
}

.footer-custom .btn-outline-light:hover {
  background-color: white;
  color: var(--brand-accent);
}

/* ==================================================
   MODAL – TÉRMINOS Y CONDICIONES
   ================================================== */
.modal-backdrop.show {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.85) 100%);
  opacity: 1 !important;
}

.modal-content {
  border: none;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  background: 
    url('../img/FondoBackground.png') center / cover no-repeat !important;
  position: relative;
  color: white;
  border: none;
  padding: 1.25rem 1.5rem;
}

.modal-body {
  padding: 0;
  max-height: 70vh;
  background-color: #f9fafb;
}

.modal-scroll-content {
  padding: 1.5rem;
  max-height: 65vh;
  overflow-y: auto;
  background: white;
}

.modal-footer {
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 1.25rem 1.5rem;
}

/* Scroll personalizado */
.modal-scroll-content::-webkit-scrollbar {
  width: 8px;
}
.modal-scroll-content::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}
.modal-scroll-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
.modal-scroll-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==================================================
   ESTADOS DEL FORMULARIO
   ================================================== */
.formulario-deshabilitado {
  opacity: 0.65;
  pointer-events: none;
  user-select: none;
  /* filter: blur(0.5px); → REMOVIDO por accesibilidad */
}

.formulario-habilitado {
  opacity: 1;
  pointer-events: all;
  user-select: auto;
}

/* ==================================================
   RESPONSIVE DESIGN
   ================================================== */
@media (max-width: 768px) {
  .form-title-chip {
    font-size: 1rem;
    padding: 0.4rem 1rem;
  }

  .card-header h5 {
    font-size: 1.1rem;
  }

  .modal-dialog {
    margin: 0.8rem;
  }

  .modal-scroll-content {
    padding: 1rem;
    max-height: 60vh;
  }
}

@media (max-width: 576px) {
  main {
    padding-top: 1.5rem;
  }

  .card-body {
    padding: 1.25rem !important;
  }

  .btn-primary {
    font-size: 0.95rem;
    padding: 0.75rem;
  }

  .modal-scroll-content {
    max-height: 50vh;
    padding: 0.75rem;
  }

  .logo-custom {
    max-height: 30px;
  }
}

/* ==================================================
   ACCESIBILIDAD – PREFERENCIAS DE USUARIO
   ================================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .btn-primary {
    transition: none !important;
  }
}

.card-header.bg-custom {
  background: 
    url('../img/FondoBackground.png') center / cover no-repeat !important;
  position: relative;
}