/* ─── CSS VARIABLES ───────────────────────────────────────────────── */
:root {
  --primary: #3b82f6;               /* Blue primary */
  --primary-dark: #1e40af;          /* Blue dark */
  --primary-light: #60a5fa;         /* Blue light */
  --white: #ffffff;
  --bg: #ffffff;                    /* Light background */
  --bg-alt: #f9fafb;                /* Alternative background */
  --text: #1f2937;                  /* Dark text */
  --text-muted: rgba(31, 41, 55, 0.6);
  --text-lighter: rgba(31, 41, 55, 0.4);
  --border-light: rgba(31, 41, 55, 0.1);
  --border-lighter: rgba(31, 41, 55, 0.05);
  --primary-15: rgba(59, 130, 246, 0.15);
  --primary-12: rgba(59, 130, 246, 0.12);
  --primary-08: rgba(59, 130, 246, 0.08);
  --primary-04: rgba(59, 130, 246, 0.04);
  --primary-2: rgba(59, 130, 246, 0.2);
  --primary-25: rgba(59, 130, 246, 0.25);
  --primary-35: rgba(59, 130, 246, 0.35);
  --primary-3: rgba(59, 130, 246, 0.3);
  --primary-4: rgba(59, 130, 246, 0.4);
  --primary-5: rgba(59, 130, 246, 0.5);
  --primary-9: rgba(59, 130, 246, 0.9);
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: var(--text);
  padding: 0 0 80px 0;
}

/* ─── HERO ──────────────────────────────────────────────────────────── */
.hero-bg {
  padding: 48px 20px 32px;
  text-align: center;
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
}

.header-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.header-badge-text {
  font-size: 12px;
  color: var(--text-lighter);
  letter-spacing: 1px;
}

.hero-title {
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 700;
  letter-spacing: -2px;
  margin: 0 0 8px 0;
  background:  var(--primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--text-lighter);
  font-size: 15px;
  margin: 0;
}

/* ─── PULSE DOT ─────────────────────────────────────────────────────── */
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

/* ─── MAIN CONTAINER ────────────────────────────────────────────────── */
.main-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 1000px) {
  .main-container {
    max-width: 1180px;
  }

  .grid-layout {
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 1fr);
    grid-template-areas:
      "settings results"
      "input results"
      "footer footer";
    align-items: start;
    gap: 24px;
  }

  #settings-card {
    grid-area: settings;
  }

  #input-card {
    grid-area: input;
  }

  #results-container {
    grid-area: results;
  }

  .info-footer {
    grid-area: footer;
  }
}

/* ─── CARD ──────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-alt);
  border: 1px solid var(--border-lighter);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  padding: 24px;
}

.card-gold {
  background: linear-gradient(135deg, var(--primary-12), var(--primary-04));
  border: 1px solid var(--primary-25);
}

/* ─── SECTION LABEL ─────────────────────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(31, 41, 55, 0.5);
  margin-bottom: 10px;
}

.settings-section {
  margin-bottom: 20px;
}

/* ─── TAB BUTTONS ───────────────────────────────────────────────────── */
.tab-group {
  display: flex;
  gap: 8px;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-lighter);
  transition: all 0.2s;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  box-shadow: 0 4px 15px var(--primary-3);
}

.tab-btn:not(.active) {
  background: var(--bg-alt);
  color: var(--text-muted);
}

.tab-btn:not(.active):hover {
  background: var(--border-lighter);
  color: var(--text);
}

/* ─── SEGMENT BUTTONS ───────────────────────────────────────────────── */
.seg-bg {
  background: var(--bg-alt);
  padding: 4px;
  border-radius: 10px;
}

.seg-group {
  display: flex;
  gap: 6px;
}

.seg-btn {
  flex: 1;
  padding: 10px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
}

.seg-btn.active {
  background: var(--primary-2);
  color: var(--primary);
  border: 1px solid var(--primary-35);
}

.seg-btn:not(.active) {
  background: transparent;
  color: var(--text-lighter);
  border: 1px solid transparent;
}

.seg-btn:not(.active):hover {
  color: var(--text-muted);
  border: 1px solid var(--border-lighter);
}

/* ─── EXEMPTIONS ────────────────────────────────────────────────────── */
.exemptions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.exemptions-header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toggle-btn {
  background: var(--bg-alt);
  border: 1px solid var(--border-lighter);
  border-radius: 6px;
  color: var(--text-lighter);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.toggle-btn:hover {
  background: var(--border-lighter);
  color: var(--text-muted);
}

.exemptions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeInUp 0.4s ease;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.check-item:hover {
  background: var(--border-lighter);
}

.check-item.checked {
  background: var(--primary-08);
  border-color: var(--primary-2);
}

.checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-light);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.15s;
}

