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

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --muted: #666;
  --gold: #c9a84c;
  --gold-hover: #b8962e;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ── */
.header {
  background: #0a0a0a;
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand { font-size: 16px; font-weight: 600; letter-spacing: 0.3px; }
.header-brand span { color: var(--gold); }
.header-nav { display: flex; gap: 12px; align-items: center; }
.header-nav a, .header-nav button {
  background: none; border: none; color: rgba(255,255,255,0.75);
  cursor: pointer; font-size: 14px; padding: 6px 10px; border-radius: 4px;
  text-decoration: none; transition: color 0.15s, background 0.15s;
}
.header-nav a:hover, .header-nav button:hover { color: white; background: rgba(255,255,255,0.1); }

/* ── Steps indicator ── */
.steps {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 24px;
  gap: 0;
}
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: default; user-select: none;
}
.step.active { color: var(--text); border-bottom-color: var(--gold); font-weight: 600; }
.step.done { color: var(--success); }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--border); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.step.active .step-num { background: var(--gold); color: white; }
.step.done .step-num { background: var(--success); color: white; }

/* ── Layout ── */
.main { display: flex; min-height: calc(100vh - 56px); }

/* ── Auth ── */
.auth-wrap {
  max-width: 420px; margin: 60px auto; padding: 0 16px;
}
.auth-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 14px; text-align: center; cursor: pointer;
  font-weight: 500; color: var(--muted); background: none; border: none;
  border-bottom: 2px solid transparent; font-size: 15px; transition: all 0.15s;
}
.auth-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.auth-body { padding: 28px 24px; }
.auth-tagline { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--muted); }
input[type=text], input[type=email], input[type=password] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 15px; background: var(--bg);
  transition: border-color 0.15s;
}
input:focus { outline: none; border-color: var(--gold); background: white; }
.form-error { color: var(--error); font-size: 13px; margin-top: 4px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 18px; border-radius: 6px; font-size: 14px;
  font-weight: 600; cursor: pointer; border: none; transition: all 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--gold); color: white; }
.btn-primary:hover { background: var(--gold-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-dark { background: #0a0a0a; color: white; }
.btn-dark:hover { background: #1a1a1a; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 16px; }

/* ── Upload area ── */
.upload-panel {
  width: 280px; min-width: 280px; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow-y: auto; max-height: calc(100vh - 56px - 57px);
}
.upload-panel-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.dropzone {
  margin: 16px; border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 24px 16px; text-align: center; cursor: pointer;
  transition: all 0.15s; color: var(--muted);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--gold); background: #fdf9f0; color: var(--text);
}
.dropzone svg { display: block; margin: 0 auto 10px; opacity: 0.4; }
.dropzone p { font-size: 13px; line-height: 1.4; }
.dropzone strong { display: block; font-size: 14px; margin-bottom: 4px; color: var(--text); }

.photo-list { flex: 1; overflow-y: auto; padding: 0 12px 12px; }
.photo-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-radius: 6px; cursor: pointer; transition: background 0.1s; margin-bottom: 4px;
  border: 1.5px solid transparent;
}
.photo-item:hover { background: var(--bg); }
.photo-item.active { background: #fdf9f0; border-color: var(--gold); }
.photo-thumb {
  width: 48px; height: 48px; object-fit: cover; border-radius: 4px;
  flex-shrink: 0; background: var(--border);
}
.photo-info { flex: 1; min-width: 0; }
.photo-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-dim { font-size: 11px; color: var(--muted); }
.photo-badge {
  background: var(--gold); color: white; border-radius: 10px;
  font-size: 11px; font-weight: 700; padding: 2px 7px; flex-shrink: 0;
}
.photo-remove {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px; border-radius: 4px; flex-shrink: 0; line-height: 1;
}
.photo-remove:hover { color: var(--error); }

/* ── Configure panel ── */
.configure-panel {
  flex: 1; padding: 24px; overflow-y: auto;
  max-height: calc(100vh - 56px - 57px);
}
.configure-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); text-align: center; gap: 12px;
}
.configure-empty svg { opacity: 0.25; }
.configure-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .configure-layout { grid-template-columns: 1fr; } }

