/* ═══════════════════════════════════════════
   3DPRINTCOST — style.css
   ═══════════════════════════════════════════ */

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

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

/* ── Tokens ── */
:root {
  /* Background layers */
  --bg:     #0c0d0f;
  --bg2:    #141517;
  --bg3:    #1b1d20;
  --bg4:    #222428;

  /* Borders */
  --bdr:    rgba(255,255,255,0.06);
  --bdr2:   rgba(255,255,255,0.11);
  --bdr3:   rgba(255,255,255,0.16);

  /* Text */
  --t1:     #eaebec;
  --t2:     #888b91;
  --t3:     #4e5158;

  /* Accents */
  --blue:       #4a9eff;
  --blue-bg:    rgba(74,158,255,0.09);
  --blue-bdr:   rgba(74,158,255,0.22);
  --green:      #3ecf8e;
  --green-bg:   rgba(62,207,142,0.09);
  --green-bdr:  rgba(62,207,142,0.22);
  --amber:      #f5a623;
  --amber-bg:   rgba(245,166,35,0.09);
  --pink:       #e05c8a;
  --red:        #ff6b6b;

  /* Chart colors */
  --c-fil:  #4a9eff;
  --c-ene:  #3ecf8e;
  --c-mac:  #f5a623;
  --c-lab:  #e05c8a;
  --c-fix:  #666870;

  /* Misc */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --shadow:    0 1px 2px rgba(0,0,0,0.5), 0 6px 20px rgba(0,0,0,0.28);
  --shadow-lg: 0 2px 4px rgba(0,0,0,0.5), 0 12px 40px rgba(0,0,0,0.35);

  /* Typography */
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;
}

/* ── Base ── */
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--t1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Page wrapper ── */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* ══════════════════════════════
   HEADER
══════════════════════════════ */
.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  margin-bottom: 1.75rem;
  border-bottom: 0.5px solid var(--bdr);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.logo {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--t1);
}

.logo em {
  font-style: normal;
  color: var(--blue);
}

.logo-sub {
  font-size: 11px;
  color: var(--t3);
  margin-top: 5px;
  letter-spacing: 0.02em;
}

.header-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ══════════════════════════════
   BADGES
══════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  border: 0.5px solid;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge i { font-size: 12px; }
.badge-blue  { background: var(--blue-bg);  color: var(--blue);  border-color: var(--blue-bdr); }
.badge-green { background: var(--green-bg); color: var(--green); border-color: var(--green-bdr); }
.badge-amber { background: var(--amber-bg); color: var(--amber); border-color: rgba(245,166,35,0.22); }

/* ══════════════════════════════
   PRESET STRIP
══════════════════════════════ */
.preset-strip {
  margin-bottom: 1.25rem;
}

.strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.strip-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
}

/* Spool toggle */
.spool-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg3);
  border: 0.5px solid var(--bdr2);
  border-radius: 20px;
  padding: 2px;
}

.spool-btn {
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 3px 12px;
  border: none;
  border-radius: 18px;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.spool-btn.active {
  background: var(--bg2);
  color: var(--t1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Preset pills */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.preset-btn {
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 5px 13px;
  border: 0.5px solid var(--bdr2);
  border-radius: 20px;
  background: var(--bg3);
  color: var(--t2);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.preset-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-bg);
}

.preset-btn.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-bg);
}

.preset-btn .ptag {
  font-size: 10px;
  opacity: 0.55;
  margin-left: 3px;
}

/* ══════════════════════════════
   MAIN GRID
══════════════════════════════ */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.col { display: flex; flex-direction: column; gap: 1rem; }

/* ══════════════════════════════
   CARDS
══════════════════════════════ */
.card {
  background: var(--bg2);
  border: 0.5px solid var(--bdr);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title i { font-size: 13px; }

/* ══════════════════════════════
   FORM ELEMENTS
══════════════════════════════ */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; margin-bottom: 0.65rem; }
.row-2:last-child { margin-bottom: 0; }

.field { display: flex; flex-direction: column; gap: 4px; }

.field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--t3);
  letter-spacing: 0.01em;
}

.field input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  background: var(--bg3);
  border: 0.5px solid var(--bdr2);
  border-radius: var(--radius-sm);
  color: var(--t1);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
  -moz-appearance: textfield;
}

.field input::-webkit-inner-spin-button,
.field input::-webkit-outer-spin-button { -webkit-appearance: none; }

.field input:focus {
  outline: none;
  border-color: var(--blue);
  background: rgba(74,158,255,0.04);
}

.field-hint {
  font-size: 10px;
  color: var(--t3);
  margin-top: 5px;
  line-height: 1.5;
}

/* ══════════════════════════════
   RESULT CARD
══════════════════════════════ */
.card-result {
  background: linear-gradient(145deg, #13161e 0%, #111315 100%);
  border-color: rgba(74,158,255,0.15);
  box-shadow: var(--shadow-lg);
}

.result-hero {
  text-align: center;
  padding: 1.75rem 1rem 1.5rem;
  border-bottom: 0.5px solid var(--bdr);
}

.result-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 0.6rem;
}

