/* =========================================================
   PesaCalc — Modern Calculator Design System
   Font: Syne (display) + Sora (body)
   Aesthetic: Dark luxury with emerald accents
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Sora:wght@300;400;500;600&display=swap');

/* ── Design Tokens ── */
:root {
  --c-bg:         #0a0f0d;
  --c-surface:    #111816;
  --c-card:       #161e1a;
  --c-card-2:     #1c2620;
  --c-border:     rgba(52, 211, 153, 0.12);
  --c-border-hi:  rgba(52, 211, 153, 0.3);
  --c-green:      #34d399;
  --c-green-dark: #059669;
  --c-green-dim:  rgba(52, 211, 153, 0.08);
  --c-gold:       #f59e0b;
  --c-red:        #f87171;
  --c-text:       #e2ebe7;
  --c-muted:      #6b8f7d;
  --c-label:      #a3c4b5;
  --r-sm:         8px;
  --r-md:         14px;
  --r-lg:         20px;
  --r-xl:         28px;
  --shadow:       0 4px 32px rgba(0,0,0,0.5);
  --shadow-green: 0 0 32px rgba(52, 211, 153, 0.12);
  --ff-head:      'Syne', sans-serif;
  --ff-body:      'Sora', sans-serif;
  --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.calc-page {
  font-family: var(--ff-body);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  padding: 2rem 1rem 4rem;
}

/* ── Page Header ── */
.calc-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  position: relative;
}

.calc-header::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--c-green), transparent);
  margin: 1.5rem auto 0;
  border-radius: 2px;
}

.calc-header h1 {
  font-family: var(--ff-head);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.calc-header h1 .accent {
  color: var(--c-green);
}

.calc-header p {
  font-size: 1rem;
  color: var(--c-muted);
  margin-top: 0.75rem;
  font-weight: 300;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ── Layout ── */
.calc-layout {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.calc-layout.single-col {
  grid-template-columns: 1fr;
  max-width: 680px;
}

.calc-layout.wide {
  max-width: 1100px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
  .calc-layout, .calc-layout.wide { grid-template-columns: 1fr; }
}

/* ── Card ── */
.calc-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}

.calc-card:focus-within {
  border-color: var(--c-border-hi);
  box-shadow: var(--shadow), var(--shadow-green);
}

.calc-card-title {
  font-family: var(--ff-head);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-green);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calc-card-title::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--c-green);
  border-radius: 1px;
}

/* ── Form Fields ── */
.field-group {
  margin-bottom: 1.25rem;
}

.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--c-label);
  margin-bottom: 0.45rem;
  letter-spacing: 0.02em;
}

.field-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-prefix,
.field-suffix {
  position: absolute;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-green);
  pointer-events: none;
  font-family: var(--ff-head);
}

.field-prefix { left: 1rem; }
.field-suffix { right: 1rem; }

.field-input {
  width: 100%;
  background: var(--c-card-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 0.8rem 1rem;
  font-family: var(--ff-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--c-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.field-input.has-prefix { padding-left: 2.8rem; }
.field-input.has-suffix { padding-right: 2.8rem; }

.field-input:focus {
  border-color: var(--c-green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

.field-input::placeholder { color: var(--c-muted); font-weight: 300; }

/* Range slider */
.field-range {
  width: 100%;
  margin-top: 0.6rem;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--c-card-2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.field-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-green);
  box-shadow: 0 0 8px rgba(52,211,153,0.5);
  cursor: grab;
  transition: transform var(--transition);
}

.field-range::-webkit-slider-thumb:active { transform: scale(1.2); cursor: grabbing; }

/* Select */
.field-select {
  width: 100%;
  background: var(--c-card-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 0.8rem 2.5rem 0.8rem 1rem;
  font-family: var(--ff-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--c-text);
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2334d399' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  -webkit-appearance: none;
  transition: border-color var(--transition);
}

.field-select:focus { border-color: var(--c-green); }
.field-select option { background: #1c2620; }

/* ── Button ── */
.calc-btn {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, var(--c-green) 0%, var(--c-green-dark) 100%);
  color: #05150e;
  font-family: var(--ff-head);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.25);
  margin-top: 1.5rem;
}

.calc-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(52, 211, 153, 0.35);
}

.calc-btn:active { transform: translateY(0); }

/* ── Results Panel ── */
.calc-results {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: 2rem;
  box-shadow: var(--shadow);
  display: none;
}

.calc-results.visible { display: block; }

.calc-results-title {
  font-family: var(--ff-head);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-green);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calc-results-title::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--c-green);
}

/* Stat row */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-grid.cols-1 { grid-template-columns: 1fr; }
.stat-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 480px) {
  .stat-grid, .stat-grid.cols-3 { grid-template-columns: 1fr; }
}

.stat-item {
  background: var(--c-card-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 1.1rem;
  transition: border-color var(--transition);
}

.stat-item:hover { border-color: var(--c-border-hi); }

.stat-item.highlight {
  background: var(--c-green-dim);
  border-color: var(--c-green);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.08);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-family: var(--ff-head);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.stat-item.highlight .stat-value { color: var(--c-green); }
.stat-value.positive { color: var(--c-green); }
.stat-value.negative { color: var(--c-red); }
.stat-value.warn    { color: var(--c-gold); }

/* ── Data Table ── */
.calc-table-wrap {
  overflow-x: auto;
  margin-top: 1.5rem;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.calc-table th {
  background: var(--c-card-2);
  color: var(--c-green);
  font-family: var(--ff-head);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

.calc-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(52, 211, 153, 0.05);
  color: var(--c-text);
  font-weight: 400;
  white-space: nowrap;
}

.calc-table tr:last-child td { border-bottom: none; }
.calc-table tr:hover td { background: rgba(52, 211, 153, 0.03); }
.calc-table td.num { text-align: right; font-family: var(--ff-head); font-weight: 500; }
.calc-table td.green { color: var(--c-green); font-weight: 600; }
.calc-table td.red   { color: var(--c-red);   }
.calc-table td.gold  { color: var(--c-gold);  }

/* ── Badge / Tip ── */
.calc-tip {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--c-gold);
  margin-top: 1rem;
  line-height: 1.5;
}

.calc-tip strong { font-weight: 600; }

/* ── Section divider ── */
.calc-divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 1.5rem 0;
}

/* ── Toggle tabs ── */
.calc-tabs {
  display: flex;
  background: var(--c-card-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 1.5rem;
}

.calc-tab {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--c-muted);
  font-family: var(--ff-head);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.calc-tab.active {
  background: var(--c-green);
  color: #05150e;
}

/* ── Two-column form fields ── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

/* ── Checkbox ── */
.field-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.field-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--c-label);
}

.field-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--c-green);
  cursor: pointer;
}

/* ── Pill badge ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.pill-green { background: rgba(52,211,153,0.12); color: var(--c-green); }
.pill-red   { background: rgba(248,113,113,0.12); color: var(--c-red);   }
.pill-gold  { background: rgba(245,158,11,0.12);  color: var(--c-gold);  }

/* ── Empty state ── */
.calc-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--c-muted);
}

.calc-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.calc-empty p { font-size: 0.85rem; line-height: 1.6; }

/* ── Progress bar ── */
.prog-bar {
  height: 6px;
  background: var(--c-card-2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-green-dark), var(--c-green));
  border-radius: 3px;
  transition: width 0.5s ease;
}
