/* CalcHQ Core Styles - Minimal, Zero CLS, Core Web Vitals Tuned */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg-page); color: var(--text-main); line-height: 1.6; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.text-center { text-align: center; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mt-6 { margin-top: 1.5rem; }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand-logo { font-size: 1.25rem; text-decoration: none; color: var(--text-main); display: flex; align-items: center; gap: 8px; font-weight: bold; }
.brand-logo svg { color: var(--primary); }
.brand-logo strong { color: var(--primary); }
.nav-links a { margin-left: 1.25rem; color: var(--text-muted); text-decoration: none; font-size: 0.85rem; font-weight: 500; }
.nav-links a:hover { color: var(--primary); }

/* Hero */
.hero-section { background: #fff; border-bottom: 1px solid var(--border); padding: 3rem 0; }
.hero-section h1 { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.025em; }
.hero-section p { color: var(--text-muted); margin-top: 0.5rem; }
.search-box { max-width: 600px; margin: 1.5rem auto 0; }
.search-box input { width: 100%; padding: 0.85rem 1.25rem; border: 2px solid var(--border); border-radius: 8px; font-size: 1rem; outline: none; }
.search-box input:focus { border-color: var(--primary); }

/* Grid Layouts */
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.popular-section, .directory-section { margin-top: 3rem; }
.popular-section h2, .directory-section h2 { font-size: 1.4rem; font-weight: 800; }
.count-pill { background: #e0e7ff; color: var(--primary); font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }

/* Cards & Icons */
.calc-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; text-decoration: none; color: inherit; display: block; transition: all 0.2s ease; }
.calc-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.calc-icon svg { width: 24px; height: 24px; }
.calc-card h3 { font-size: 1.05rem; font-weight: 700; }
.calc-card h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-main); }
.calc-card p { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.35rem; }
.tool-sub { font-size: 0.75rem !important; color: var(--text-muted); line-height: 1.3; }
.item-inner { display: flex; gap: 10px; align-items: flex-start; }
.tool-mini-icon svg { width: 20px; height: 20px; margin-top: 2px; }

.badge { display: inline-block; background: #e0e7ff; color: var(--primary); font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }

/* Category Group */
.cat-group { margin-top: 2.5rem; }
.cat-header { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; margin-bottom: 1rem; }
.cat-icon-lg svg { width: 32px; height: 32px; color: var(--primary); }
.cat-meta h3 { font-size: 1.15rem; font-weight: 700; }
.cat-meta h3 a { color: var(--text-main); text-decoration: none; }
.cat-meta h3 a:hover { color: var(--primary); }
.cat-subtitle { font-size: 0.8rem; color: var(--text-muted); }
.count-badge { margin-left: auto; background: #e2e8f0; font-size: 0.75rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; }

/* Calculator View Layout */
.calc-page-layout { padding: 2rem 1rem; }
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.calc-page-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 1.5rem; }
.calc-header-icon svg { width: 42px; height: 42px; color: var(--primary); padding: 8px; background: #e0e7ff; border-radius: 8px; }
.calc-page-header h1 { font-size: 1.85rem; font-weight: 800; line-height: 1.25; }
.calc-page-header .intro { font-size: 0.95rem; color: var(--text-muted); margin-top: 0.35rem; }

.content-columns { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 992px) {
    .content-columns { grid-template-columns: 2fr 1fr; }
}

.calculator-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1.75rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin: 1.5rem 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.35rem; }
.form-group input, .form-group select { width: 100%; padding: 0.65rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; }

.result-display { background: #0f172a; color: #fff; padding: 1.25rem; border-radius: 8px; margin-top: 1rem; }
.result-label { font-size: 0.75rem; text-transform: uppercase; color: #94a3b8; }
.result-value { font-size: 2.25rem; font-weight: 800; color: #34d399; margin: 0.25rem 0; word-break: break-word; }
.result-breakdown { font-size: 0.85rem; color: #cbd5e1; margin-top: 0.35rem; }
.step-breakdown { margin-top: 1rem; padding: 0.75rem; background: #f1f5f9; border-radius: 6px; font-family: monospace; font-size: 0.8rem; }

/* Ads Layout Shift Prevention */
.ad-slot-wrapper { min-height: 280px; min-width: 336px; background: #f1f5f9; border: 1px dashed #cbd5e1; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 2rem 0; }
.ad-sticky { position: sticky; top: 80px; min-height: 600px; background: #f1f5f9; border: 1px dashed #cbd5e1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ad-caption { font-size: 0.65rem; color: #94a3b8; margin-bottom: 4px; }

/* Editorial Styles */
.editorial-section h2 { font-size: 1.4rem; margin: 1.75rem 0 0.75rem; }
.formula-box, .example-box { background: #fff; border: 1px solid var(--border); padding: 1.25rem; border-radius: 8px; margin: 1rem 0; }
.formula-box code { display: block; background: #f1f5f9; padding: 0.5rem; border-radius: 4px; margin-bottom: 0.75rem; font-weight: bold; }
.faq-item { border: 1px solid var(--border); background: #fff; border-radius: 6px; margin-bottom: 0.5rem; padding: 0.75rem 1rem; }
.faq-item summary { font-weight: 600; cursor: pointer; }
.faq-item p { margin-top: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.editorial-author { font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 2rem; }

/* Sidebar */
.sidebar-widget { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; margin-bottom: 1.5rem; }
.sidebar-widget h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.related-list { list-style: none; }
.related-list li { margin-bottom: 0.75rem; }
.related-list a { text-decoration: none; color: var(--text-main); display: flex; align-items: flex-start; gap: 8px; }
.related-list a:hover strong { color: var(--primary); }
.related-list strong { font-size: 0.9rem; display: block; }
.related-list span { display: block; font-size: 0.75rem; color: var(--text-muted); }
.rel-icon svg { width: 18px; height: 18px; margin-top: 2px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: #fff; padding: 2rem 0; margin-top: 4rem; text-align: center; font-size: 0.85rem; color: var(--text-muted); }
