/* ============================================================
   LUVIIO — Design System
   Dark luxury e-commerce aesthetic
   Fonts: Playfair Display (serif) + DM Sans (sans)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --bg:           #080808;
  --surface:      #111111;
  --surface-2:    #1a1a1a;
  --surface-3:    #222222;
  --border:       #2a2a2a;
  --border-light: #333333;

  --gold:         #c9a96e;
  --gold-light:   #e8c98a;
  --gold-dim:     #c9a96e44;

  --text:         #f0ece4;
  --text-muted:   #888888;
  --text-dim:     #555555;

  --error:        #e05252;
  --error-dim:    #e0525222;
  --success:      #5ec789;
  --success-dim:  #5ec78922;
  --warn:         #e0a952;

  --radius:       8px;
  --radius-lg:    14px;
  --transition:   0.2s ease;

  --nav-h:        68px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
  opacity: 0.4;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

.font-serif { font-family: 'Playfair Display', Georgia, serif; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ── Navigation ────────────────────────────────────────── */
#main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--gold);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
}

.nav-links a {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--transition);
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.nav-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius);
  transition: color var(--transition);
}

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

.cart-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.btn-ghost {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.user-name { font-size: 13px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-menu { position: relative; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.user-dropdown.open { display: flex; }

.user-dropdown a,
.user-dropdown .logout-btn {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: 6px;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  transition: all var(--transition);
}

.user-dropdown a:hover,
.user-dropdown .logout-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* Mobile Nav */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px;
  margin-left: auto;
}

.mobile-toggle span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all 0.3s;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  flex-direction: column;
  gap: 4px;
  z-index: 999;
}

.mobile-menu.open { display: flex; }

.mobile-menu a,
.mobile-menu .logout-btn {
  padding: 12px 0;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  border: none;
  background: none;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.mobile-menu a:last-child { border-bottom: none; }

/* ── Page wrapper ──────────────────────────────────────── */
.page-wrapper {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: #000;
}
.btn-primary:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--gold-dim);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-light);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-danger {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid var(--error);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Form elements ─────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus { border-color: var(--gold); }

.form-input.error,
.form-select.error { border-color: var(--error); }

.form-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── Product card ──────────────────────────────────────── */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: var(--border-light);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.product-card-img {
  aspect-ratio: 4/5;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}

.product-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .product-card-img img { transform: scale(1.05); }

.product-card-img .img-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: var(--border-light);
}

.product-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.product-card-price {
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
}

.product-card-compare {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: line-through;
}

.product-card-action {
  margin-top: auto;
  padding: 16px;
  padding-top: 0;
}

/* ── Grid ──────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

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

/* ── Section ───────────────────────────────────────────── */
.section { padding: 80px 0; }
.section-sm { padding: 40px 0; }

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── Loading skeleton ──────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

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

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 20px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 320px; margin: 0 auto 24px; }

/* ── Breadcrumb ────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 20px 0;
}

.breadcrumb a { color: var(--text-muted); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb span { color: var(--text-dim); }

/* ── Pagination ────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.page-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-muted);
  background: var(--surface);
  transition: all var(--transition);
}

.page-btn:hover, .page-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
  margin-top: 80px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
}

.footer-brand .logo {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--gold);
  margin-bottom: 12px;
}

.footer-brand p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 260px;
  line-height: 1.7;
}

.footer-col h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  transition: color var(--transition);
}

.footer-col a:hover { color: var(--gold); }

.footer-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Qty control ───────────────────────────────────────── */
.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.qty-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 300;
  transition: all var(--transition);
}

.qty-btn:hover { background: var(--surface-3); color: var(--text); }

.qty-display {
  min-width: 44px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ── Tab system ────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.tab-btn {
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}

.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 70% 50%, #1a1208 0%, var(--bg) 60%);
}

.hero-gold-line {
  position: absolute;
  top: 50%; right: 10%;
  width: 1px;
  height: 60vh;
  background: linear-gradient(to bottom, transparent, var(--gold-dim), transparent);
  transform: translateY(-50%);
}

/* ── Filter sidebar ────────────────────────────────────── */
.filter-sidebar {
  width: 240px;
  flex-shrink: 0;
}

.filter-group {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.filter-group:last-child {
  border-bottom: none;
}

.filter-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition);
}

.filter-option:hover { color: var(--text); }

.filter-option input[type="checkbox"] { accent-color: var(--gold); }

/* ── Checkout steps ────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 40px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--surface);
  flex-shrink: 0;
}

.step.active .step-num {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

.step.done .step-num {
  background: var(--success-dim);
  color: var(--success);
  border-color: var(--success);
}

.step-label { font-size: 13px; color: var(--text-muted); }
.step.active .step-label { color: var(--text); font-weight: 600; }

.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 8px; }

/* ── Address card ──────────────────────────────────────── */
.address-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.address-card:hover { border-color: var(--border-light); }
.address-card.selected { border-color: var(--gold); background: var(--gold-dim); }

.address-card .badge-default {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-dim);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Stripe elements ───────────────────────────────────── */
#stripe-card-element {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#stripe-card-element.StripeElement--focus { border-color: var(--gold); }
#stripe-card-element.StripeElement--invalid { border-color: var(--error); }

/* ── Order summary card ────────────────────────────────── */
.order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.order-row:last-child { border-bottom: none; }
.order-row.total { font-weight: 700; font-size: 16px; color: var(--gold); }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: flex; }

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

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }

  .filter-sidebar { width: 100%; }

  .section { padding: 48px 0; }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .container { padding: 0 16px; }
}
