/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif; color: #1e293b; background: #f8fafc; line-height: 1.6; }
img { max-width: 100%; height: auto; }
a { color: #2563eb; text-decoration: none; }
a:hover { color: #1d4ed8; text-decoration: underline; }

/* === Header === */
.site-header { position: sticky; top: 0; z-index: 100; background: #0f172a; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.header-inner { max-width: 1200px; margin: 0 auto; padding: .75rem 1rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.site-logo { font-size: 1.25rem; font-weight: 700; color: #fff; }
.site-logo:hover { text-decoration: none; color: #93c5fd; }
.site-logo span { color: #60a5fa; }
nav.main-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
nav.main-nav a { color: #cbd5e1; font-size: .85rem; padding: .35rem .65rem; border-radius: 6px; transition: background .15s, color .15s; }
nav.main-nav a:hover, nav.main-nav a.active { background: #1e293b; color: #fff; text-decoration: none; }
.nav-toggle { display: none; background: none; border: 2px solid #475569; color: #fff; padding: .35rem .6rem; border-radius: 6px; font-size: 1.1rem; cursor: pointer; }

/* === Ad Slots === */
.ad-slot { background: #e2e8f0; border: 2px dashed #94a3b8; border-radius: 8px; text-align: center; color: #64748b; font-size: .8rem; padding: 1rem; margin: 1rem 0; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.ad-slot-header { min-height: 90px; }
.ad-slot-sidebar { min-height: 250px; }
.ad-slot-content { min-height: 250px; }

/* === Layout === */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.page-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem 0; }
.content-main { min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: 1rem; }

/* === Hero (homepage) === */
.hero { background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); color: #fff; padding: 3rem 1rem; text-align: center; }
.hero h1 { font-size: 2rem; margin-bottom: .75rem; }
.hero p { font-size: 1.1rem; color: #cbd5e1; max-width: 600px; margin: 0 auto .5rem; }

/* === Tool Cards (homepage) === */
.tools-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; padding: 2rem 0; }
.tool-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 1.5rem; transition: box-shadow .2s, transform .15s; }
.tool-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.tool-card h3 { font-size: 1.15rem; margin-bottom: .4rem; }
.tool-card h3 a { color: #0f172a; }
.tool-card p { color: #475569; font-size: .92rem; margin-bottom: .75rem; }
.tool-card .btn-sm { display: inline-block; background: #2563eb; color: #fff; padding: .4rem 1rem; border-radius: 6px; font-size: .85rem; font-weight: 600; }
.tool-card .btn-sm:hover { background: #1d4ed8; text-decoration: none; }

/* === Calculator Page === */
.calc-intro { margin-bottom: 1.5rem; }
.calc-intro h1 { font-size: 1.75rem; color: #0f172a; margin-bottom: .5rem; }
.calc-intro p { color: #475569; font-size: 1rem; }

.calc-box { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; }
.calc-box h2 { font-size: 1.2rem; color: #0f172a; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 2px solid #e2e8f0; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; color: #334155; margin-bottom: .3rem; }
.form-group input, .form-group select { width: 100%; padding: .6rem .75rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1rem; color: #1e293b; background: #f8fafc; transition: border-color .15s; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-row { display: grid; grid-template-columns: 1fr; gap: .75rem; }

.btn-calculate { display: block; width: 100%; padding: .75rem; background: #2563eb; color: #fff; border: none; border-radius: 8px; font-size: 1.05rem; font-weight: 700; cursor: pointer; transition: background .15s; }
.btn-calculate:hover { background: #1d4ed8; }

.results-box { background: #f0f9ff; border: 2px solid #bae6fd; border-radius: 12px; padding: 1.25rem; margin-top: 1rem; display: none; }
.results-box.visible { display: block; }
.results-box h3 { font-size: 1.1rem; color: #0369a1; margin-bottom: .75rem; }
.result-row { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid #e0f2fe; font-size: .95rem; }
.result-row:last-child { border-bottom: none; }
.result-label { color: #475569; }
.result-value { font-weight: 700; color: #0f172a; }
.result-highlight { font-size: 1.4rem; color: #2563eb; font-weight: 800; text-align: center; padding: .75rem 0; }

/* === Info Sections === */
.info-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; }
.info-section h2 { font-size: 1.15rem; color: #0f172a; margin-bottom: .75rem; }
.info-section p, .info-section li { color: #475569; font-size: .92rem; line-height: 1.7; }
.info-section ol, .info-section ul { padding-left: 1.25rem; margin-bottom: .75rem; }
.info-section li { margin-bottom: .35rem; }
.formula-block { background: #f1f5f9; border-left: 4px solid #2563eb; padding: .75rem 1rem; border-radius: 0 8px 8px 0; font-family: 'Courier New', monospace; font-size: .95rem; color: #1e293b; margin: .75rem 0; overflow-x: auto; }

/* === Related Calculators === */
.related-calcs { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.related-card { display: flex; align-items: center; gap: .75rem; padding: .75rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; transition: background .15s; }
.related-card:hover { background: #f0f9ff; text-decoration: none; }
.related-card .rc-icon { font-size: 1.5rem; }
.related-card .rc-text strong { display: block; color: #0f172a; font-size: .9rem; }
.related-card .rc-text span { color: #64748b; font-size: .8rem; }

/* === Footer === */
.site-footer { background: #0f172a; color: #94a3b8; padding: 2rem 1rem; margin-top: 2rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.footer-col h4 { color: #fff; font-size: .95rem; margin-bottom: .5rem; }
.footer-col a { color: #94a3b8; font-size: .85rem; display: block; padding: .15rem 0; }
.footer-col a:hover { color: #fff; }
.footer-bottom { max-width: 1200px; margin: 1.5rem auto 0; padding-top: 1rem; border-top: 1px solid #1e293b; text-align: center; font-size: .8rem; }

/* === Error === */
.input-error { border-color: #ef4444 !important; }
.error-msg { color: #ef4444; font-size: .8rem; margin-top: .2rem; display: none; }

/* === Responsive === */
@media (min-width: 640px) {
  .form-row { grid-template-columns: 1fr 1fr; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .related-calcs { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .hero h1 { font-size: 2.5rem; }
  .page-layout { grid-template-columns: 1fr 300px; }
  .nav-toggle { display: none !important; }
  nav.main-nav { display: flex !important; }
}

@media (min-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
  .related-calcs { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 767px) {
  nav.main-nav { display: none; width: 100%; order: 3; flex-direction: column; background: #1e293b; border-radius: 8px; padding: .5rem; }
  nav.main-nav.open { display: flex; }
  .nav-toggle { display: block; }
}
