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

* {
  box-sizing: border-box;
}

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

.container {
  max-width: 460px;
  margin: 48px auto;
  padding: 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

h1 {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 24px;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  display: block;
}

input,
select {
  width: 100%;
  padding: 14px 12px;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
}

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

input.error {
  border-color: var(--error);
}

.help-text {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 12px;
}

button {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: #fff;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.result {
  margin-top: 24px;
  padding: 16px;
  background: #f1f5f9;
  border-radius: 12px;
  font-size: 0.95rem;
  animation: fadeIn 0.3s ease;
}

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

.error-msg {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: -6px;
  margin-bottom: 8px;
}

.content-section {
  margin-top: 32px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
}

.content-section h2 {
  font-size: 1.15rem;
  margin: 24px 0 10px;
  font-weight: 600;
}

.content-section p,
.content-section li {
  font-size: 0.95rem;
}

.content-section ul {
  padding-left: 20px;
}

.note {
  margin-top: 16px;
  font-size: 0.85rem;
  text-align: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .container {
    margin: 24px 16px;
  }
}

/* Chart */
canvas {
  margin-top: 24px;
  width: 100%;
  max-width: 100%;
}

/* Table */
.table-wrapper {
  margin-top: 24px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: #e5edff;
}

th,
td {
  padding: 10px;
  border: 1px solid var(--border);
  text-align: center;
}

th {
  font-weight: 600;
  color: var(--text);
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

/* Secondary button */
.secondary-btn {
  margin-top: 10px;
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  background: #e2e8f0;
}

/* PRINT STYLES */
@media print {
  body {
    background: white;
  }

  button,
  .note,
  .content-section,
  canvas,
  .ads {
    display: none !important;
  }

  .container {
    box-shadow: none;
    border-radius: 0;
    margin: 0;
    padding: 0;
  }

  .result {
    font-size: 1rem;
  }

  h1 {
    text-align: left;
  }
}

/* Chart */
canvas {
  margin-top: 24px;
  width: 100%;
  max-width: 100%;
}

/* 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: 1000;
}

.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;
}

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