/* Estilos globales con la paleta de colores de Sungrow */

/* Reset y base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  font-size: 16px;
  overflow-x: hidden;
  overflow-y: hidden; /* Evitar scrollbar en html */
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--color-background);
  color: var(--color-dark);
  line-height: 1.6;
  overflow-x: hidden;
  overflow-y: hidden; /* Evitar scrollbar en body */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}


/* Tipografía mejorada */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-dark);
  margin-bottom: 1rem;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h5 { font-size: clamp(1.125rem, 2vw, 1.5rem); }
h6 { font-size: clamp(1rem, 1.5vw, 1.25rem); }

p {
  margin-bottom: 1rem;
  color: var(--color-gray);
}

/* Botones con la paleta de Sungrow */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-normal);
  text-align: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

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

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

/* Formularios mejorados */
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  transition: var(--transition-normal);
  background-color: white;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: #ffd001;
  box-shadow: 0 0 0 3px rgba(255, 208, 1, 0.2);
}

.form-control.error {
  border-color: var(--logo-red);
  box-shadow: 0 0 0 3px var(--shadow-red);
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--color-dark);
}

.field-error {
  color: var(--logo-red);
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* Prevenir zoom en inputs en iOS */
@media (max-width: 768px) {
  input[type="text"],
  input[type="tel"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Alertas mejoradas */
.alert {
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 20px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition-normal);
}

.alert i {
  font-size: 18px;
}

/* Cards mejoradas */
.card, .news-card {
  background: white;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition-normal);
  overflow: hidden;
  position: relative;
}

.card::before, .news-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #004601;
}

.card:hover, .news-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: #ffd001;
}

/* Loading y spinner mejorados */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--color-primary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f7faf9;
  border-top: 4px solid #004601;
  border-right: 4px solid #005a01;
  border-bottom: 4px solid #004601;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Estados de hover y focus mejorados */
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

/* Imágenes responsive */
img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--border-radius-sm);
}

/* Enlaces mejorados */
a {
  color: #004601;
  text-decoration: none;
  transition: var(--transition-normal);
  -webkit-tap-highlight-color: rgba(246, 16, 48, 0.2);
}

a:hover {
  color: #f61030;
  text-decoration: underline;
}

/* Contenedor principal */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .form-control {
    font-size: 16px; /* Evita zoom en iOS */
  }
}

/* Clases utilitarias */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.fw-light { font-weight: 300; }
.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }
.fw-black { font-weight: 900; }

.color-primary { color: var(--color-primary); }
.color-secondary { color: var(--color-secondary); }
.color-accent { color: var(--color-accent); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 3rem; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Utility Classes Responsive */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .show-mobile { display: none !important; }
}

/* Sombras utilitarias */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Border radius utilitarios */
.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-md { border-radius: var(--border-radius-md); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-full { border-radius: var(--border-radius-full); }

/* Scrollbar personalizado - Solo para elementos específicos */
/* Removido scrollbar global para evitar scrollbars duplicados */

/* Selección de texto */
::selection {
  background-color: #90EE90;
  color: #004601;
}

::-moz-selection {
  background-color: #90EE90;
  color: #004601;
}

/* Mejoras de accesibilidad */
:focus-visible {
  outline: 3px solid #005a01;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Animaciones solo en dispositivos que lo soporten */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
