/* ============================================================================
   FC Suplementos — Base Styles
   Reset, typography, global utilities
   ============================================================================ */

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

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

body {
  font-family: var(--ff-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background-color: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

body.cart-open,
body.menu-open,
body.modal-open {
  overflow: hidden;
}

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

img {
  height: auto;
}

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

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

/* ── Accesibilidad: foco visible por teclado (anillo lima) ── */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ── Respetar reduce-motion: sin animaciones ni parallax ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

a {
  color: var(--c-primary-light);
  text-decoration: none;
  transition: color var(--tr-fast);
}

a:hover {
  color: var(--c-primary);
}

ul, ol {
  list-style: none;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: 0;
}

/* Titulares display "action": condensados + mayúsculas (look atlético) */
h1, h2, h3 {
  text-transform: uppercase;
  letter-spacing: 0.005em;
  font-weight: var(--fw-black);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

@media (max-width: 768px) {
  h1 { font-size: var(--fs-3xl); }
  h2 { font-size: var(--fs-2xl); }
  h3 { font-size: var(--fs-xl); }
}

.text-gradient {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-accent {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-mono {
  font-family: var(--ff-mono);
}

/* ── Layout ── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.container--narrow {
  max-width: var(--max-w-narrow);
}

/* El header es sticky (ocupa lugar en el flujo): el padding-top de --header-h
   duplicaba el offset y dejaba una franja muerta de 80px arriba de cada página. */
.page {
  min-height: 60vh;
}

.section {
  padding: var(--sp-16) 0;
}

.section--sm {
  padding: var(--sp-10) 0;
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--sp-4);
  }
  .section {
    padding: var(--sp-10) 0;
  }
}

/* ── Grid ── */
.grid {
  display: grid;
  gap: var(--sp-6);
}

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

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Flexbox helpers ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  border-radius: var(--r-md);
  transition: all var(--tr-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--ff-sans);
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--tr-fast);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:hover::after {
  background: rgba(255,255,255,0.15);
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--c-primary);
  color: var(--c-text-inverse);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--c-primary-light);
}

.btn--primary:hover {
  box-shadow: 0 15px 30px var(--c-accent-glow);
  background: var(--c-primary-light);
  border-color: var(--c-accent);
  color: var(--c-text-inverse);
}

.btn--accent {
  background: var(--grad-accent);
  color: var(--c-primary-dark);
  box-shadow: var(--sh-glow-accent);
  border: 1px solid var(--c-accent-light);
}

.btn--accent:hover {
  box-shadow: 0 0 30px var(--c-accent-glow);
  filter: brightness(1.1);
}

.btn--outline {
  border: 1.5px solid var(--c-border);
  color: var(--c-text);
  background: transparent;
}

.btn--outline:hover {
  border-color: var(--c-accent);
  color: var(--c-accent-dark);
  background: var(--c-primary);
  box-shadow: 0 10px 25px var(--c-accent-glow);
}

.btn--ghost {
  color: var(--c-text-secondary);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--c-text);
  background: var(--c-surface);
}

.btn--whatsapp {
  background: var(--c-whatsapp);
  color: #fff;
}

.btn--whatsapp:hover {
  background: var(--c-whatsapp-dark);
}

.btn--sm {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
}

/* En pantallas táctiles, ningún botón por debajo de 42px de alto */
@media (pointer: coarse) {
  .btn--sm { min-height: 42px; }
  .product-detail__breadcrumb a { padding: var(--sp-2) 0; display: inline-block; }
}

.btn--lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--fs-lg);
  border-radius: var(--r-lg);
}

.btn--full {
  width: 100%;
}

.btn--icon {
  padding: var(--sp-3);
  border-radius: var(--r-md);
  width: 44px;
  height: 44px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  border-radius: var(--r-full);
  text-transform: uppercase;
}

.badge--primary  { background: var(--c-info-bg);    color: var(--c-primary-light); }
.badge--success  { background: var(--c-success-bg); color: var(--c-success); }
.badge--warning  { background: var(--c-warning-bg); color: var(--c-warning); }
.badge--danger   { background: var(--c-danger-bg);  color: var(--c-danger); }
.badge--accent   { background: var(--c-accent-glow); color: var(--c-accent-light); }

/* ── Form elements ── */
.input, .textarea, .select {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: var(--fs-base);
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-glow);
}

.input::placeholder, .textarea::placeholder {
  color: var(--c-text-muted);
}

.textarea {
  resize: vertical;
  min-height: 100px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23A0A0B8' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-secondary);
}

/* ── Overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--tr-base), visibility var(--tr-base);
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── Scroll reveal animation ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ── Skeleton loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--c-surface) 25%, var(--c-surface-hover) 50%, var(--c-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Pulse animation (WhatsApp) ── */
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
  70%  { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* ── Bounce animation (cart badge) ── */
@keyframes bounce-in {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ── Fade-in ── */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slide-out-right {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}

/* ── Price styling ── */
.price {
  font-family: var(--ff-mono);
  font-weight: var(--fw-bold);
  color: var(--c-text);
}

.price--large {
  font-size: var(--fs-2xl);
}

.price--old {
  text-decoration: line-through;
  color: var(--c-text-muted);
  font-weight: var(--fw-normal);
  font-size: var(--fs-sm);
}

.price--discount {
  color: var(--c-success);
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--sp-6) 0;
}

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

/* ── Toast / notification ── */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--c-surface);
  color: var(--c-text);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  border: 1px solid var(--c-border);
  z-index: var(--z-toast);
  font-weight: var(--fw-medium);
  transition: transform var(--tr-spring);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast--success { 
  border-left: 4px solid var(--c-success); 
  background: var(--c-success-bg);
}
.toast--error { 
  border-left: 4px solid var(--c-danger); 
  background: var(--c-danger-bg);
}

/* ── Section titles ── */
.section-title {
  text-align: center;
  margin-bottom: var(--sp-10);
}

.section-title h2 {
  margin-bottom: var(--sp-3);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-weight: var(--fw-bold);
}

.section-title p {
  color: var(--c-text-secondary);
  font-size: var(--fs-lg);
  max-width: 600px;
  margin: 0 auto;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--sp-16) var(--sp-6);
  color: var(--c-text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--sp-4);
  opacity: 0.4;
}

/* ── Spinner ── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-center {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--sp-16);
}

/* ── Responsive Visibility ── */
.mobile-only-auth {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-only-auth {
    display: block !important;
  }
  .desktop-only {
    display: none !important;
  }
}
