: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: 440px;
  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;
  font-family: 'Inter', sans-serif;
}

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

select {
  cursor: pointer;
}

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

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

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;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}

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

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

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

.error-msg {
  background: #fef2f2;
  color: var(--error);
  padding: 12px;
  border-radius: 10px;
  margin: 16px 0;
  border-left: 4px solid var(--error);
  display: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.result {
  margin-top: 24px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: none;
}

.result h2,
.result h3 {
  color: var(--text);
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 1.25rem;
}

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

.result-summary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-row:last-child {
  border-bottom: none;
  padding-top: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.highlight-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1rem 0;
  text-align: center;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.breakdown-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text);
}

.breakdown-table tr:last-child td {
  border-bottom: none;
}

.breakdown-table .amount {
  text-align: right;
  font-weight: 600;
  color: var(--primary);
}

.breakdown-table .label {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Content Boxes */
.info-box,
.warning-box,
.example-box,
.formula-box {
  padding: 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.info-box {
  background: #eff6ff;
  border-color: #3b82f6;
}

.info-box h3 {
  color: #1e40af;
  margin-bottom: 0.75rem;
}

.warning-box {
  background: #fffbeb;
  border-color: #f59e0b;
}

.warning-box h3 {
  color: #92400e;
  margin-bottom: 0.75rem;
}

.example-box {
  background: #f9fafb;
  border-color: #6b7280;
}

.example-box h3 {
  color: #374151;
  margin-bottom: 0.75rem;
}

.formula-box {
  background: #faf5ff;
  border-color: #a855f7;
}

.formula-box h3 {
  color: #7c3aed;
  margin-bottom: 0.75rem;
}

.formula-box .note {
  font-style: italic;
  color: #6b7280;
  margin-top: 1rem;
  font-size: 0.9rem;
}

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

.note {
  background-color: #fef3c7;
  color: #92400e;
  padding: 12px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 0.9rem;
  border-left: 4px solid #f59e0b;
}

footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

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

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

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

.content-section h3 {
  font-size: 1rem;
  margin: 16px 0 8px;
  font-weight: 600;
  color: var(--text);
}

.content-section p,
.content-section li {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #334155;
  margin-bottom: 0.75rem;
}

.content-section ul,
.content-section ol {
  padding-left: 20px;
  margin: 1rem 0;
}

.content-section li {
  margin-bottom: 0.5rem;
}

.faq-item {
  margin-bottom: 16px;
}

.faq-item h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

.faq-item p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #475569;
}

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

@media (max-width: 768px) {
  .container {
    margin: 24px 12px;
    padding: 20px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .result h2,
  .result h3 {
    font-size: 1.1rem;
  }

  .related-links {
    grid-template-columns: 1fr;
  }
}

@media print {
  .navbar,
  .ads,
  button,
  .breadcrumb,
  .related-links,
  footer {
    display: none !important;
  }
  
  .container {
    box-shadow: none;
    margin: 0;
    padding: 0;
    max-width: 100%;
  }
  
  body {
    background: white;
  }
  
  h1 {
    font-size: 1.5rem;
    margin-bottom: 16px;
  }
  
  .result,
  .content-section,
  .faq-item {
    display: block !important;
    page-break-inside: avoid;
  }
  
  .result {
    border: 1px solid #ccc;
  }
  
  .result-summary,
  .breakdown-table,
  .info-box,
  .warning-box,
  .example-box,
  .formula-box {
    page-break-inside: avoid;
  }
}

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

.back-to-top a {
  display: block;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  text-align: center;
  line-height: 50px;
  font-size: 24px;
  border-radius: 50%;
  text-decoration: none;
  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(-3px);
  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: 45px;
    height: 45px;
    line-height: 45px;
    font-size: 20px;
  }
}
