:root,
[data-theme="light"] {
  --bg: #fbfbfd;
  --bg-elevated: #ffffff;
  --bg-secondary: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #1d1d1f;
  --accent-hover: #424245;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --header-bg: rgba(251, 251, 253, 0.72);
  --overlay: rgba(0, 0, 0, 0.4);
  --discount: #bf4800;
  --icon-display: block;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1d1d1f;
  --bg-secondary: #161617;
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #f5f5f7;
  --accent-hover: #d2d2d7;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --header-bg: rgba(0, 0, 0, 0.72);
  --overlay: rgba(0, 0, 0, 0.7);
  --discount: #ff9f0a;
}

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.47059;
  letter-spacing: -0.022em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
input { font: inherit; }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.nav-center {
  display: flex;
  gap: 24px;
}

.nav-link {
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.03em;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.nav-link:hover { color: var(--text); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-form { position: relative; }

.search-input {
  width: 180px;
  padding: 6px 12px;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 0.8125rem;
  transition: width 0.3s, border-color 0.2s;
}

.search-input:focus {
  outline: none;
  width: 240px;
  border-color: var(--text-tertiary);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.btn-login {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 16px;
  border-radius: 980px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.btn-login:hover {
  opacity: 0.85;
}

/* Catalog dropdown */
.catalog-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.catalog-dropdown-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
}

.catalog-group-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.catalog-link {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 4px 0;
  transition: color 0.2s;
}

.catalog-link:hover { color: var(--text); }

.catalog-sublink {
  padding-left: 12px;
  font-size: 0.75rem;
}

/* Brands dropdown */
.brands-dropdown {
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.brands-dropdown[hidden] {
  display: none;
}

.brands-dropdown-toolbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 0;
  width: 100%;
}

.brands-filter {
  width: 100%;
  max-width: 320px;
  padding: 8px 14px;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 0.8125rem;
}

.brands-filter:focus {
  outline: none;
  border-color: var(--text-tertiary);
}

.brands-dropdown-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 24px;
  overflow-y: auto;
  flex: 1;
  columns: 4;
  column-gap: 32px;
}

.brands-letter-group {
  break-inside: avoid;
  margin-bottom: 20px;
}

.brands-letter {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.brand-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 4px 0;
  transition: color 0.2s;
}

.brand-link:hover {
  color: var(--text);
}

.brand-count {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.brands-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.nav-link.active {
  color: var(--text);
}

/* Hero */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 24px 48px;
  text-align: center;
}

.hero-eyebrow {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 16px;
  font-weight: 300;
}

.hero-stats {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  max-width: 560px;
  margin: 0 auto 48px;
  font-weight: 400;
}

.hero-stats strong {
  color: var(--text);
  font-weight: 600;
}

/* Carousel */
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: var(--bg-secondary);
}

.carousel-track {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.carousel-slide {
  min-width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
}

.carousel-item {
  background: var(--bg-elevated);
  aspect-ratio: 3/4;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.carousel-item:hover img { transform: scale(1.03); }

.carousel-item-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: #fff;
}

.carousel-item-brand {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 1;
}

.carousel-item-name {
  font-size: 0.8125rem;
  margin-top: 2px;
}

.carousel-item-price {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 4px;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.2s;
}

.carousel-dot.active {
  opacity: 1;
  transform: scale(1.2);
}

/* Products */
.products-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.section-header {
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.section-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.product-card {
  cursor: default;
  transition: transform 0.2s;
}

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

.product-image {
  aspect-ratio: 3/4;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
  margin-bottom: 12px;
  cursor: pointer;
  position: relative;
}

.product-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.product-badge {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 980px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.product-badge--new {
  background: var(--text);
  color: var(--bg);
}

.product-badge--pre-owned {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.modal-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-brand {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  cursor: pointer;
}

.product-name {
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  margin-top: 2px;
}

.product-size {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.product-prices {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.product-price {
  font-size: 0.9375rem;
  font-weight: 500;
}

.product-price-old {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.product-discount {
  font-size: 0.75rem;
  color: var(--discount);
  font-weight: 500;
}

.btn-buy {
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 980px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: opacity 0.2s;
}

.btn-buy:hover {
  opacity: 0.85;
}

.modal-details .btn-buy-modal {
  width: 100%;
  margin-top: auto;
}

.scroll-sentinel {
  height: 1px;
}

.scroll-status {
  text-align: center;
  padding: 24px 0 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.scroll-status[hidden] {
  display: none;
}

/* Pagination (legacy) */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}

.page-btn:hover,
.page-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Modal */
.modal {
  border: none;
  border-radius: 18px;
  padding: 0;
  max-width: 900px;
  width: 95vw;
  margin: auto;
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  font-size: 1.25rem;
  line-height: 1;
  z-index: 1;
}

.modal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 32px;
}

.modal-details {
  display: flex;
  flex-direction: column;
}

.modal-image {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.modal-image img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
}

.modal-brand {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 8px 0;
}

.modal-breadcrumbs {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.modal-size {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.modal-price-block {
  margin-bottom: 8px;
}

.modal-price-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.modal-prices {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.modal-price {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

/* Register */
.register-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.register-card {
  max-width: 440px;
  width: 100%;
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 40px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.register-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.register-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--text-tertiary);
}

.role-options {
  display: flex;
  gap: 16px;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  cursor: pointer;
}

.role-option input[type="radio"] {
  accent-color: var(--accent);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 980px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.9375rem;
  font-weight: 500;
  margin-top: 8px;
  transition: opacity 0.2s;
}

.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  width: 100%;
  padding: 12px;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  margin-top: 12px;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}

/* Auth modal */
.auth-modal {
  max-width: 440px;
}

.auth-modal-content {
  padding: 32px;
}

.auth-club-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.auth-purchase-hint {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.auth-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: 10px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}

.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-form .form-group:last-of-type {
  margin-bottom: 8px;
}

.auth-notice {
  padding: 20px;
  border-radius: 12px;
  background: var(--bg-secondary);
  text-align: center;
}

.auth-notice p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}

.register-notice {
  margin-top: 24px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bg-secondary);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Footer */
.footer {
  padding: 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}

/* Loading */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .nav-center { display: none; }
  .search-input { width: 120px; }
  .search-input:focus { width: 160px; }
  .carousel-slide { grid-template-columns: repeat(2, 1fr); }
  .modal-content { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
  .brands-dropdown-inner { columns: 2; }
}

@media (max-width: 480px) {
  .carousel-slide { grid-template-columns: 1fr 1fr; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
