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

:root {
  --black: #1a1a1a;
  --white: #ffffff;
  --grey-light: #f5f5f5;
  --grey-mid: #e0e0e0;
  --grey-text: #666;
  --accent: #1a1a1a;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.10);
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  color: var(--black);
  background: var(--grey-light);
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; display: flex; flex-direction: column; }

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

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ── Sync banner ──────────────────────────────────── */
.sync-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}
.sync-banner.online  { background: #d1fae5; color: #065f46; }
.sync-banner.offline { background: #fef3c7; color: #92400e; }

/* ── Top bar ──────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-mid);
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-bar span { font-weight: 700; font-size: 16px; }
.top-bar button { font-size: 15px; color: var(--black); padding: 4px 8px; }

/* ── Cart badge button ────────────────────────────── */
.cart-btn { position: relative; font-size: 20px; padding: 4px 8px; }
.badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Login ────────────────────────────────────────── */
.login-page {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.login-card .logo {
  display: block;
  height: 48px;
  margin: 0 auto 12px;
  object-fit: contain;
}
.login-card h1 {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 28px;
  letter-spacing: -0.3px;
}
.login-card .field { margin-bottom: 14px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
.login-card input:focus { border-color: var(--black); }
.login-card .error { color: var(--danger); font-size: 13px; margin-bottom: 10px; }
.login-card button[type=submit] {
  width: 100%;
  padding: 13px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  margin-top: 4px;
}
.login-card button:disabled { opacity: 0.5; }

/* ── Home / category grid ─────────────────────────── */
.home-page { display: flex; flex-direction: column; height: 100%; }
.home-page .top-bar-right { display: flex; align-items: center; gap: 8px; }
.logout-btn { font-size: 13px; color: var(--grey-text); }

.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--grey-mid);
  background: var(--white);
  flex-shrink: 0;
}
.tab-bar button {
  flex: 1;
  padding: 11px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--grey-text);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.tab-bar button.active {
  color: var(--black);
  border-bottom-color: var(--black);
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.category-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
  background: var(--black);
}
.category-card:active { transform: scale(0.97); }
.category-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  object-position: center center;
  display: block;
}
.cat-no-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: #2a2a2a;
}
.accessories-bg {
  background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.accessories-bg::before {
  content: '🛏';
  font-size: 36px;
  opacity: 0.6;
}
.category-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
}

/* ── Gallery ──────────────────────────────────────── */
.gallery-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--black);
}
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.8);
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 200;
}
.gallery-header button, .gallery-header span {
  color: var(--white);
  font-size: 15px;
}
.gallery-header span { font-weight: 700; }

.outer-swiper { flex: 1; height: 100%; }
.inner-swiper { height: 100%; }

/* Hero slide */
.hero-slide {
  position: relative;
  overflow: hidden;
  background: #111;
}
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 80px 20px 60px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  color: var(--white);
}
.hero-overlay h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.hero-overlay p { font-size: 14px; opacity: 0.85; }
.swipe-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Specs slide */
.specs-slide, .sizes-slide {
  background: var(--white);
  overflow-y: auto;
  padding: 72px 20px 24px;
}
.back-top-btn {
  position: fixed;
  bottom: 90px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: var(--black);
  color: var(--white);
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  box-shadow: var(--shadow);
}
.specs-content h2, .sizes-content h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 12px;
}
.description { color: var(--grey-text); line-height: 1.6; margin-top: 16px; font-size: 13px; }
.badge-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.spec-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0f9f4;
  border: 1px solid #c3e6d4;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #1a5c38;
}
.spec-badge::before { content: '✓'; font-weight: 800; color: var(--success); }
.features { list-style: none; padding: 0; margin-bottom: 8px; }
.features li {
  padding: 9px 0 9px 22px;
  position: relative;
  border-bottom: 1px solid var(--grey-mid);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.features li::before {
  content: '·';
  position: absolute;
  left: 6px;
  color: var(--black);
  font-size: 20px;
  line-height: 1.1;
}

/* Sizes slide */
.size-cards { display: flex; flex-direction: column; gap: 12px; }
.size-card {
  border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.size-info { margin-bottom: 10px; }
.size-label { font-weight: 700; font-size: 16px; display: block; }
.size-dims { font-size: 13px; color: var(--grey-text); }
.size-price-row { display: flex; align-items: center; justify-content: space-between; }
.price { font-size: 18px; font-weight: 800; }
.add-btn {
  background: var(--black);
  color: var(--white);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
}
.add-btn:active { opacity: 0.7; }

/* Accessories prompt backdrop — absorbs Swiper touch events */
.acc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 299;
  background: rgba(0,0,0,0.45);
}

/* Accessories prompt */
.accessories-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 36px;
  z-index: 300;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.accessories-sheet h3 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.accessories-sheet p  { font-size: 13px; color: var(--grey-text); margin-bottom: 16px; }
.acc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.acc-card {
  border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.1s;
}
.acc-card:active { background: var(--grey-light); }
.acc-card .acc-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.acc-dismiss {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--grey-text);
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 500;
  pointer-events: none;
}

