/* ============================================================
   Payload — Default Storefront Theme  (mobile-first)
   Base styles target mobile. Breakpoints progressively
   enhance layout for larger screens.
   Breakpoints:
     sm  ≥ 480px  (large phones / small landscape)
     md  ≥ 768px  (tablets)
     lg  ≥ 1024px (small desktops)
     xl  ≥ 1280px (large desktops)
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --color-primary:       #2563eb;
  --color-primary-dark:  #1d4ed8;
  --color-accent:        #f59e0b;
  --color-danger:        #dc2626;
  --color-success:       #16a34a;

  --color-bg:            #f8fafc;
  --color-surface:       #ffffff;
  --color-border:        #e2e8f0;

  --color-text:          #0f172a;
  --color-text-muted:    #64748b;

  --font-sans:           'Inter', system-ui, sans-serif;
  --font-size-sm:        0.875rem;
  --font-size-base:      1rem;
  --font-size-lg:        1.125rem;
  --font-size-xl:        1.25rem;
  --font-size-2xl:       1.5rem;
  --font-size-4xl:       2.25rem;

  --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;

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;

  --shadow-sm: 0 1px 3px rgb(0 0 0/.1);
  --shadow-md: 0 4px 12px rgb(0 0 0/.08);

  --nav-height: 4rem;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── Layout ─────────────────────────────────────────────── */
.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 1280px) {
  .container { max-width: 1200px; }
}
.main-content { min-height: calc(100vh - var(--nav-height) - 4rem); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s, border-color .15s;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary  { background: var(--color-primary);  color: #fff; }
.btn-primary:hover  { background: var(--color-primary-dark); }
.btn-outline  { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover  { background: var(--color-border); }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--font-size-sm); }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--font-size-lg); }
@media (min-width: 480px) {
  .btn-lg { padding: var(--space-3) var(--space-8); }
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding-inline: var(--space-1);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}
.badge-primary { background: var(--color-primary); color: #fff; }
.badge-sale    { background: var(--color-danger);  color: #fff; }
.badge-new     { background: var(--color-success); color: #fff; }

/* ── Navbar ─────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.nav__brand {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
  flex: 1;
}
/* Nav links hidden on mobile; shown at sm+ */
.nav__links {
  display: none;
}
@media (min-width: 480px) {
  .nav__brand { flex: unset; }
  .nav__links {
    display: flex;
    gap: var(--space-4);
    flex: 1;
  }
  .nav__inner { gap: var(--space-6); }
}
.nav__links a {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color .15s;
}
.nav__links a:hover { color: var(--color-text); }
.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.nav__cart {
  position: relative;
  display: flex;
  align-items: center;
  font-size: 1.3rem;
  padding: var(--space-1);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.nav__cart .badge {
  position: absolute;
  top: -4px;
  right: -6px;
}
.nav__user {
  display: none;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 480px) {
  .nav__user { display: block; }
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  padding-block: var(--space-8);
}
.hero__inner { text-align: center; }
.hero__heading {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--space-4);
}
.hero__subheading {
  font-size: var(--font-size-base);
  opacity: .85;
  margin-bottom: var(--space-6);
  max-width: 40ch;
  margin-inline: auto;
}
.hero .btn-primary {
  background: #fff;
  color: var(--color-primary);
}
.hero .btn-primary:hover { background: #f0f4ff; }
@media (min-width: 768px) {
  .hero {
    padding-block: var(--space-16);
  }
  .hero__heading { font-size: var(--font-size-4xl); }
  .hero__subheading { font-size: var(--font-size-lg); margin-bottom: var(--space-8); }
}

/* ── Product sections ───────────────────────────────────── */
.product-section { padding-block: var(--space-8); }
.product-section + .product-section { padding-top: 0; }
.section-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
}
@media (min-width: 768px) {
  .product-section { padding-block: var(--space-12); }
  .section-title { font-size: var(--font-size-2xl); margin-bottom: var(--space-6); }
}

/* ── Product grid ───────────────────────────────────────── */
/* Mobile: 2 columns */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
@media (min-width: 640px) {
  .product-grid { gap: var(--space-4); }
}
@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ── Product card ───────────────────────────────────────── */
.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  display: flex;
  flex-direction: column;
}
@media (hover: hover) {
  .product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
}
.product-card__badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--color-danger);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .05em;
}
@media (min-width: 480px) {
  .product-card__badge { top: var(--space-3); left: var(--space-3); font-size: 0.7rem; }
}
.product-card__img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--color-border);
}
.product-card__img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--color-border);
}
.product-card__body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}
@media (min-width: 480px) {
  .product-card__body { padding: var(--space-4); }
}
.product-card__name {
  font-size: var(--font-size-sm);
  font-weight: 600;
}
@media (min-width: 480px) {
  .product-card__name { font-size: var(--font-size-base); }
}
.product-card__price {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-primary);
}
@media (min-width: 480px) {
  .product-card__price { font-size: var(--font-size-lg); }
}
.product-card__pricing {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.product-card__price--sale { color: var(--color-danger); }
.product-card__price-original {
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-muted);
  text-decoration: line-through;
}
.product-card__discount {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--color-danger);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.product-card__cta { margin-top: auto; width: 100%; }
.product-card__img-link  { display: block; }
.product-card__name-link { color: inherit; }
@media (hover: hover) {
  .product-card__name-link:hover .product-card__name { color: var(--color-primary); }
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-8);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}
.footer__inner { display: flex; justify-content: center; }