.result-amount {
  font-family: var(--font-mono);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--t1);
  line-height: 1;
  letter-spacing: -1.5px;
  transition: all 0.2s;
}

.result-unit {
  font-size: 13px;
  color: var(--t3);
  margin-top: 6px;
}

/* Breakdown lines */
.breakdown { padding: 1rem 0 0; }

.bline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
}

.bline-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--t2);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bline-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--t2);
}

/* Progress bar */
.cost-bar {
  height: 5px;
  background: var(--bg4);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  margin-top: 0.8rem;
}

.cost-bar-seg {
  height: 100%;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}

/* ══════════════════════════════
   MARGIN / SELL SECTION
══════════════════════════════ */
.margin-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 0.5px solid var(--bdr);
}

.margin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.margin-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
}

.margin-pct {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg4);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin-bottom: 0.8rem;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--bg2);
  box-shadow: 0 0 0 1px var(--blue);
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }

input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--bg2);
  cursor: pointer;
}

.sell-box {
  background: var(--bg3);
  border: 0.5px solid var(--bdr2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sell-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--t2);
}

.sell-price {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue);
}

.profit-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 5px;
  padding: 0 2px;
}

.profit-row span:first-child { color: var(--t3); }
.profit-row span:last-child {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
}

/* ══════════════════════════════
   RECAP TABLE
══════════════════════════════ */
.recap-table { display: flex; flex-direction: column; }

.recap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 0.5px solid var(--bdr);
  font-size: 12px;
}

.recap-row:last-child {
  border-bottom: none;
  font-weight: 600;
  padding-top: 9px;
}

.recap-row .rl { color: var(--t2); }

.recap-row .rv {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--t1);
}

.recap-row:last-child .rv { color: var(--amber); }

/* ══════════════════════════════
   PROFILES
══════════════════════════════ */
.profiles-list { display: flex; flex-direction: column; margin-bottom: 4px; }

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 0.5px solid var(--bdr);
  font-size: 13px;
}

.profile-item:last-child { border-bottom: none; }
.profile-name { font-weight: 500; color: var(--t1); }

.profile-actions { display: flex; gap: 4px; }

.profile-actions button {
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-sans);
  border: 0.5px solid var(--bdr);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  transition: all 0.15s;
}

.profile-actions button:hover {
  background: var(--bg3);
  color: var(--t1);
}

.profile-actions .btn-del:hover {
  color: var(--red);
  border-color: rgba(255,107,107,0.25);
}

.empty-profiles {
  text-align: center;
  padding: 1.5rem 0;
  color: var(--t3);
  font-size: 12px;
}

.empty-profiles i { font-size: 22px; display: block; margin-bottom: 6px; opacity: 0.4; }

/* ── Save row ── */
.save-row {
  display: flex;
  gap: 6px;
  margin-top: 0.75rem;
}

.save-row input {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  background: var(--bg3);
  border: 0.5px solid var(--bdr2);
  border-radius: var(--radius-sm);
  color: var(--t1);
  font-family: var(--font-sans);
  font-size: 13px;
  transition: border-color 0.15s;
}

.save-row input::placeholder { color: var(--t3); }
.save-row input:focus { outline: none; border-color: var(--blue); }

.btn {
  height: 36px;
  padding: 0 14px;
  border: 0.5px solid var(--bdr2);
  border-radius: var(--radius-sm);
  background: var(--bg3);
  color: var(--t2);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { color: var(--t1); background: var(--bg4); }

.btn-accent {
  background: var(--blue-bg);
  border-color: var(--blue-bdr);
  color: var(--blue);
}

.btn-accent:hover {
  background: rgba(74,158,255,0.16);
  color: var(--blue);
}

/* ══════════════════════════════
   HINT TEXT
══════════════════════════════ */
.hint {
  font-size: 10px;
  color: var(--t3);
  line-height: 1.5;
  margin-top: 6px;
}

/* ══════════════════════════════
   FOOTER
══════════════════════════════ */
.site-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 0.5px solid var(--bdr);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--t3);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--t3);
}

.footer-right a { color: var(--blue); font-size: 11px; }
.footer-right a:hover { text-decoration: underline; }

/* ══════════════════════════════
   RESPONSIVE
══════════════════════════════ */
@media (max-width: 720px) {
  .main-grid { grid-template-columns: 1fr; }
  .result-amount { font-size: 2.4rem; }
}

@media (max-width: 480px) {
  .page { padding: 1.25rem 1rem 3rem; }
  .row-2 { grid-template-columns: 1fr; }
  .site-header { flex-direction: column; align-items: flex-start; }
  .logo { font-size: 1.2rem; }
}

/* ══════════════════════════════
   REDUCED MOTION
══════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .cost-bar-seg { transition: none; }
  input[type="range"]::-webkit-slider-thumb { transition: none; }
}
