/* OPTIMIZED BUILD */
/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-primary);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* === VARIABLES === */
:root {
  /* Colores Cyberpunk (rojo neón + negro) */
  --color-primary: #FF0033;
  --color-primary-light: #FF3366;
  --color-primary-dark: #CC0029;
  --color-accent: #00FFFF;
  --color-bg: #0A0A0A;
  --color-surface: #1A1A1A;
  --color-text: #E0E0E0;
  --color-text-secondary: #999999;
  --color-border: #333333;
  --color-success: #00FF66;
  --color-error: #FF0033;
  --color-warning: #FFCC00;
  --color-info: #00CCFF;

  /* Tipografía */
  --font-primary: 'Rajdhani', system-ui, -apple-system, sans-serif;
  --font-display: 'Orbitron', sans-serif;

  /* Text Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 4rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --max-width-wide: 1400px;

  /* Border Radius */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;
}

/* === COMPONENTS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}
.btn:hover::before {
  width: 300px;
  height: 300px;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 0, 51, 0.5);
}
.btn-primary:hover {
  background: var(--color-primary-light);
  box-shadow: 0 0 30px rgba(255, 0, 51, 0.8);
  transform: translateY(-2px);
}
.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn-secondary:hover {
  background: var(--color-primary);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover {
  background: var(--color-surface);
  color: var(--color-text);
}
.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: 0.6; pointer-events: none; }
.btn-icon {
  background: transparent;
  border: none;
  color: var(--color-text);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  position: relative;
}
.btn-icon:hover {
  background: var(--color-surface);
  color: var(--color-primary);
}
.btn-icon .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
  max-width: 360px;
  border-left: 3px solid currentColor;
}
.toast.success { background: var(--color-success); color: #000; }
.toast.error { background: var(--color-error); }
.toast.warning { background: var(--color-warning); color: #000; }
.toast.info { background: var(--color-info); color: #000; }
.toast.hiding { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

.skeleton {
  background: linear-gradient(90deg, var(--color-surface) 25%, rgba(255,255,255,0.05) 50%, var(--color-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
.skeleton-text { height: 1em; margin-bottom: 0.5em; }
.skeleton-title { height: 1.5em; width: 60%; margin-bottom: 0.75em; }
.skeleton-image { height: 200px; width: 100%; }

main, [role="main"], .app-container {
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.helix-powered {
  text-align: center;
  padding: var(--space-4) var(--space-4) var(--space-6);
}
.helix-powered a {
  font-size: 10px;
  color: #999;
  opacity: 0.35;
  text-decoration: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  transition: opacity 0.2s;
}
.helix-powered a:hover {
  opacity: 0.7;
}

/* === LAYOUT === */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4) 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}
.logo img {
  height: 40px;
  width: auto;
  filter: drop-shadow(0 0 10px rgba(255, 0, 51, 0.6));
  transition: filter 0.3s;
}
.logo:hover img {
  filter: drop-shadow(0 0 20px rgba(255, 0, 51, 1));
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  padding: var(--space-2);
}
.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-text);
  transition: all 0.3s;
}
.nav-list {
  display: flex;
  gap: var(--space-6);
  list-style: none;
}
.nav-list a {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  transition: color 0.2s;
  position: relative;
}
.nav-list a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width 0.3s;
}
.nav-list a:hover {
  color: var(--color-primary);
}
.nav-list a:hover::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* === HERO === */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #0A0A0A 0%, #1A0A0A 100%);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,0,51,0.03) 2px, rgba(255,0,51,0.03) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255,0,51,0.03) 2px, rgba(255,0,51,0.03) 4px);
  animation: grid-move 20s linear infinite;
}
@keyframes grid-move {
  0% { transform: translateY(0); }
  100% { transform: translateY(40px); }
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--space-16) var(--space-4);
}
.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 800;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-6);
  text-shadow: 0 0 30px rgba(255, 0, 51, 0.8);
}
.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.glitch {
  position: relative;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}
