/* ─── Custom Properties ──────────────────────────────────────────────────── */
:root {
  --bg:          #0f0f0f;
  --surface:     #1a1a1a;
  --card:        #242424;
  --card-hover:  #2a2a2a;
  --border:      #333333;
  --border-sub:  #222222;
  --accent:      #f97316;
  --accent-dim:  #ea580c;
  --accent-glow: rgba(249, 115, 22, 0.15);
  --text:        #f4f4f5;
  --text-muted:  #888888;
  --text-sub:    #555555;
  --success:     #22c55e;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 4px 24px rgba(0, 0, 0, 0.6);
  --transition:  0.18s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-sub);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: #000;
  font-weight: 900;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cart-btn {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), background var(--transition);
}

.cart-btn:hover {
  border-color: var(--accent);
  background: var(--card-hover);
}

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent);
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  transition: transform 0.15s;
}

.cart-count.bump { transform: scale(1.4); }

/* ─── Sale Banner ────────────────────────────────────────────────────────── */
.sale-banner {
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  color: #000;
  text-align: center;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ─── Main ───────────────────────────────────────────────────────────────── */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.hero {
  padding: 2.5rem 0 2rem;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.hero-title em { color: var(--accent); font-style: normal; }

.hero-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 480px;
}

/* ─── Controls ───────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.category-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover { border-color: var(--accent); color: var(--text); }

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

.sort-select {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  cursor: pointer;
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

/* ─── Product Grid ───────────────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 4rem 0;
  font-size: 0.9rem;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border-sub);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), transform var(--transition);
}

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

.product-image {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.product-body {
  padding: 1rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-category {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.product-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.product-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.product-stock {
  font-size: 0.75rem;
  color: var(--success);
  margin-bottom: 0.8rem;
}

.product-stock.low  { color: var(--warning); }
.product-stock.none { color: var(--danger); }

.product-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.option-tag {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border-sub);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.btn-primary:disabled {
  background: var(--border);
  border-color: var(--border);
  color: var(--text-sub);
  cursor: not-allowed;
}

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

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

.btn-block { width: 100%; }

.btn-add-cart {
  margin-top: auto;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.04em;
}

.btn-add-cart:hover:not(:disabled) {
  background: var(--accent);
  color: #000;
}

.btn-add-cart:disabled {
  border-color: var(--border);
  color: var(--text-sub);
  cursor: not-allowed;
}

/* ─── Cart Drawer ────────────────────────────────────────────────────────── */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
}

.cart-overlay.open { display: block; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-sub);
}

.cart-drawer-header h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.cart-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.cart-close:hover { color: var(--text); }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 3rem 0;
}

.cart-item {
  display: flex;
  gap: 0.9rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border-sub);
}

.cart-item-img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--card);
  overflow: hidden;
  flex-shrink: 0;
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.cart-item-price {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color var(--transition);
}

.cart-item-remove:hover { color: var(--danger); }

.cart-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-sub);
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.cart-subtotal span:first-child {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cart-subtotal-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(480px, 100%);
  box-shadow: var(--shadow);
}

.modal-wide { width: min(560px, 100%); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-sub);
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-sub);
}

/* ─── Customise Dialog ───────────────────────────────────────────────────── */
.option-group { margin-bottom: 1.25rem; }

.option-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  display: block;
}

.option-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.option-choice {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.option-choice:hover  { border-color: var(--accent); color: var(--text); }
.option-choice.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); font-weight: 700; }

.qty-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
}

.qty-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.qty-btn:hover { color: var(--accent); }

.qty-value {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

/* ─── Checkout Form ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.form-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
  resize: vertical;
}

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

.form-input::placeholder { color: var(--text-sub); }

.checkout-summary {
  background: var(--card);
  border: 1px solid var(--border-sub);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.1rem;
  font-size: 0.82rem;
}

.checkout-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  color: var(--text-muted);
}

.checkout-summary-total {
  display: flex;
  justify-content: space-between;
  padding-top: 0.6rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-sub);
  font-weight: 700;
  color: var(--text);
  font-size: 0.92rem;
}

.form-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--danger);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

/* ─── Order Confirmation ─────────────────────────────────────────────────── */
.confirm-icon {
  width: 60px;
  height: 60px;
  background: var(--success);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 auto 1.25rem;
}

#confirm-modal {
  text-align: center;
  padding: 2rem 1.5rem;
}

.confirm-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.confirm-order-id {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.confirm-order-id span {
  color: var(--accent);
  font-weight: 700;
}

.confirm-message {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border-sub);
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-sub);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-sep { color: var(--border); }

.env-badge {
  background: var(--card);
  border: 1px solid var(--border-sub);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: var(--text-sub);
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner  { padding: 0 1rem; }
  .main          { padding: 1.5rem 1rem 3rem; }
  .hero-title    { font-size: 1.6rem; }
  .controls      { flex-direction: column; align-items: flex-start; }
  .cart-drawer   { width: 100vw; }
}