/* ── Product detail page ────────────────────────────────── */
.product-detail {
  padding-block: var(--space-8);
}
/* Mobile: single column */
.product-detail__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: start;
}
@media (min-width: 768px) {
  .product-detail {
    padding-block: var(--space-12);
  }
  .product-detail__layout {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
  }
}
.product-detail__gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.product-detail__main-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--color-border);
  border: 1px solid var(--color-border);
}
.product-detail__img-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  background: var(--color-border);
  border: 1px solid var(--color-border);
}
.product-detail__thumbnails {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.product-detail__thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  cursor: pointer;
  transition: border-color .15s;
}
@media (min-width: 480px) {
  .product-detail__thumb { width: 72px; height: 72px; }
}
.product-detail__thumb:hover,
.product-detail__thumb.active { border-color: var(--color-primary); }
.product-detail__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.product-detail__badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 700;
  background: var(--color-danger);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .05em;
  align-self: flex-start;
}
.product-detail__name {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  line-height: 1.2;
}
@media (min-width: 768px) {
  .product-detail__name { font-size: var(--font-size-4xl); }
}
.product-detail__pricing {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.product-detail__price {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-primary);
}
@media (min-width: 480px) {
  .product-detail__price { font-size: var(--font-size-2xl); }
}
.product-detail__compare {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  text-decoration: line-through;
}
.product-detail__discount {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: #fff;
  background: var(--color-danger);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  align-self: center;
}
.product-detail__description {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  line-height: 1.7;
}
.product-detail__details-list {
  list-style: disc;
  padding-left: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.product-detail__stock {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.product-detail__stock--low { color: var(--color-danger); font-weight: 600; }
.product-detail__stock--out { color: var(--color-danger); font-weight: 700; }
/* Mobile: stack action buttons full-width */
.product-detail__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.product-detail__actions .btn { width: 100%; justify-content: center; }
@media (min-width: 480px) {
  .product-detail__actions { flex-direction: row; flex-wrap: wrap; }
  .product-detail__actions .btn { flex: 1; min-width: 10rem; width: auto; }
}

/* ── Login / Auth page — mobile: single column, desktop: split ── */
.auth-body { margin: 0; padding: 0; }

/* Mobile: form only, full-height */
.auth-split {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}
@media (min-width: 768px) {
  .auth-body { overflow: hidden; height: 100vh; }
  .auth-split { grid-template-columns: 1fr 2fr; }
}

/* Left panel — hidden on mobile */
.auth-art-panel {
  display: none;
}
@media (min-width: 768px) {
  .auth-art-panel {
    position: relative;
    overflow: hidden;
    background: #0d1117;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem 2rem;
  }
}

.auth-art-panel__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  pointer-events: none;
}
.auth-art-panel__orb--1 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  top: -110px; right: -90px;
  opacity: 0.45;
}
.auth-art-panel__orb--2 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, #818cf8, transparent 70%);
  bottom: 12%; left: -80px;
  opacity: 0.35;
}
.auth-art-panel__orb--3 {
  width: 220px; height: 220px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  top: 48%; right: 4%;
  opacity: 0.22;
}

