:root {
  --primary: #2563eb;
  --text: #0f172a;
  --muted: #64748b;
  --bg: #f8fafc;
  --border: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background-color: var(--bg);
}

/* Breadcrumb */
.breadcrumb {
  max-width: 1100px;
  margin: 16px auto;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--muted);
}

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

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

.breadcrumb span {
  margin: 0 8px;
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 500;
}

.container {
  max-width: 440px;
  margin: 40px auto;
  padding: 0 20px;
}

h1 {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--text);
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
}

input,
select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input.error {
  border-color: #dc2626;
}

.help-text {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

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

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

button {
  flex: 1;
  padding: 14px 24px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.secondary-btn {
  background: white;
  color: var(--primary);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.error-msg {
  color: #dc2626;
  background: #fee2e2;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
  display: none;
}

.error-msg.show {
  display: block;
}

.result {
  margin-top: 32px;
  padding: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: none;
}

.result.show {
  display: block;
}

.result h2,
.result h3 {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 24px;
  margin-bottom: 16px;
}

.result h2:first-child {
  margin-top: 0;
}

.highlight-amount {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  padding: 20px;
  border-radius: 8px;
  margin: 16px 0;
  border-left: 4px solid var(--primary);
}

.highlight-amount p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.highlight-amount strong {
  display: block;
  font-size: 32px;
  color: var(--primary);
  margin-top: 4px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child {
  border-bottom: none;
  font-weight: 600;
  font-size: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  font-weight: 600;
}

td {
  color: var(--text);
}

tbody tr:hover {
  background-color: var(--bg);
}

.comparison-table {
  margin: 24px 0;
}

canvas {
  margin: 24px auto;
  display: block;
  max-width: 100%;
}

.content-section {
  max-width: 1100px;
  margin: 48px auto;
  padding: 0 20px;
  line-height: 1.8;
}

.content-section h2 {
  color: var(--text);
  font-size: 24px;
  margin-top: 32px;
  margin-bottom: 16px;
}

.content-section h3 {
  color: var(--text);
  font-size: 20px;
  margin-top: 24px;
  margin-bottom: 12px;
}

.content-section h4 {
  color: var(--text);
  font-size: 18px;
  margin-top: 20px;
  margin-bottom: 10px;
}

.content-section ul,
.content-section ol {
  margin: 16px 0;
  padding-left: 24px;
}

.content-section li {
  margin-bottom: 8px;
}

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

.content-section a:hover {
  text-decoration: underline;
}

.content-section p {
  margin: 16px 0;
}

.content-section strong {
  font-weight: 600;
  color: var(--text);
}

.faq-item {
  background: white;
  padding: 20px;
  margin: 16px 0;
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

.faq-item h3 {
  color: var(--text);
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 12px;
}

.faq-item p {
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* Note Section */
.note {
  background: #fef3c7;
  padding: 20px;
  margin: 24px auto;
  max-width: 1100px;
  border-radius: 8px;
  border-left: 4px solid #f59e0b;
  color: #78350f;
  line-height: 1.6;
}

.note strong {
  color: #78350f;
  font-weight: 600;
}

.note a {
  color: #1d4ed8;
  text-decoration: underline;
}

.note a:hover {
  color: #2563eb;
}

/* Footer */
footer {
  background: white;
  padding: 20px;
  margin: 24px auto 40px;
  max-width: 1100px;
  text-align: center;
  border-top: 1px solid var(--border);
}

footer p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

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

/* Print Styles */
@media print {
  body {
    background: white;
  }

  .navbar,
  .ads,
  .form-actions,
  button,
  .breadcrumb {
    display: none !important;
  }

  .container {
    max-width: 100%;
    margin: 0;
    padding: 20px;
  }

  .result,
  .content-section,
  .faq-item {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
    margin: 16px 0;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  table {
    page-break-inside: avoid;
  }

  canvas {
    max-width: 100%;
    page-break-inside: avoid;
  }
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  h1 {
    font-size: 24px;
  }

  .form-actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .highlight-amount strong {
    font-size: 28px;
  }
}

/* Related Calculators & Resources */
.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.related-links a {
  background: white;
  padding: 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  display: block;
  text-align: center;
}

.related-links a:hover {
  border-color: var(--primary);
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  text-decoration: none;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
}

.back-to-top a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: #2563eb;
  color: white;
  text-decoration: none;
  border-radius: 50%;
  font-size: 24px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.back-to-top a:hover {
  background: #1d4ed8;
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
  }
  
  .back-to-top a {
    width: 48px;
    height: 48px;
    font-size: 22px;
  }
}
