:root{
  /* Paleta de colores mexicanos */
  --color-bandera-verde: #025939;
  --color-bandera-rojo: #BF1131;
  --color-verde-claro: #014029;
  --color-rojo-claro: #A60F2B;
  --color-gris-neutro: #D9D9D9;
  
  /* Gradientes con colores mexicanos */
  --gradient-primary: linear-gradient(135deg, #025939 0%, #BF1131 100%);
  --gradient-primary-alt: linear-gradient(135deg, #014029 0%, #A60F2B 100%);
  --gradient-card: linear-gradient(135deg, rgba(2, 89, 57, 0.15) 0%, rgba(191, 17, 49, 0.15) 100%);
  --gradient-hero: linear-gradient(135deg, #014029 0%, #025939 50%, #BF1131 100%);
  
  /* Sombras adaptadas */
  --shadow-soft: 0 4px 6px -1px rgba(2, 89, 57, 0.15), 0 2px 4px -1px rgba(191, 17, 49, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(2, 89, 57, 0.2), 0 4px 6px -2px rgba(191, 17, 49, 0.15);
  --shadow-green: 0 4px 12px rgba(2, 89, 57, 0.3);
  --shadow-red: 0 4px 12px rgba(191, 17, 49, 0.3);
  
  /* Otros valores */
  --border-radius: 1rem;
  --border-radius-lg: 1.5rem;
  --animation-duration: .3s;
  
  /* Colores de estado mexicanos */
  --success-color: #025939;
  --error-color: #BF1131;
  --warning-color: #D4A574;
  --info-color: #5B8C5A;
}

*{ box-sizing: border-box; }
img{ max-width:100%; height:auto; }
body{ line-height:1.6; scroll-behavior:smooth; }

/* Transiciones suaves y reduce motion */
*{ transition: all var(--animation-duration) ease; }
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
    scroll-behavior:auto !important;
  }
}

/* Navbar con colores mexicanos */
.navbar{
  backdrop-filter: blur(15px);
  background: rgba(1, 64, 41, 0.95) !important;
  border-bottom: 2px solid rgba(191, 17, 49, 0.3);
  box-shadow: 0 2px 10px rgba(2, 89, 57, 0.2);
}
.navbar-brand{ 
  font-weight:700; 
  font-size:1.5rem; 
  color: #D9D9D9 !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.navbar-brand:hover{
  color: #ffffff !important;
  transform: scale(1.05);
}

/* Links del navbar */
.navbar-nav .nav-link{
  color: rgba(217, 217, 217, 0.9) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: 0.5rem;
  transition: all var(--animation-duration) ease;
}
.navbar-nav .nav-link:hover{
  color: #ffffff !important;
  background: rgba(191, 17, 49, 0.2);
  transform: translateY(-1px);
}

/* Hero con gradiente mexicano */
.hero-section{ 
  background: var(--gradient-hero); 
  position:relative; 
  overflow:hidden;
  min-height: 100vh;
  display: flex;
  align-items: center;
}
.hero-section::before{
  content:'';
  position:absolute; inset:0;
  background:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="mexicanGrid" width="12" height="12" patternUnits="userSpaceOnUse"><path d="M 12 0 L 0 0 0 12" fill="none" stroke="rgba(217,217,217,0.08)" stroke-width="1"/><circle cx="6" cy="6" r="0.5" fill="rgba(191,17,49,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23mexicanGrid)"/></svg>');
  opacity:.15;
}
.hero-section::after{
  content:'';
  position:absolute; inset:0;
  background: radial-gradient(circle at center, transparent 0%, rgba(1, 64, 41, 0.3) 100%);
}
.hero-content{ 
  position:relative; 
  z-index:3; 
}
.display-4{ 
  font-weight:800; 
  line-height:1.1; 
  margin-bottom:1.5rem;
  text-shadow: 0 3px 6px rgba(0,0,0,0.4);
  background: linear-gradient(135deg, #ffffff 0%, #D9D9D9 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lead{ 
  font-size:1.3rem; 
  margin-bottom:2rem;
  color: rgba(217, 217, 217, 0.95);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  font-weight: 400;
}

/* Botones mexicanos */
.btn{ 
  border-radius: var(--border-radius); 
  font-weight:600; 
  padding:.875rem 2rem; 
  position:relative; 
  overflow:hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.9rem;
}

.btn-primary{ 
  background: var(--gradient-primary);
  border:2px solid transparent; 
  box-shadow: var(--shadow-green);
  color: #ffffff;
}
.btn-primary:hover{ 
  transform: translateY(-3px); 
  box-shadow: var(--shadow-lg), 0 8px 25px rgba(2, 89, 57, 0.4);
  background: var(--gradient-primary-alt);
  border-color: rgba(217, 217, 217, 0.3);
}
.btn-primary:active{
  transform: translateY(-1px);
}

.btn-outline-light{ 
  border: 2px solid rgba(217, 217, 217, 0.6);
  color: #D9D9D9;
  background: rgba(217, 217, 217, 0.1);
  backdrop-filter: blur(10px);
}
.btn-outline-light:hover{ 
  transform: translateY(-3px); 
  box-shadow: var(--shadow-lg);
  background: rgba(217, 217, 217, 0.2);
  border-color: #ffffff;
  color: #ffffff;
}

/* Caja de API en hero con tema mexicano */
.hero-api-box{ 
  background: rgba(1, 64, 41, 0.6); 
  backdrop-filter: blur(15px); 
  border: 1px solid rgba(191, 17, 49, 0.3);
  border-radius: var(--border-radius);
  box-shadow: inset 0 1px 0 rgba(217, 217, 217, 0.1);
}
.hero-api-box code{
  color: #D9D9D9;
  background: rgba(2, 89, 57, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
}

/* Mapas con bordes mexicanos */
.map-container{ 
  border-radius: var(--border-radius-lg); 
  overflow:hidden; 
  box-shadow: var(--shadow-lg), 0 0 0 3px rgba(191, 17, 49, 0.2);
  position:relative;
}
.map-container::after{ 
  content:''; 
  position:absolute; 
  inset:0; 
  border: 3px solid;
  border-image: linear-gradient(135deg, #025939, #BF1131) 1;
  border-radius: var(--border-radius-lg); 
  pointer-events:none;
}
#mapPreview,#map{ 
  width:100%; 
  height:100%; 
  border-radius: var(--border-radius-lg);
}

/* Demo form con colores mexicanos */
.demo-form{
  background: var(--gradient-card);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem; 
  margin-bottom: 2rem;
  border: 2px solid rgba(191, 17, 49, 0.2);
  backdrop-filter: blur(15px);
  box-shadow: var(--shadow-soft);
  position: relative;
}
.demo-form::before{
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.form-control,.form-select{
  border-radius: var(--border-radius);
  border: 2px solid rgba(2, 89, 57, 0.3);
  background: rgba(217, 217, 217, 0.05);
  backdrop-filter: blur(10px);
  color: #ffffff;
  font-weight: 500;
}
.form-control:focus,.form-select:focus{
  border-color: #BF1131;
  box-shadow: 0 0 0 .25rem rgba(191, 17, 49, 0.25);
  background: rgba(217, 217, 217, 0.1);
}
.form-control::placeholder{
  color: rgba(217, 217, 217, 0.6);
}

/* Labels mejoradas */
.form-label{
  color: #D9D9D9;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Features con tema mexicano */
.feature-card{
  background: var(--gradient-card);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem; 
  height: 100%;
  border: 2px solid rgba(2, 89, 57, 0.2);
  position: relative; 
  overflow: hidden;
  transition: all var(--animation-duration) ease;
}
.feature-card::before{
  content:''; 
  position:absolute; 
  top:0; left:-100%; 
  width:100%; height:100%;
  background: linear-gradient(90deg, transparent, rgba(191, 17, 49, 0.15), transparent);
  transition: left .8s ease;
}
.feature-card:hover{ 
  transform: translateY(-6px); 
  box-shadow: var(--shadow-lg), var(--shadow-green);
  border-color: rgba(191, 17, 49, 0.4);
}
.feature-card:hover::before{ 
  left: 100%; 
}

.feature-icon{
  width: 56px; 
  height: 56px; 
  border-radius: 50%;
  background: var(--gradient-primary); 
  color: #ffffff;
  display: flex; 
  align-items: center; 
  justify-content: center; 
  margin-bottom: 1.5rem; 
  font-size: 1.5rem;
  box-shadow: var(--shadow-green);
  border: 3px solid rgba(217, 217, 217, 0.2);
}

/* Respuesta con tema mexicano */
.response-card{ 
  background: rgba(1, 64, 41, 0.4); 
  border-radius: var(--border-radius-lg); 
  border: 2px solid rgba(191, 17, 49, 0.3); 
  backdrop-filter: blur(15px);
  box-shadow: var(--shadow-soft);
}
.response-card .card-header{
  background: rgba(2, 89, 57, 0.3);
  border-bottom: 1px solid rgba(191, 17, 49, 0.3);
  color: #D9D9D9;
  font-weight: 600;
}
.response-card pre{ 
  background: transparent; 
  border: none; 
  color: #D9D9D9; 
  font-size: .9rem; 
  line-height: 1.6; 
  max-height: 320px; 
  overflow-y: auto; 
  scrollbar-width: thin;
  font-family: 'Courier New', monospace;
}

/* Scrollbar personalizada */
.response-card pre::-webkit-scrollbar{
  width: 6px;
}
.response-card pre::-webkit-scrollbar-track{
  background: rgba(1, 64, 41, 0.3);
  border-radius: 3px;
}
.response-card pre::-webkit-scrollbar-thumb{
  background: rgba(191, 17, 49, 0.6);
  border-radius: 3px;
}

/* CTA section mexicana */
.cta-section{ 
  background: var(--gradient-hero); 
  border-radius: var(--border-radius-lg); 
  position: relative; 
  overflow: hidden;
  border: 3px solid rgba(217, 217, 217, 0.2);
}
.cta-section::before{
  content:''; 
  position:absolute; 
  inset:0;
  background:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="15" cy="15" r="2" fill="rgba(217,217,217,0.1)"/><circle cx="85" cy="85" r="2" fill="rgba(217,217,217,0.1)"/><circle cx="85" cy="15" r="1" fill="rgba(191,17,49,0.1)"/><circle cx="15" cy="85" r="1" fill="rgba(2,89,57,0.1)"/><polygon points="50,10 55,20 50,30 45,20" fill="rgba(217,217,217,0.05)"/></svg>');
  opacity: .4;
}

/* Loading con colores mexicanos */
.loading-spinner{ 
  display: none;
  border-color: rgba(217, 217, 217, 0.3) rgba(217, 217, 217, 0.3) #BF1131 #BF1131;
}
.loading .loading-spinner{ 
  display: inline-block; 
}
.loading .btn-text{ 
  opacity: .8; 
}

/* Status indicators mexicanos */
.status-indicator{ 
  display: inline-block; 
  width: 10px; 
  height: 10px; 
  border-radius: 50%; 
  margin-right: .75rem;
  border: 2px solid rgba(255,255,255,0.3);
}
.status-success{ 
  background: #025939; 
  box-shadow: 0 0 8px rgba(2, 89, 57, 0.6);
}
.status-error{ 
  background: #BF1131; 
  box-shadow: 0 0 8px rgba(191, 17, 49, 0.6);
}
.status-loading{ 
  background: #D4A574; 
  animation: mexicanPulse 1.5s infinite;
  box-shadow: 0 0 8px rgba(212, 165, 116, 0.6);
}

@keyframes mexicanPulse{ 
  0%, 100% { 
    opacity: 1; 
    transform: scale(1); 
  } 
  50% { 
    opacity: .6; 
    transform: scale(1.1); 
  } 
}

/* Scroll to top mexicano */
.scroll-top{
  position: fixed; 
  bottom: 2rem; 
  right: 2rem; 
  z-index: 1000;
  background: var(--gradient-primary); 
  color: #fff; 
  border: 3px solid rgba(217, 217, 217, 0.3);
  border-radius: 50%; 
  width: 60px; 
  height: 60px;
  display: flex; 
  align-items: center; 
  justify-content: center;
  opacity: 0; 
  visibility: hidden;
  font-size: 1.25rem;
  box-shadow: var(--shadow-lg);
}
.scroll-top.visible{ 
  opacity: 1; 
  visibility: visible; 
}
.scroll-top:hover{ 
  transform: translateY(-4px) scale(1.1); 
  box-shadow: var(--shadow-lg), var(--shadow-green);
  border-color: #ffffff;
}

/* Cards mejoradas */
.card{
  background: rgba(1, 64, 41, 0.2);
  border: 2px solid rgba(191, 17, 49, 0.2);
  border-radius: var(--border-radius-lg);
}
.card-header{
  background: rgba(2, 89, 57, 0.3);
  border-bottom: 1px solid rgba(191, 17, 49, 0.3);
  font-weight: 600;
}

/* Secciones */
.bg-body-secondary{
  background: linear-gradient(180deg, 
    rgba(1, 64, 41, 0.05) 0%, 
    rgba(2, 89, 57, 0.1) 50%, 
    rgba(1, 64, 41, 0.05) 100%) !important;
}

/* Footer mexicano */
footer{
  background: linear-gradient(135deg, #014029 0%, #025939 100%);
  border-top: 3px solid rgba(191, 17, 49, 0.3);
}
footer .container{
  color: rgba(217, 217, 217, 0.8);
}
footer a{
  color: rgba(217, 217, 217, 0.7) !important;
  transition: all var(--animation-duration) ease;
}
footer a:hover{
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(191, 17, 49, 0.5);
}

/* Responsive con ajustes mexicanos */
@media (max-width: 768px){
  .display-4{ 
    font-size: 2.2rem; 
  }
  .demo-form{ 
    padding: 1.75rem; 
  }
  .hero-section{ 
    padding-top: 4rem; 
    padding-bottom: 4rem;
    min-height: 80vh;
  }
  .btn{ 
    width: 100%; 
    margin-bottom: .75rem; 
  }
  .feature-card{ 
    margin-bottom: 2rem; 
  }
  .navbar-nav{ 
    gap: .75rem; 
    margin-top: 1rem; 
  }
  .feature-icon{
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
}

@media (max-width: 576px){
  .hero-section{
    min-height: 70vh;
  }
  .display-4{
    font-size: 1.8rem;
  }
  .lead{
    font-size: 1.1rem;
  }
  .demo-form{
    padding: 1.25rem;
  }
}

/* Focus visible con colores mexicanos */
:focus-visible {
  outline: 3px solid #BF1131;
  outline-offset: 3px;
  border-radius: 4px;
}

/* Animaciones adicionales */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.8s ease forwards;
}

/* Efectos de hover adicionales */
.feature-card h5 {
  color: #D9D9D9;
  transition: color var(--animation-duration) ease;
}

.feature-card:hover h5 {
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Mejoras en tipografía */
h1, h2, h3, h4, h5, h6 {
  color: #D9D9D9;
  font-weight: 700;
}

.text-muted {
  color: rgba(217, 217, 217, 0.7) !important;
}

/* Validación de formularios */
.form-control.is-valid,
.form-select.is-valid {
  border-color: var(--success-color);
  box-shadow: 0 0 0 .25rem rgba(2, 89, 57, 0.25);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--error-color);
  box-shadow: 0 0 0 .25rem rgba(191, 17, 49, 0.25);
}