/* ═══════════════════════════════════════════════════════════════════════════
   PrintCraft — app.css  v1.0.0
   Design language: Industrial precision. Dark workshop aesthetic.
   Fonts: Bebas Neue (display) + DM Sans (UI) + DM Mono (numbers)
═══════════════════════════════════════════════════════════════════════════ */

/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg-base:       #1a1a1c;
  --bg-nav:        #111113;
  --bg-panel:      #222226;
  --bg-panel2:     #2a2a2f;
  --bg-input:      #1e1e22;
  --bg-hover:      #2e2e35;
  --bg-active:     #35353e;

  --border:        #333338;
  --border-light:  #404048;

  --text-primary:  #e8e8ec;
  --text-secondary:#9898a8;
  --text-muted:    #5a5a68;

  --accent:        #ff5c35;
  --accent-hover:  #ff7050;
  --accent-dim:    rgba(255,92,53,0.15);

  --success:       #34c759;
  --warning:       #ffd60a;
  --danger:        #ff3b30;

  --nav-h:         52px;
  --toolbar-w:     48px;
  --props-w:       260px;
  --status-h:      28px;

  --radius-sm:     4px;
  --radius:        6px;
  --radius-lg:     10px;

  --font-display:  'Bebas Neue', sans-serif;
  --font-ui:       'DM Sans', sans-serif;
  --font-mono:     'DM Mono', monospace;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow:        0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.7);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Navigation Bar ─────────────────────────────────────────────────────── */
#pc-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  z-index: 1000;
  user-select: none;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
  border-right: 1px solid var(--border);
  min-width: 160px;
}
.brand-logo {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--text-primary);
}
.brand-version {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Product Picker */
.nav-product-picker {
  position: relative;
  flex: 0 0 auto;
}

.product-picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
  min-width: 220px;
}
.product-picker-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.product-picker-btn.is-open { background: var(--bg-active); border-color: var(--accent); }

.picker-icon { font-size: 16px; }
.picker-label { flex: 1; text-align: left; }
.picker-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.picker-chevron {
  width: 14px; height: 14px;
  stroke: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.product-picker-btn.is-open .picker-chevron { transform: rotate(180deg); }

.product-picker-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 480px;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  display: none;
  overflow: hidden;
}
.product-picker-panel.is-open { display: block; }

.picker-panel-inner {
  max-height: 480px;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.picker-panel-inner::-webkit-scrollbar { width: 4px; }
.picker-panel-inner::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.picker-category { grid-column: span 1; }
.picker-cat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.picker-cat-icon { font-size: 14px; }

.picker-products { display: flex; flex-direction: column; gap: 2px; }
.picker-product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.1s;
}
.picker-product:hover { background: var(--bg-hover); }
.picker-product.is-selected { background: var(--accent-dim); }

.pp-name { font-size: 12px; font-weight: 500; }
.pp-dims {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Pricing Section */
.nav-pricing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: relative;
}

.pricing-qty {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.qty-btn {
  width: 28px; height: 32px;
  font-size: 18px;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.qty-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
#qtyInput {
  width: 48px; height: 32px;
  text-align: center;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  -moz-appearance: textfield;
}
#qtyInput::-webkit-inner-spin-button { display: none; }

.pricing-display { display: flex; flex-direction: column; gap: 1px; }
.price-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.price-total {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.pricing-tiers-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 200px;
  box-shadow: var(--shadow);
  z-index: 2000;
  display: none;
  font-size: 12px;
}
.nav-pricing:hover .pricing-tiers-popup { display: block; }
.tier-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 3px 0;
  color: var(--text-secondary);
}
.tier-row.tier-active { color: var(--accent); font-weight: 600; }
.tier-qty { font-family: var(--font-mono); }
.tier-price { font-family: var(--font-mono); }

/* Nav Actions */
.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-btn svg { width: 14px; height: 14px; }
.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }

.nav-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.nav-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.nav-btn-primary:disabled { background: var(--bg-panel); border-color: var(--border); color: var(--text-muted); cursor: not-allowed; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  font-size: 12px;
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-wide { width: 820px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.5px;
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--danger); color: #fff; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

/* Templates grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.template-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  background: var(--bg-input);
}
.template-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.template-card-thumb {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 32px;
}
.template-card-name {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-panel2);
}
.template-card.blank .template-card-thumb {
  border: 2px dashed var(--border-light);
  font-size: 40px;
  color: var(--text-muted);
  margin: 8px;
  width: calc(100% - 16px);
  border-radius: var(--radius-sm);
}
.templates-empty { color: var(--text-muted); text-align: center; padding: 40px; }

/* Order modal */
.order-options { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-secondary); }
.form-control {
  height: 36px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--accent); }

.order-price-summary {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.order-price-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.order-price-row.total {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 15px;
}
.order-price-row .mono { font-family: var(--font-mono); }

.btn-primary {
  height: 44px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
  border: none;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-full { width: 100%; }

/* Empty state */
#pc-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-base);
  z-index: 10;
  text-align: center;
  padding: 40px;
}
.empty-icon { font-size: 64px; opacity: 0.3; }
#pc-empty-state h2 {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 1px;
  color: var(--text-secondary);
}
#pc-empty-state p { color: var(--text-muted); max-width: 320px; line-height: 1.6; }

.empty-product-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  max-width: 500px;
}
.empty-cat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.empty-cat-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--text-primary);
}
