/* ===== Design System ===== */
:root {
  --color-primary: #1a56db;
  --color-primary-hover: #1648b8;
  --color-primary-light: #e8effc;
  --color-bg: #f3f4f6;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-secondary: #6b7280;
  --color-border: #e5e7eb;
  --color-success: #059669;
  --color-success-light: #ecfdf5;
  --color-error: #dc2626;
  --color-error-light: #fef2f2;
  --color-row-alt: #f9fafb;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --max-width: 720px;
  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  text-align: center;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.header p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* ===== Navigation Tabs ===== */
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.nav-tab {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.nav-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* ===== Calculator Card ===== */
.calc-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.calc-card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.375rem;
}

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

.input-prefix {
  position: absolute;
  left: 0.875rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-light);
}

.form-error {
  font-size: 0.8125rem;
  color: var(--color-error);
  margin-top: 0.375rem;
  display: none;
}

.form-error.visible {
  display: block;
}

.btn-calculate {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  margin-top: 0.5rem;
}

.btn-calculate:hover {
  background: var(--color-primary-hover);
}

/* ===== Results ===== */
.results {
  margin-top: 1.5rem;
  display: none;
}

.results.visible {
  display: block;
}

.results-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.result-item {
  text-align: center;
  padding: 0.75rem 0.5rem;
  background: var(--color-bg);
  border-radius: var(--radius);
}

.result-item .label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.25rem;
}

.result-item .value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
}

.result-item .value.tax {
  color: var(--color-error);
}

.result-item .value.net {
  color: var(--color-success);
}

/* ===== Breakdown Table ===== */
.breakdown h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.breakdown-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.breakdown-table th:last-child,
.breakdown-table td:last-child {
  text-align: right;
}

.breakdown-table th:nth-child(2),
.breakdown-table td:nth-child(2) {
  text-align: center;
}

.breakdown-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.breakdown-table tr:nth-child(even) td {
  background: var(--color-row-alt);
}

.breakdown-table tr.total-row td {
  font-weight: 700;
  border-top: 2px solid var(--color-text);
  border-bottom: none;
  background: transparent;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.footer a {
  color: var(--color-primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.25rem;
  }

  .results-summary {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .result-item .label {
    margin-bottom: 0;
  }

  .breakdown-table {
    font-size: 0.8125rem;
  }

  .breakdown-table th,
  .breakdown-table td {
    padding: 0.375rem 0.5rem;
  }
}