.checkbox.checked {
  background: var(--primary);
  border-color: var(--primary);
}

.check-icon {
  display: none;
}

.checkbox.checked .check-icon {
  display: block;
}

.check-text {
  flex: 1;
}

.check-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s;
}

.check-title.checked {
  color: var(--primary);
}

.check-desc {
  font-size: 11px;
  color: rgba(31, 41, 55, 0.5);
  margin-top: 2px;
}

/* ─── UNION ─────────────────────────────────────────────────────────── */
.union-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.union-input {
  background: var(--bg-alt);
  border: 1.5px solid var(--border-lighter);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  width: 80px;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
}

.union-input:focus {
  border-color: var(--primary-4);
}

.union-label {
  color: var(--text-lighter);
  font-size: 14px;
}

/* ─── CALC INPUT ────────────────────────────────────────────────────── */
.input-with-icon {
  position: relative;
  width: 100%;
}

.calc-input {
  width: 100%;
  background: var(--bg-alt);
  border: 1.5px solid var(--border-lighter);
  border-radius: 12px;
  padding: 16px 52px 16px 20px;
  font-size: 28px;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  letter-spacing: -0.5px;
}

.calc-input:focus {
  border-color: var(--primary-5);
}

.calc-input::placeholder {
  color: rgba(31, 41, 55, 0.3);
  font-size: 22px;
}

.input-clear-icon {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.input-clear-icon:hover {
  color: var(--text);
}

/* ─── CALC BUTTONS ──────────────────────────────────────────────────── */
.input-btn-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.calc-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  font-weight: 700;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 20px var(--primary-25);
  font-family: 'DM Sans', sans-serif;
}

.calc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px var(--primary-35);
}

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

.clear-btn {
  padding: 12px 20px;
  background: var(--bg-alt);
  color: var(--text-lighter);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid var(--border-lighter);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}

.clear-btn:hover {
  background: var(--border-lighter);
  color: var(--text-muted);
}

/* ─── RESULTS ───────────────────────────────────────────────────────── */
.result-main {
  padding: 28px;
  margin-bottom: 0;
}

.result-top-grid {
  display: grid;
  gap: 20px;
}

/* Desktop and tablet layout */
@media (min-width: 768px) {
  .result-top-grid {
    grid-template:
      'net net'
      'gross supergross';
  }

  .item1 { grid-area: net; }
  .item2 { grid-area: gross; }
  .item3 { grid-area: supergross; }
}

.result-top-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: rgba(31, 41, 55, 0.5);
}

.big-result {
  font-family: 'DM Mono', monospace;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
}

.big-result.gold {
  color: var(--primary);
}

/* ─── PROGRESS BAR ──────────────────────────────────────────────────── */
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(31, 41, 55, 0.5);
  margin-bottom: 6px;
}

.progress-track {
  height: 6px;
  background: var(--border-lighter);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #ff6b6b);
  border-radius: 10px;
  transition: width 0.6s ease;
}

/* ─── RESULT ROWS ───────────────────────────────────────────────────── */
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-lighter);
}

.result-row:last-child {
  border-bottom: none;
}

.result-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.result-value {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.result-value.negative { color: #ff6b6b; }
.result-value.positive { color: #4ade80; }
.result-value.gold { color: var(--primary); }

/* ─── DIVIDER BAR ───────────────────────────────────────────────────── */
.divider-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}

.divider-bar::before,
.divider-bar::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-lighter);
}

.divider-label {
  font-size: 10px;
  color: rgba(31, 41, 55, 0.4);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* ─── NET SUMMARY ───────────────────────────────────────────────────── */
.net-summary {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.15);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.net-summary-label {
  font-size: 13px;
  color: #4ade80;
  font-weight: 600;
}

.net-summary-value {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #4ade80;
}

/* ─── TAGS ──────────────────────────────────────────────────────────── */
.tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tag-gold {
  background: var(--primary-15);
  color: var(--primary);
  border: 1px solid var(--primary-25);
}

.tag-slate {
  background: rgba(148,163,184,0.1);
  color: #94a3b8;
}

/* ─── INFO BADGE ────────────────────────────────────────────────────── */
.info-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-15);
  color: var(--primary);
  border: 1px solid var(--primary-25);
}

/* ─── INFO FOOTER ───────────────────────────────────────────────────── */
.info-footer {
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  background: var(--bg-alt);
  border: 1px solid var(--border-lighter);
  font-size: 11px;
  color: rgba(31, 41, 55, 0.6);
  line-height: 1.7;
}

/* ─── ANIMATIONS ────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeInUp 0.4s ease;
}

/* ─── SCROLLBAR ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
