/* ========================================
   ALTEQX - BASE STYLES
   Variables, Reset, Typography & Utilities
   ======================================== */

/* ========== CSS VARIABLES ========== */
:root {
  /* Colors - Mejorado contraste WCAG AA */
  --color-dark: #0a0f1e;
  --color-dark-lighter: #151b2e;
  --color-card: #1a2235;
  --color-card-hover: #212b42;
  
  --color-primary: #2563eb;
  --color-primary-dark: #1e40af;
  --color-primary-light: #60a5fa;
  
  --color-success: #25D366;
  --color-success-dark: #1EBE57;
  
  --color-danger: #ef4444;
  --color-danger-dark: #dc2626;
  
  --color-warning: #f59e0b;
  
  --color-text: #f1f5f9;
  --color-text-secondary: #cbd5e1;
  --color-text-muted: #94a3b8;
  
  --color-border: #334155;
  --color-border-light: #475569;
  
  /* Backgrounds con overlay */
  --overlay-dark: rgba(10, 15, 30, 0.95);
  --overlay-card: rgba(26, 34, 53, 0.8);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Poppins', sans-serif;
  
  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-tooltip: 1060;
}

/* ========== RESET ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-dark);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

/* FIX: Tamaños explícitos para evitar warning H1UserAgentFontSizeInSection */
h1 { 
  font-size: clamp(1.875rem, 5vw, 3rem);
}

/* Normalizar h1 dentro de elementos semánticos para evitar reducción automática del navegador */
section h1,
article h1,
aside h1,
nav h1,
header h1,
footer h1 {
  font-size: clamp(1.875rem, 5vw, 3rem);
  line-height: 1.2;
  margin: 0;
}

h2 { 
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.2;
}

h3 { 
  font-size: clamp(1.25rem, 3vw, 1.875rem);
  line-height: 1.2;
}

h4 { 
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  line-height: 1.3;
}

h5 { 
  font-size: 1.125rem;
  line-height: 1.3;
}

h6 { 
  font-size: 1rem;
  line-height: 1.4;
}

p {
  margin-bottom: var(--space-4);
}

/* ========== LAYOUT UTILITIES ========== */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.section {
  padding: var(--space-12) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-16) 0;
  }
}

.section-alt {
  background-color: var(--color-dark-lighter);
}

/* ========== GRID SYSTEM ========== */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid { gap: var(--space-5); }
}

@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .grid { gap: var(--space-6); }
}

@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ========== TEXT UTILITIES ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--color-primary-light); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-muted { color: var(--color-text-muted); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* ========== SPACING UTILITIES ========== */
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  cursor: pointer;
  white-space: nowrap;
  border: 2px solid transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible {
  background-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

.btn-success {
  background-color: var(--color-success);
  color: black;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

.btn-success:hover:not(:disabled),
.btn-success:focus-visible {
  background-color: var(--color-success-dark);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border-light);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  color: #ffffff;
  background-color: rgba(37, 99, 235, 0.25);
}

.btn-block {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  margin-bottom: var(--space-3);
}

@media (min-width: 640px) {
  .btn {
    font-size: 1rem;
    padding: var(--space-4) var(--space-8);
  }
}

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-hot {
  background-color: #b91c1c;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.4);
}

.badge-new,
.badge-nuevo {
  background-color: #1e40af;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.35);
}

.badge-top { 
  background-color: var(--color-warning); 
  color: var(--color-dark); 
}

.badge-discount { 
  background-color: #10b981;
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
}

.badge-descuento,
.badge-oferta {
  background-color: #f59e0b;
  color: #000000;
  border: 1px solid rgba(255,255,255,0.3);
  font-weight: 700;
}

.badge-count {
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  font-size: 0.625rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ========== LOADING SPINNER ========== */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========== REVEAL ON SCROLL ========== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ========== ACCESSIBILITY ========== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-light);
}

/* ========== REDUCED MOTION ========== */
@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;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* ========== PRINT STYLES ========== */
@media print {
  *,
  *::before,
  *::after {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  img {
    page-break-inside: avoid;
  }
  
  h2,
  h3 {
    page-break-after: avoid;
  }
}