/* Swiper pagination overrides */
.horizontal-pagination { bottom: 12px !important; }
.horizontal-pagination .swiper-pagination-bullet { background: rgba(255,255,255,0.6); }
.horizontal-pagination .swiper-pagination-bullet-active { background: #fff; }
.vertical-pagination {
  right: 8px !important;
  left: auto !important;
  width: auto !important;
}
.vertical-pagination .swiper-pagination-bullet { background: rgba(0,0,0,0.3); }
.vertical-pagination .swiper-pagination-bullet-active { background: var(--black); }

/* ── Cart ─────────────────────────────────────────── */
.cart-page { display: flex; flex-direction: column; height: 100%; background: var(--white); }
.empty-cart {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--grey-text);
}
.empty-cart button {
  background: var(--black);
  color: var(--white);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.cart-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--grey-mid);
}
.item-info { flex: 1; }
.item-name { display: block; font-weight: 700; font-size: 14px; }
.item-size { font-size: 12px; color: var(--grey-text); }
.item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--grey-mid);
  border-radius: 20px;
  padding: 4px 12px;
}
.item-controls button { font-size: 18px; font-weight: 700; width: 24px; text-align: center; }
.item-price { font-weight: 700; min-width: 72px; text-align: right; font-size: 14px; }

.cart-summary {
  padding: 16px;
  border-top: 1.5px solid var(--grey-mid);
  background: var(--white);
}
.subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 16px;
}
.cart-actions { display: flex; gap: 10px; }
.secondary-btn {
  flex: 1;
  padding: 12px;
  border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
}
.primary-btn {
  flex: 2;
  padding: 12px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
}

/* ── Checkout ─────────────────────────────────────── */
.checkout-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--white);
}
.checkout-form {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 40px;
}
.field-group { margin-bottom: 18px; }
.field-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--grey-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.field-group input, .field-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
}
.field-group input:focus, .field-group textarea:focus { border-color: var(--black); }

.payment-toggle { display: flex; gap: 10px; }
.payment-toggle button {
  flex: 1;
  padding: 11px;
  border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  transition: all 0.15s;
}
.payment-toggle button.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.order-summary {
  background: var(--grey-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 20px 0;
}
.summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  color: var(--grey-text);
}
.total-line {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--grey-mid);
  font-size: 16px;
}
.place-order-btn {
  width: 100%;
  padding: 15px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 800;
}
.place-order-btn:disabled { opacity: 0.5; }

/* ── Receipt ──────────────────────────────────────── */
.receipt-page {
  height: 100%;
  overflow-y: auto;
  background: var(--white);
  padding: 32px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.receipt-header { text-align: center; margin-bottom: 24px; }
.receipt-header h1 { font-size: 28px; font-weight: 900; letter-spacing: -1px; }
.receipt-title { color: var(--grey-text); font-size: 13px; margin-top: 4px; }
.order-id { font-size: 12px; color: var(--grey-text); margin-top: 2px; }

.receipt-items { width: 100%; margin-bottom: 12px; }
.receipt-line {
  padding: 8px 0;
  border-bottom: 1px dashed var(--grey-mid);
}
.receipt-item-name { font-size: 14px; font-weight: 600; }
.receipt-item-price { font-size: 13px; color: var(--grey-text); }

.receipt-divider { width: 100%; border-top: 1.5px solid var(--black); margin: 12px 0 8px; }
.receipt-total {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}
.payment-type { font-size: 12px; color: var(--grey-text); margin-bottom: 24px; text-transform: uppercase; letter-spacing: 0.5px; }

.qr-section { text-align: center; margin-bottom: 20px; }
.qr-label { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.qr-placeholder {
  display: inline-block;
  border: 2px solid var(--black);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}
.payment-logos { display: flex; gap: 16px; justify-content: center; font-size: 12px; font-weight: 700; color: var(--grey-text); }

.customer-info { text-align: center; font-size: 13px; color: var(--grey-text); margin-bottom: 8px; line-height: 1.7; }
.sync-status { font-size: 12px; font-weight: 700; margin-bottom: 24px; }
.sync-status.synced { color: var(--success); }
.sync-status.pending { color: var(--warn); }

.new-order-btn {
  width: 100%;
  max-width: 320px;
  padding: 15px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 800;
}