.glitch::before {
  animation: glitch-1 2s infinite;
  color: #00FFFF;
  z-index: -1;
}
.glitch::after {
  animation: glitch-2 3s infinite;
  color: #FF00FF;
  z-index: -2;
}
@keyframes glitch-1 {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
}
@keyframes glitch-2 {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(2px, -2px); }
  40% { transform: translate(2px, 2px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(-2px, 2px); }
}

/* === SECTIONS === */
.section {
  padding: var(--space-16) 0;
}
.section-dark {
  background: var(--color-surface);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-8);
  text-align: center;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

/* === CATEGORIES === */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}
.category-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all 0.3s;
  font-family: var(--font-display);
}
.category-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 20px rgba(255, 0, 51, 0.4);
  transform: translateY(-4px);
}
.category-card.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 30px rgba(255, 0, 51, 0.6);
}
.category-icon {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-3);
}
.category-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === SEARCH === */
.search-box {
  position: relative;
  max-width: 400px;
}
.search-box input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  transition: all 0.2s;
}
.search-box input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(255, 0, 51, 0.3);
}

/* === PRODUCTS === */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-6);
}
.product-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s;
  position: relative;
}
.product-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 8px 30px rgba(255, 0, 51, 0.3);
  transform: translateY(-4px);
}
.product-image {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--color-surface);
}
.product-info {
  padding: var(--space-4);
}
.product-category {
  font-size: var(--text-xs);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-2);
  font-weight: 600;
}
.product-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}
.product-price {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}
.product-stock {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}
.product-stock.low {
  color: var(--color-warning);
}
.product-stock.out {
  color: var(--color-error);
}

.skeleton-card .product-info {
  padding: var(--space-4);
}

/* === ABOUT === */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: center;
}
.about-content h2 {
  text-align: left;
  margin-bottom: var(--space-6);
}
.about-content p {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}
.about-image img {
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-border);
  box-shadow: 0 0 30px rgba(255, 0, 51, 0.2);
}

/* === FOOTER === */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-12) 0 var(--space-6);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.footer-col h4 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
}
.footer-col ul {
  list-style: none;
}
.footer-col li {
  margin-bottom: var(--space-2);
}
.footer-col a {
  color: var(--color-text-secondary);
  transition: color 0.2s;
}
.footer-col a:hover {
  color: var(--color-primary);
}
.footer-col p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.footer-bottom {
  text-align: center;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

/* === MODALS === */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal.hidden {
  display: none;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--color-bg);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  max-width: 500px;
  width: 100%;
  box-shadow: 0 0 40px rgba(255, 0, 51, 0.5);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--text-3xl);
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover {
  color: var(--color-primary);
}
.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-6);
  text-align: center;
}

.tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}
.tab {
  flex: 1;
  padding: var(--space-3);
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.tab:hover {
  color: var(--color-text);
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
#auth-form input {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  transition: all 0.2s;
}
#auth-form input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(255, 0, 51, 0.3);
}

.modal-cart {
  max-width: 600px;
}
#cart-items {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: var(--space-6);
}
.cart-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}
.cart-item-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.cart-item-info {
  flex: 1;
}
.cart-item-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.cart-item-price {
  font-size: var(--text-lg);
  color: var(--color-primary);
  font-weight: 700;
}
.cart-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.cart-item-qty {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
}
.cart-item-qty button {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: var(--text-base);
  font-weight: 700;
}
.cart-item-qty button:hover {
  color: var(--color-primary);
}
.cart-item-qty span {
  min-width: 30px;
  text-align: center;
  font-weight: 600;
}
.cart-item-remove {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--color-error);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.cart-item-remove:hover {
  text-decoration: underline;
}

.cart-footer {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-6);
}
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  font-size: var(--text-xl);
}
.cart-total-price {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-primary);
}

.cart-empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-secondary);
}

/* === RESPONSIVE === */
@media (max-width: 767px) {
  .nav-toggle {
    display: flex;
  }
  .nav-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    flex-direction: column;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
  }
  .nav-list.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .hero-title {
    font-size: var(--text-3xl);
  }
  .section-title {
    font-size: var(--text-2xl);
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
  }
}

@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (min-width: 1024px) {
  .hero-title {
    font-size: var(--text-6xl);
  }
}