.auth-art-panel__grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 0.065) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.auth-art-panel__brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.auth-art-panel__mark {
  width: 2.25rem; height: 2.25rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgb(99 102 241 / 0.4), 0 4px 10px rgb(59 130 246 / 0.4);
}
.auth-art-panel__name {
  color: #f1f5f9;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.auth-art-panel__body { position: relative; z-index: 1; }

.auth-art-panel__headline {
  color: #f8fafc;
  font-size: clamp(1.625rem, 2.8vw, 2.125rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin-bottom: 0.875rem;
}
.auth-art-panel__sub {
  color: #94a3b8;
  font-size: 0.9375rem;
  line-height: 1.65;
  margin-bottom: 1.75rem;
}
.auth-art-panel__features {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.auth-art-panel__features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #94a3b8;
  font-size: 0.875rem;
}
.auth-art-panel__features svg { color: #60a5fa; flex-shrink: 0; }

.auth-art-panel__footer {
  position: relative; z-index: 1;
  color: #334155;
  font-size: 0.8125rem;
}

/* Right panel */
.auth-form-panel {
  background: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3.5rem 1.5rem 2rem;
  overflow-y: auto;
}
@media (min-width: 768px) {
  .auth-form-panel {
    align-items: center;
    padding: 3rem 2rem;
  }
}
.auth-form-wrap {
  width: 100%;
  max-width: 22rem;
  animation: auth-rise 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes auth-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-form-head { margin-bottom: 2.25rem; }
.auth-form-head__title {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: #0f172a;
  margin-bottom: 0.375rem;
  line-height: 1.15;
}
@media (min-width: 480px) {
  .auth-form-head__title { font-size: 1.875rem; }
}
.auth-form-head__sub { color: #64748b; font-size: 0.9375rem; }

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.auth-field { display: flex; flex-direction: column; gap: 0.375rem; }
.auth-label { font-size: 0.8125rem; font-weight: 600; color: #0f172a; letter-spacing: 0.01em; }

.auth-input {
  padding: 0.6875rem 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  -webkit-appearance: none;
}
.auth-input::placeholder { color: #94a3b8; }
.auth-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3.5px rgb(37 99 235 / 0.11);
}
.auth-input--code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
  padding-block: 0.875rem;
  background: #f8fafc;
  font-variant-numeric: tabular-nums;
  border-style: dashed;
}
@media (min-width: 480px) {
  .auth-input--code { font-size: 1.875rem; }
}
.auth-input--code:focus { border-style: solid; }

.auth-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-top: 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(160deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgb(37 99 235 / 0.28), inset 0 1px 0 rgb(255 255 255 / 0.1);
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .auth-btn:hover:not(:disabled) {
    opacity: 0.91;
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgb(37 99 235 / 0.38), inset 0 1px 0 rgb(255 255 255 / 0.1);
  }
}
.auth-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgb(37 99 235 / 0.2);
}
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: #475569;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.auth-hint strong { color: #0f172a; font-weight: 600; }

.auth-error {
  font-size: 0.875rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  line-height: 1.5;
}

.btn-link {
  background: none;
  border: none;
  border-bottom: 1px solid currentColor;
  color: #2563eb;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  font-weight: 500;
  padding: 0;
  margin-left: auto;
  transition: opacity 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-link:hover { opacity: 0.7; }