/* ── Preview canvas ── */
.preview-wrap { position: relative; }
.preview-canvas-container {
  width: 100%; aspect-ratio: 4/3; background: #111; border-radius: var(--radius);
  overflow: hidden; position: relative; cursor: grab;
}
.preview-canvas-container:active { cursor: grabbing; }
canvas#preview { width: 100%; height: 100%; display: block; }
.preview-hint {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6); color: rgba(255,255,255,0.8);
  font-size: 11px; padding: 3px 8px; border-radius: 10px; pointer-events: none;
  white-space: nowrap;
}
.preview-hint.hidden { display: none; }

/* ── DPI indicator ── */
.dpi-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 6px; font-size: 13px; font-weight: 500; margin-top: 10px;
}
.dpi-bar.ok { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.dpi-bar.warn { background: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }
.dpi-bar.bad { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }
.dpi-icon { font-size: 16px; }

/* ── Option grids ── */
.options-section { margin-bottom: 20px; }
.options-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
.size-btn {
  padding: 8px 6px; border: 1.5px solid var(--border); border-radius: 6px;
  background: var(--surface); cursor: pointer; text-align: center;
  transition: all 0.15s; font-size: 12px; line-height: 1.3; font-weight: 500;
}
.size-btn:hover { border-color: var(--gold); }
.size-btn.selected { border-color: var(--gold); background: #fdf9f0; color: var(--gold-hover); }
/* size-code now shows full imperial string, not just first dimension */
.size-btn .size-code { font-weight: 600; font-size: 12px; display: block; }
.size-btn .size-label { font-size: 10px; color: var(--muted); display: block; }

/* ── Orientation toggle ── */
.orient-toggle { display: flex; gap: 6px; }
.orient-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 500;
  transition: all 0.15s; color: var(--muted);
}
.orient-btn:hover { border-color: var(--gold); color: var(--text); }
.orient-btn.selected { border-color: var(--gold); background: #fdf9f0; color: var(--gold-hover); }
.orient-icon { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.portrait-icon  { width: 9px;  height: 13px; }
.landscape-icon { width: 13px; height: 9px; }

/* ── Zoom slider ── */
.zoom-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.zoom-label-text { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 36px; }
.zoom-value { font-size: 12px; font-weight: 600; color: var(--text); min-width: 38px; text-align: right; }
.zoom-slider { flex: 1; height: 4px; accent-color: var(--gold); cursor: pointer; }

/* ── Paper grid — category level ── */
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.paper-btn {
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  background: var(--surface); cursor: pointer; text-align: left;
  transition: all 0.15s; font-size: 13px; font-weight: 500;
  position: relative;
}
.paper-btn:hover { border-color: var(--gold); }
.paper-btn.selected { border-color: var(--gold); background: #fdf9f0; color: var(--gold-hover); }
.paper-arrow { font-size: 10px; }
.paper-desc { font-size: 10px; color: var(--muted); display: block; margin-top: 2px; font-weight: 400; line-height: 1.3; }
.paper-btn.selected .paper-desc { color: var(--gold-hover); }

/* ── Paper subcategory row ── */
.paper-sub-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px; padding: 10px 12px;
  background: #fdf9f0; border-radius: 6px; border: 1px solid #f0e8cc;
}
.paper-sub-btn {
  padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 6px;
  background: var(--surface); cursor: pointer; text-align: left;
  transition: all 0.15s; font-size: 12px; font-weight: 500; line-height: 1.3;
}
.paper-sub-btn:hover { border-color: var(--gold); }
.paper-sub-btn.selected { border-color: var(--gold); background: white; color: var(--gold-hover); }
.paper-sub-btn .paper-desc { font-size: 10px; color: var(--muted); display: block; margin-top: 1px; font-weight: 400; }

/* ── Cart items for current photo (shown in configure panel) ── */
.cart-photo-list {
  margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px;
}
.cart-photo-header {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.cart-photo-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.cart-photo-item:last-child { border-bottom: none; }
.cart-photo-desc { flex: 1; min-width: 0; }
.cart-photo-desc strong { display: block; }
.cart-photo-desc span { color: var(--muted); font-size: 12px; }
.cart-photo-qty { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.cart-photo-qty .qty-btn { width: 28px; height: 28px; font-size: 15px; background: var(--bg); border: none; cursor: pointer; }
.cart-photo-qty .qty-val { width: 32px; text-align: center; font-weight: 600; font-size: 13px; }
.cart-photo-price { font-weight: 600; font-size: 14px; min-width: 52px; text-align: right; }

/* ── Qty stepper ── */
.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-stepper { display: flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.qty-btn {
  width: 36px; height: 36px; border: none; background: var(--bg); cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: background 0.1s;
}
.qty-btn:hover { background: var(--border); }
.qty-val { width: 44px; text-align: center; font-weight: 600; font-size: 15px; }
.line-price { font-size: 20px; font-weight: 700; color: var(--text); }
.per-price { font-size: 12px; color: var(--muted); }

.add-btn { margin-top: 20px; }

/* ── Cart strip ── */
.cart-strip {
  position: sticky; bottom: 0; background: #0a0a0a; color: white;
  padding: 12px 24px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid #222;
}
.cart-strip-info { font-size: 14px; }
.cart-strip-info strong { color: var(--gold); }

/* ── Cart view ── */
.cart-wrap { max-width: 700px; margin: 32px auto; padding: 0 20px; width: 100%; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.cart-item {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 16px; display: flex; gap: 16px; margin-bottom: 12px; align-items: flex-start;
}
.cart-thumb {
  width: 80px; height: 60px; object-fit: cover; border-radius: 4px; flex-shrink: 0;
}
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.cart-item-meta { font-size: 13px; color: var(--muted); }
.cart-item-price { font-size: 16px; font-weight: 700; text-align: right; flex-shrink: 0; }
.cart-item-sub { font-size: 12px; color: var(--muted); text-align: right; }
.cart-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 0 4px; }
.cart-remove:hover { color: var(--error); }

.cart-total-row {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 16px 20px; display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; font-size: 18px; font-weight: 700;
}
.cart-total-row .muted { font-size: 12px; font-weight: 400; color: var(--muted); }
.cart-actions { display: flex; gap: 12px; margin-top: 20px; justify-content: flex-end; }

/* ── Checkout ── */
.checkout-wrap { max-width: 520px; margin: 32px auto; padding: 0 20px; width: 100%; }
.checkout-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 28px 24px;
}
.checkout-summary { margin-bottom: 24px; }
.checkout-line { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; }
.checkout-line.total { font-weight: 700; font-size: 16px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }
#stripe-element {
  border: 1px solid var(--border); border-radius: 6px; padding: 12px;
  background: var(--bg); margin-bottom: 16px;
}
#stripe-element.StripeElement--focus { border-color: var(--gold); }

/* ── Confirmation ── */
.confirm-wrap { max-width: 520px; margin: 48px auto; padding: 0 20px; text-align: center; }
.confirm-icon { font-size: 56px; margin-bottom: 16px; }
.confirm-title { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.confirm-sub { color: var(--muted); margin-bottom: 28px; font-size: 15px; }
.confirm-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px; text-align: left; margin-bottom: 24px;
}
.confirm-row { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; }

/* ── Orders list ── */
.orders-wrap { max-width: 700px; margin: 32px auto; padding: 0 20px; }
.order-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 16px 20px; margin-bottom: 12px; display: flex;
  align-items: center; justify-content: space-between; gap: 12px;
}
.order-id { font-weight: 700; font-size: 15px; }
.order-meta { font-size: 13px; color: var(--muted); }
.badge {
  padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600;
}
.badge-paid { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.badge-pending { background: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }
.badge-error { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }

/* ── Utilities ── */
.loading { display: flex; align-items: center; justify-content: center; height: 200px; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-msg { background: #fef2f2; border: 1px solid #fecaca; color: var(--error); padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state svg { margin: 0 auto 12px; display: block; opacity: 0.3; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }
