/* ============================================================
   UK MUSCLE MART — Design System
   Premium Fitness E-Commerce Design Tokens
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&display=swap');

/* ============================================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */
:root {
  /* ── Brand Colors ── */
  --color-primary: #0a0a0a;
  --color-primary-light: #1a1a1a;
  --color-primary-lighter: #2a2a2a;
  --color-secondary: #ffffff;
  --color-secondary-dim: #e0e0e0;
  --color-accent: #e63946;
  --color-accent-hover: #ff4757;
  --color-accent-dark: #c1121f;
  --color-accent-glow: rgba(230, 57, 70, 0.3);

  /* ── Neutral Palette ── */
  --color-bg: #0a0a0a;
  --color-bg-elevated: #111111;
  --color-bg-card: #161616;
  --color-bg-card-hover: #1e1e1e;
  --color-bg-input: #1a1a1a;
  --color-bg-overlay: rgba(0, 0, 0, 0.7);
  --color-border: #2a2a2a;
  --color-border-light: #333333;
  --color-text: #ffffff;
  --color-text-secondary: #a0a0a0;
  --color-text-muted: #666666;
  --color-text-inverse: #0a0a0a;

  /* ── Status Colors ── */
  --color-success: #2ed573;
  --color-success-bg: rgba(46, 213, 115, 0.1);
  --color-warning: #ffa502;
  --color-warning-bg: rgba(255, 165, 2, 0.1);
  --color-error: #ff4757;
  --color-error-bg: rgba(255, 71, 87, 0.1);
  --color-info: #3498db;
  --color-info-bg: rgba(52, 152, 219, 0.1);

  /* ── Variable Aliases (for CSS file compatibility) ── */
  --color-bg-base: var(--color-bg);
  --color-bg-surface: var(--color-bg-card);
  --color-text-primary: var(--color-text);
  --color-primary: var(--color-accent);
  --transition-normal: var(--transition-base);
  --color-bg-input-focus: var(--color-accent-glow);
  --z-overlay: var(--z-modal-backdrop);
  --z-drawer: calc(var(--z-modal) + 100);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);

  /* ── Typography ── */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Type Scale (1.25 ratio) */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-md: 1.125rem;   /* 18px */
  --text-lg: 1.25rem;    /* 20px */
  --text-xl: 1.5rem;     /* 24px */
  --text-2xl: 1.875rem;  /* 30px */
  --text-3xl: 2.25rem;   /* 36px */
  --text-4xl: 3rem;      /* 48px */
  --text-5xl: 3.75rem;   /* 60px */
  --text-6xl: 4.5rem;    /* 72px */

  /* Font Weights */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
  --weight-black: 900;

  /* Line Heights */
  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Letter Spacing */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;
  --tracking-wider: 0.1em;
  --tracking-widest: 0.2em;

  /* ── Spacing Scale ── */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */
  --space-32: 8rem;     /* 128px */

  /* ── Border Radius ── */
  --radius-sm: 0.375rem;  /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--color-accent-glow);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--color-accent-glow);

  /* ── Transitions ── */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-smooth: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Z-Index Scale ── */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-whatsapp: 700;
  --z-tooltip: 800;

  /* ── Layout ── */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --container-2xl: 1400px;
  --nav-height: 72px;
  --nav-height-mobile: 64px;
}

/* ============================================================
   2. CSS RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

/* ============================================================
   3. TYPOGRAPHY UTILITIES
   ============================================================ */
.heading-display {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.heading-1 {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: var(--weight-extrabold);
}

.heading-2 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
}

.heading-3 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

.heading-4 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.body-lg { font-size: var(--text-lg); }
.body-md { font-size: var(--text-md); }
.body-sm { font-size: var(--text-sm); }
.body-xs { font-size: var(--text-xs); }
.text-muted { color: var(--color-text-secondary); }
.text-accent { color: var(--color-accent); }
.text-center { text-align: center; }
.text-uppercase {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

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

.container-narrow {
  max-width: var(--container-md);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-wide {
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

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

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

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

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

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

/* ============================================================
   5. BUTTON SYSTEM
   ============================================================ */
.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-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

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

.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--color-secondary);
  border: 1.5px solid var(--color-border-light);
}

.btn-secondary:hover {
  border-color: var(--color-secondary);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

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

.btn-ghost:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
}

.btn-whatsapp {
  background: #25d366;
  color: #fff;
}

.btn-whatsapp:hover {
  background: #22c55e;
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.3);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
}

.btn-danger:hover {
  background: #ff6b7a;
  transform: translateY(-2px);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn-icon {
  padding: var(--space-3);
  border-radius: var(--radius-md);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============================================================
   6. FORM ELEMENTS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-input);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-base);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

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

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--space-10);
  cursor: pointer;
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* ============================================================
   7. BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-full);
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

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

.badge-error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-accent {
  background: rgba(230, 57, 70, 0.15);
  color: var(--color-accent);
}

/* Stock badges */
.stock-in { composes: badge-success; }
.stock-low { composes: badge-warning; }
.stock-out { composes: badge-error; }

/* ============================================================
   8. CARD SYSTEM
   ============================================================ */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-border-light);
}

.card-body {
  padding: var(--space-5);
}

.card-flat {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

/* ============================================================
   9. SECTION HEADERS
   ============================================================ */
.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-header .section-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  margin-bottom: var(--space-3);
}

.section-header .section-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  margin-bottom: var(--space-4);
}

.section-header .section-desc {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

/* ============================================================
   10. RESPONSIVE UTILITIES & BREAKPOINTS
   ============================================================ */
.hidden { display: none !important; }
.mobile-only { display: none; }
.desktop-only { display: block; }

.container {
  width: 100%;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 28px;
  padding-right: 28px;
}

.grid {
  display: grid;
  gap: var(--space-6);
}

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

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

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

/* 1024px–1439px: Standard Desktop */
@media (min-width: 1024px) and (max-width: 1279px) {
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 768px–1023px: Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }
  .grid-4, .grid-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }
}

/* 481px–767px: Large Mobile */
@media (min-width: 481px) and (max-width: 767px) {
  :root {
    --text-5xl: 2.5rem;
    --text-4xl: 2rem;
    --text-3xl: 1.75rem;
    --text-2xl: 1.5rem;
    --nav-height: var(--nav-height-mobile);
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

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

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

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .mobile-only { display: block; }
  .desktop-only { display: none; }
}

/* 320px–480px: Small Mobile (1 product per row for maximum readability) */
@media (max-width: 480px) {
  :root {
    --text-5xl: 2.2rem;
    --text-4xl: 1.8rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.3rem;
    --nav-height: var(--nav-height-mobile);
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

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

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .mobile-only { display: block; }
  .desktop-only { display: none; }

  .heading-display {
    font-size: var(--text-3xl);
  }
}

/* ============================================================
   11. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ============================================================
   12. SELECTION
   ============================================================ */
::selection {
  background: var(--color-accent);
  color: var(--color-secondary);
}

/* ============================================================
   13. LOADING STATES
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg-card) 25%, var(--color-bg-card-hover) 50%, var(--color-bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Page loading overlay */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}

.page-loader.loaded {
  opacity: 0;
  pointer-events: none;
}
