/**
 * BASE STYLES - GOMALOR
 * Estilos globales y fundacionales del sitio
 */

/* ============================================
   BODY & HTML
   ============================================ */

html {
  font-size: 16px;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-gray-dark);
  background-color: var(--color-white);
  overflow-x: hidden;
}

/* ============================================
   TIPOGRAFÍA GLOBAL
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headings);
  font-weight: var(--weight-bold);
  color: var(--color-black);
  margin-bottom: var(--space-sm);
}

h1 {
  font-size: var(--text-5xl);
  line-height: var(--leading-tight);
}

h2 {
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
}

h3 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
}

h4 {
  font-size: var(--text-2xl);
}

h5 {
  font-size: var(--text-xl);
}

h6 {
  font-size: var(--text-lg);
}

p {
  margin-bottom: var(--space-md);
}

p:last-child {
  margin-bottom: 0;
}

strong, b {
  font-weight: var(--weight-bold);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
}

/* ============================================
   ENLACES
   ============================================ */

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-normal) var(--easing-smooth);
}

a:hover {
  color: var(--color-primary-light);
}

a:active {
  color: var(--color-primary-dark);
}

/* ============================================
   SECCIONES
   ============================================ */

section {
  padding: var(--space-3xl) 0;
  position: relative;
}

@media (max-width: 768px) {
  section {
    padding: var(--space-2xl) 0;
  }
}

/* Secciones alternas con fondo gris */
section:nth-child(even) {
  background-color: var(--color-gray-lightest);
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.section-title {
  font-size: var(--text-4xl);
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--color-secondary), var(--color-accent));
  border-radius: var(--radius-full);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-gray-medium);
  margin-top: var(--space-md);
}

@media (max-width: 768px) {
  .section-title {
    font-size: var(--text-3xl);
  }
  
  .section-subtitle {
    font-size: var(--text-base);
  }
}

/* ============================================
   BOTONES
   ============================================ */

.btn {
  display: inline-block;
  padding: var(--btn-padding-y) var(--btn-padding-x);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  font-family: var(--font-primary);
  text-align: center;
  text-decoration: none;
  border-radius: var(--btn-border-radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-normal) var(--easing-smooth);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width var(--duration-slow) var(--easing-smooth),
              height var(--duration-slow) var(--easing-smooth);
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

/* Botón primario */
.btn--primary {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.btn--primary:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Botón secundario */
.btn--secondary {
  background-color: transparent;
  color: var(--color-white);
  border-color: var(--color-white);
}

.btn--secondary:hover {
  background-color: var(--color-white);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn--secondary:active {
  transform: translateY(0);
}

/* Botón outline */
.btn--outline {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn--outline:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* Botón full width */
.btn--full {
  width: 100%;
  display: block;
}

/* Botón deshabilitado */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 768px) {
  .btn {
    padding: 0.625rem 1.5rem;
    font-size: var(--text-sm);
  }
}

/* ============================================
   FORMULARIOS
   ============================================ */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-gray-dark);
  margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--text-base);
  font-family: var(--font-primary);
  color: var(--color-gray-dark);
  background-color: var(--color-white);
  border: 2px solid var(--input-border-color);
  border-radius: var(--input-border-radius);
  transition: all var(--duration-normal) var(--easing-smooth);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--input-focus-border-color);
  box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-gray);
}

/* Estados de validación */
.form-input.is-valid,
.form-select.is-valid,
.form-textarea.is-valid {
  border-color: var(--color-success);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--color-error);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--color-gray-lightest);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ============================================
   IMÁGENES
   ============================================ */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.img-fluid {
  width: 100%;
  height: auto;
}

.img-cover {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.img-contain {
  object-fit: contain;
  width: 100%;
  height: 100%;
}

/* ============================================
   UTILIDADES
   ============================================ */

/* Espaciado */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

/* Texto */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-white { color: var(--color-white); }
.text-gray { color: var(--color-gray-medium); }

.font-bold { font-weight: var(--weight-bold); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-medium { font-weight: var(--weight-medium); }
.font-normal { font-weight: var(--weight-normal); }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }

/* Flexbox */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================
   SCROLL TO TOP BUTTON
   ============================================ */

.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background-color: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(100px);
  transition: all var(--duration-normal) var(--easing-smooth);
  z-index: var(--z-fixed);
  box-shadow: var(--shadow-lg);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background-color: var(--color-primary-light);
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.scroll-to-top:active {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .scroll-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}

/* ============================================
   LOADING SPINNER (para uso futuro)
   ============================================ */

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-gray-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   OVERLAY GENERAL
   ============================================ */

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-dark);
  z-index: 1;
}

/* ============================================
   SELECCIÓN DE TEXTO
   ============================================ */

::selection {
  background-color: var(--color-primary);
  color: var(--color-white);
}

::-moz-selection {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* ============================================
   SCROLLBAR PERSONALIZADA (webkit)
   ============================================ */

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background-color: var(--color-gray-lightest);
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-primary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-primary-light);
}