/* ============================================
   CalcHub — Shared Stylesheet
   ============================================ */

/* Local Inter font — no network request, instant load */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-v20-latin-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-v20-latin-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-v20-latin-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-v20-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-v20-latin-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --financial: #2563EB;
  --financial-light: #EFF6FF;
  --financial-mid: #DBEAFE;
  --fitness: #059669;
  --fitness-light: #ECFDF5;
  --fitness-mid: #D1FAE5;
  --math: #7C3AED;
  --math-light: #F5F3FF;
  --math-mid: #EDE9FE;
  --others: #D97706;
  --others-light: #FFFBEB;
  --others-mid: #FEF3C7;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --transition: 0.18s ease;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ---- HEADER / NAV ---- */
.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); }
.nav-container { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 24px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; color: var(--text); flex-shrink: 0; }
.logo-icon { width: 32px; height: 32px; background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-size: 15px; font-weight: 900; }
.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-links a { padding: 6px 13px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--text-2); transition: all var(--transition); white-space: nowrap; }
.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-links a.nav-financial:hover,.nav-links a.nav-financial.active { color: var(--financial); background: var(--financial-light); }
.nav-links a.nav-fitness:hover,.nav-links a.nav-fitness.active { color: var(--fitness); background: var(--fitness-light); }
.nav-links a.nav-math:hover,.nav-links a.nav-math.active { color: var(--math); background: var(--math-light); }
.nav-links a.nav-others:hover,.nav-links a.nav-others.active { color: var(--others); background: var(--others-light); }
.nav-search { position: relative; }
.nav-search::before { content: '🔍'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; pointer-events: none; z-index: 1; }
.nav-search input { height: 36px; width: 210px; border: 1.5px solid var(--border); border-radius: 20px; padding: 0 16px 0 34px; font-size: 13px; font-family: var(--font); background: var(--bg); color: var(--text); transition: all var(--transition); outline: none; }
.nav-search input:focus { border-color: #93C5FD; background: #fff; width: 250px; }

/* ---- HERO ---- */
.hero { text-align: center; padding: 70px 24px 52px; background: linear-gradient(160deg, #EFF6FF 0%, #F5F3FF 55%, #ECFDF5 100%); border-bottom: 1px solid var(--border); }
.hero h1 { font-size: clamp(28px, 5vw, 48px); font-weight: 800; letter-spacing: -1.5px; line-height: 1.13; margin-bottom: 14px; }
.hero h1 span { background: linear-gradient(135deg, #2563EB, #7C3AED); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { font-size: 17px; color: var(--text-2); max-width: 500px; margin: 0 auto 32px; line-height: 1.65; }
.hero-search { display: flex; justify-content: center; max-width: 480px; margin: 0 auto; position: relative; }
.hero-search::before { content: '🔍'; position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 16px; z-index: 1; }
.hero-search input { width: 100%; height: 52px; border: 2px solid var(--border); border-radius: 14px; padding: 0 20px 0 50px; font-size: 16px; font-family: var(--font); outline: none; background: #fff; transition: all var(--transition); box-shadow: var(--shadow-md); }
.hero-search input:focus { border-color: #2563EB; }
.hero-stats { display: flex; justify-content: center; gap: 36px; margin-top: 28px; }
.stat { text-align: center; }
.stat-num { font-size: 22px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; }

/* ---- MAIN LAYOUT ---- */
.main-container { max-width: 1240px; margin: 0 auto; padding: 44px 24px 60px; }
.section-wrap { margin-bottom: 48px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid var(--border); }
.section-title { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.section-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.see-all { font-size: 13px; font-weight: 600; padding: 6px 16px; border-radius: 20px; transition: all var(--transition); }

/* Category color theming */
.cat-financial .section-icon { background: var(--financial-light); }
.cat-financial .section-title { color: var(--financial); }
.cat-financial .see-all { color: var(--financial); background: var(--financial-light); }
.cat-financial .see-all:hover { background: var(--financial); color: #fff; }
.cat-financial .calc-card:hover { border-color: var(--financial); }
.cat-financial .calc-card-icon { background: var(--financial-light); }

.cat-fitness .section-icon { background: var(--fitness-light); }
.cat-fitness .section-title { color: var(--fitness); }
.cat-fitness .see-all { color: var(--fitness); background: var(--fitness-light); }
.cat-fitness .see-all:hover { background: var(--fitness); color: #fff; }
.cat-fitness .calc-card:hover { border-color: var(--fitness); }
.cat-fitness .calc-card-icon { background: var(--fitness-light); }

.cat-math .section-icon { background: var(--math-light); }
.cat-math .section-title { color: var(--math); }
.cat-math .see-all { color: var(--math); background: var(--math-light); }
.cat-math .see-all:hover { background: var(--math); color: #fff; }
.cat-math .calc-card:hover { border-color: var(--math); }
.cat-math .calc-card-icon { background: var(--math-light); }

.cat-others .section-icon { background: var(--others-light); }
.cat-others .section-title { color: var(--others); }
.cat-others .see-all { color: var(--others); background: var(--others-light); }
.cat-others .see-all:hover { background: var(--others); color: #fff; }
.cat-others .calc-card:hover { border-color: var(--others); }
.cat-others .calc-card-icon { background: var(--others-light); }

/* ---- CALC CARDS ---- */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 14px; }
.calc-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 6px; transition: all var(--transition); cursor: pointer; color: inherit; position: relative; }
.calc-card:hover { border-color: transparent; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.calc-card-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 4px; }
.calc-card-title { font-size: 14px; font-weight: 700; line-height: 1.3; }
.calc-card-desc { font-size: 12px; color: var(--text-2); line-height: 1.45; }

/* ---- CATEGORY PAGE HERO ---- */
.cat-hero { padding: 48px 24px 36px; border-bottom: 1px solid var(--border); }
.cat-hero.financial { background: linear-gradient(135deg, var(--financial-light), var(--financial-mid)); }
.cat-hero.fitness { background: linear-gradient(135deg, var(--fitness-light), var(--fitness-mid)); }
.cat-hero.math { background: linear-gradient(135deg, var(--math-light), var(--math-mid)); }
.cat-hero.others { background: linear-gradient(135deg, var(--others-light), var(--others-mid)); }
.cat-hero-inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 20px; }
.cat-hero-icon { width: 68px; height: 68px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 32px; background: #fff; box-shadow: var(--shadow-md); flex-shrink: 0; }
.cat-hero h1 { font-size: 30px; font-weight: 800; margin-bottom: 6px; }
.cat-hero p { color: var(--text-2); font-size: 15px; }
.cat-main { max-width: 1240px; margin: 0 auto; padding: 36px 24px 60px; }
.cat-main .calc-grid { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; }

/* ---- BREADCRUMB ---- */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); max-width: 1240px; margin: 0 auto; padding: 14px 24px 0; }
.breadcrumb a { color: var(--text-2); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.breadcrumb .sep { color: var(--border); font-size: 16px; }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ---- CALC PAGE LAYOUT ---- */
.calc-page { max-width: 1240px; margin: 0 auto; padding: 20px 24px 60px; display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: start; }
.calc-main { min-width: 0; }
.calc-page-header { margin-bottom: 22px; }
.calc-page-header h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.calc-page-header p { color: var(--text-2); font-size: 15px; }

/* ---- CALC BOX ---- */
.calc-box { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 28px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.calc-box h2 { font-size: 16px; font-weight: 700; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; font-size: 12px; }

/* ---- FORM ELEMENTS ---- */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
input[type="number"],input[type="text"],input[type="date"],select,textarea { width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 0 14px; font-size: 15px; font-family: var(--font); color: var(--text); background: #fff; transition: border-color var(--transition); outline: none; }
input[type="number"],input[type="text"],input[type="date"],select { height: 44px; }
textarea { padding: 12px 14px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: #2563EB; }
.input-wrap { position: relative; }
.input-prefix { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 15px; pointer-events: none; }
.input-suffix-label { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; font-weight: 600; pointer-events: none; }
.input-wrap input { }
.input-wrap.has-prefix input { padding-left: 28px; }
.input-wrap.has-suffix input { padding-right: 40px; }
.seg-control { display: flex; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; margin-bottom: 18px; }
.seg-control button { flex: 1; height: 36px; border: none; background: transparent; border-radius: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all var(--transition); font-family: var(--font); }
.seg-control button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.checkbox-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; accent-color: #2563EB; }
input[type="range"] { width: 100%; height: 5px; -webkit-appearance: none; background: var(--border); border-radius: 3px; outline: none; cursor: pointer; padding: 0; border: none; height: 5px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; background: #2563EB; border-radius: 50%; box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 5px; }

/* ---- BUTTONS ---- */
.calc-btn { width: 100%; height: 48px; border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700; color: #fff; cursor: pointer; transition: all var(--transition); font-family: var(--font); margin-top: 8px; background: linear-gradient(135deg, #2563EB, #7C3AED); letter-spacing: 0.2px; }
.calc-btn:hover { opacity: 0.91; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.calc-btn:active { transform: translateY(0); }
.calc-btn.financial { background: linear-gradient(135deg, #1D4ED8, #2563EB); }
.calc-btn.fitness { background: linear-gradient(135deg, #047857, #059669); }
.calc-btn.math { background: linear-gradient(135deg, #6D28D9, #7C3AED); }
.calc-btn.others { background: linear-gradient(135deg, #B45309, #D97706); }
.btn-secondary { background: var(--bg); color: var(--text-2); border: 1.5px solid var(--border); height: 40px; padding: 0 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font); transition: all var(--transition); }
.btn-secondary:hover { background: var(--border); }

/* ---- RESULT BOX ---- */
.result-box { background: linear-gradient(135deg, #F0F9FF 0%, #F5F3FF 100%); border: 1.5px solid #C7D7FD; border-radius: var(--radius-lg); padding: 24px; display: none; margin-top: 20px; }
.result-box.show { display: block; animation: fadeSlide .3s ease; }
@keyframes fadeSlide { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
.result-main { margin-bottom: 20px; }
.result-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); margin-bottom: 4px; }
.result-value { font-size: 38px; font-weight: 800; color: #2563EB; letter-spacing: -1.5px; line-height: 1; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.result-item { background: rgba(255,255,255,.7); border-radius: var(--radius-sm); padding: 12px 14px; }
.result-item .r-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); margin-bottom: 3px; }
.result-item .r-value { font-size: 18px; font-weight: 700; color: var(--text); }
.result-fitness .result-value { color: var(--fitness); }
.result-math .result-value { color: var(--math); }
.result-others .result-value { color: var(--others); }

/* ---- INFO SECTIONS ---- */
.info-section { margin-bottom: 28px; }
.info-section h2 { font-size: 20px; font-weight: 700; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.info-section h3 { font-size: 15px; font-weight: 700; margin: 18px 0 8px; color: var(--text); }
.info-section p { color: var(--text-2); margin-bottom: 10px; line-height: 1.75; }
.info-section ul { list-style: disc; padding-left: 20px; color: var(--text-2); }
.info-section ul li { margin-bottom: 7px; line-height: 1.65; }
.info-section ol { padding-left: 20px; color: var(--text-2); }
.info-section ol li { margin-bottom: 7px; line-height: 1.65; }
.formula-box { background: var(--math-light); border: 1px solid var(--math-mid); border-left: 4px solid var(--math); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 16px 20px; margin: 12px 0; font-family: var(--font-mono); font-size: 14px; color: var(--math); line-height: 1.8; }

/* ---- FAQ ---- */
.faq-item { border: 1.5px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden; }
.faq-q { padding: 14px 16px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 14px; transition: background var(--transition); gap: 12px; }
.faq-q:hover { background: var(--bg); }
.faq-toggle { font-size: 22px; color: var(--text-3); flex-shrink: 0; line-height: 1; transition: transform var(--transition); }
.faq-item.open .faq-toggle { transform: rotate(45deg); }
.faq-a { display: none; padding: 4px 16px 14px; font-size: 14px; color: var(--text-2); line-height: 1.75; border-top: 1px solid var(--border); }
.faq-item.open .faq-a { display: block; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; }
.table-wrap-scroll { max-height: 320px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { background: var(--bg); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-2); border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #FAFAFA; }

/* ---- SIDEBAR ---- */
.calc-sidebar {}
.sidebar-section { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; }
.sidebar-section h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-2); margin-bottom: 14px; }
.related-list { display: flex; flex-direction: column; gap: 4px; }
.related-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); transition: background var(--transition); font-size: 13px; font-weight: 500; }
.related-link:hover { background: var(--bg); }
.related-link-icon { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

/* ---- SCIENTIFIC CALCULATOR ---- */
.sci-display { background: #0F172A; border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 10px; }
.sci-expr { color: #64748B; font-family: var(--font-mono); font-size: 13px; min-height: 20px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sci-value { color: #fff; font-family: var(--font-mono); font-size: 30px; font-weight: 300; text-align: right; letter-spacing: -0.5px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sci-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sci-btn { height: 46px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--card); font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; font-family: var(--font); transition: all var(--transition); }
.sci-btn:hover { background: var(--bg); border-color: #93C5FD; }
.sci-btn:active { transform: scale(0.95); }
.sci-btn.op { background: var(--financial-light); color: var(--financial); border-color: var(--financial-mid); }
.sci-btn.fn { background: var(--math-light); color: var(--math); border-color: var(--math-mid); font-size: 11px; }
.sci-btn.eq { background: linear-gradient(135deg, #2563EB, #7C3AED); color: white; border: none; font-size: 20px; }
.sci-btn.clear { background: #FEF2F2; color: #EF4444; border-color: #FCA5A5; }
.sci-btn.zero { grid-column: span 2; }

/* ---- PASSWORD GENERATOR ---- */
.pw-output { background: #0F172A; border-radius: var(--radius-sm); padding: 18px 20px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pw-text { font-family: var(--font-mono); font-size: 17px; color: #34D399; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 1px; }
.copy-btn { height: 34px; padding: 0 14px; border: none; border-radius: var(--radius-sm); background: #1E3A5F; color: #93C5FD; font-size: 12px; font-weight: 700; cursor: pointer; transition: all var(--transition); font-family: var(--font); white-space: nowrap; flex-shrink: 0; }
.copy-btn:hover { background: #2563EB; color: #fff; }
.strength-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.strength-fill { height: 100%; border-radius: 3px; transition: all .4s ease; }
.strength-label { font-size: 12px; font-weight: 600; }

/* ---- UNIT CONVERTER ---- */
.converter-row { display: flex; align-items: center; gap: 12px; }
.converter-row input { flex: 1; }
.converter-arrow { font-size: 20px; color: var(--text-3); flex-shrink: 0; }

/* ---- BMI GAUGE ---- */
.bmi-gauge { margin-top: 8px; }
.bmi-bar { height: 12px; border-radius: 6px; background: linear-gradient(to right, #3B82F6 0%, #22C55E 25%, #EAB308 50%, #F97316 75%, #EF4444 100%); position: relative; margin-bottom: 6px; }
.bmi-needle { position: absolute; top: -5px; width: 4px; height: 22px; background: #0F172A; border-radius: 2px; transform: translateX(-50%); transition: left .5s ease; }
.bmi-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); font-weight: 600; }

/* ---- AMORTIZATION ---- */
.amort-wrap { max-height: 280px; overflow-y: auto; }

/* ---- FOOTER ---- */
.site-footer { background: #0F172A; color: #64748B; padding: 48px 24px 28px; margin-top: 60px; }
.footer-inner { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.footer-brand .logo { color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: 13px; line-height: 1.65; max-width: 260px; }
.footer-col h4 { font-size: 12px; font-weight: 700; color: #fff; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.7px; }
.footer-col a { display: block; font-size: 13px; padding: 3px 0; transition: color var(--transition); }
.footer-col a:hover { color: #fff; }
.footer-bottom { max-width: 1240px; margin: 28px auto 0; padding-top: 20px; border-top: 1px solid #1E293B; display: flex; justify-content: space-between; font-size: 12px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .calc-page { grid-template-columns: 1fr; }
  .calc-sidebar { display: none; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .nav-search { display: none; }
  .nav-links a { font-size: 12px; padding: 5px 8px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .result-grid, .result-grid-3 { grid-template-columns: 1fr 1fr; }
  .hero { padding: 44px 20px 36px; }
  .sci-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 520px) {
  .nav-links { display: none; }
  .calc-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; }
}

/* ---- SEARCH HIGHLIGHT ---- */
.hidden { display: none !important; }
.highlight { background: #FEF08A; border-radius: 2px; }

/* ===== ADDITIONAL CALCULATOR STYLES ===== */

/* Unit converter tabs */
.unit-cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.unit-tab { padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 8px; background: white; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--text-2); transition: all 0.15s; }
.unit-tab:hover { border-color: var(--others); color: var(--others); }
.unit-tab.active { background: var(--others); color: white; border-color: var(--others); }

/* Tip calculator quick-select buttons */
.tip-quick-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.tip-quick { flex: 1; min-width: 52px; padding: 9px 8px; border: 1.5px solid var(--border); border-radius: 8px; background: white; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--text-2); transition: all 0.15s; }
.tip-quick:hover { border-color: var(--others); color: var(--others); }
.tip-quick.active { background: var(--others); color: white; border-color: var(--others); }

/* Add row button (GPA / tip split) */
.add-row-btn { display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px 14px; background: var(--bg); border: 1.5px dashed var(--border); border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; transition: all 0.15s; margin-bottom: 4px; }
.add-row-btn:hover { border-color: var(--others); color: var(--others); }

/* result-fitness / math / others as direct class on result-value */
.result-fitness { color: var(--fitness) !important; }
.result-math { color: var(--math) !important; }
.result-others { color: var(--others) !important; }

/* Formula box financial/others variant */
.formula-box.financial { background: var(--financial-light); border-left-color: var(--financial); color: var(--financial); }
.formula-box.others { background: var(--others-light); border-left-color: var(--others); color: var(--others); border-color: #FDE68A; }
.formula-box.fitness { background: var(--fitness-light); border-left-color: var(--fitness); color: var(--fitness); border-color: #A7F3D0; }

/* BMI gauge */
.bmi-gauge { margin: 16px 0 4px; }
.bmi-bar { height: 10px; border-radius: 5px; background: linear-gradient(to right, #3B82F6 0%, #22C55E 25%, #EAB308 50%, #F97316 75%, #EF4444 100%); position: relative; margin-bottom: 6px; }
.bmi-needle { position: absolute; top: -4px; width: 4px; height: 18px; background: #0F172A; border-radius: 2px; transform: translateX(-50%); transition: left 0.4s ease; }
.bmi-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 600; }

/* Responsive adjustments for calc pages */
@media (max-width: 900px) {
  .calc-page { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .calc-page { padding: 16px 16px 48px; }
  .calc-box { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .result-grid-3 { grid-template-columns: 1fr 1fr; }
  .sci-grid { grid-template-columns: repeat(4, 1fr); }
  .tip-quick { min-width: 44px; font-size: 12px; padding: 8px 4px; }
}

/* ============================================================
   PATCH — new class names used in index/category pages
   ============================================================ */

/* Card grid layout */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

/* Card base */
.card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--transition);
  cursor: pointer;
  color: inherit;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--financial));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.card:hover { border-color: transparent; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card:hover::before { transform: scaleX(1); }

/* Card icon */
.card-ico {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 4px;
  background: var(--financial-light);
}

/* Card text — using native h3/p */
.card h3 { font-size: 14px; font-weight: 700; line-height: 1.3; }
.card p  { font-size: 12px; color: var(--text-2); line-height: 1.45; }

/* Card color variants */
.card.financial { --card-accent: var(--financial); }
.card.financial .card-ico { background: var(--financial-light); }
.card.fitness   { --card-accent: var(--fitness); }
.card.fitness   .card-ico { background: var(--fitness-light); }
.card.math      { --card-accent: var(--math); }
.card.math      .card-ico { background: var(--math-light); }
.card.others    { --card-accent: var(--others); }
.card.others    .card-ico { background: var(--others-light); }

/* Stats strip (homepage) */
.stats-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 48px;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-num  { font-size: 26px; font-weight: 800; color: var(--financial); letter-spacing: -0.5px; }
.stat-lbl  { font-size: 12px; color: var(--text-2); font-weight: 500; margin-top: 2px; }

/* Filter tabs (homepage) */
.filter-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tabs-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
}
.filter-tab {
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
  margin-bottom: -1px;
}
.filter-tab:hover { color: var(--text); }
.filter-tab.active { color: var(--financial); border-bottom-color: var(--financial); }

/* Section header row (homepage / category pages) */
.section-hd {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  margin-top: 44px;
}
.section-hd:first-child { margin-top: 0; }
.section-hd .section-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.section-hd h2 { font-size: 18px; font-weight: 800; flex: 1; }
.section-hd a  { font-size: 13px; font-weight: 600; color: var(--financial); }
.section-hd a:hover { text-decoration: underline; }

/* Cat hero badge (new style override) */
.cat-hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
  letter-spacing: 0.4px;
}

/* Category hero (override — make it properly colored + white text) */
.cat-hero {
  padding: 52px 24px;
  text-align: center;
  color: #fff;
}
.cat-hero.financial { background: linear-gradient(135deg, #1e3a8a, #2563EB); }
.cat-hero.fitness   { background: linear-gradient(135deg, #064e3b, #059669); }
.cat-hero.math      { background: linear-gradient(135deg, #3b0764, #7c3aed); }
.cat-hero.others    { background: linear-gradient(135deg, #78350f, #d97706); }
.cat-hero h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 800; letter-spacing: -0.5px; margin-bottom: 10px; }
.cat-hero p  { font-size: 16px; opacity: 0.88; max-width: 480px; margin: 0 auto; }

/* Main content wrapper */
.main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

/* Hero (homepage) */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #4f46e5 100%);
  color: #fff;
  text-align: center;
  padding: 64px 20px 56px;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 12px; font-weight: 700;
  padding: 4px 14px; border-radius: 20px;
  margin-bottom: 18px; letter-spacing: 0.5px;
}
.hero h1 { font-size: clamp(28px, 5vw, 52px); font-weight: 800; letter-spacing: -1.5px; line-height: 1.12; margin-bottom: 16px; }
.hero p  { font-size: 17px; opacity: 0.84; max-width: 520px; margin: 0 auto 32px; line-height: 1.65; }

/* Hero search bar */
.search-wrap { max-width: 540px; margin: 0 auto; position: relative; }
.search-wrap input {
  width: 100%;
  padding: 14px 54px 14px 20px;
  border-radius: 12px; border: none;
  font-size: 15px; font-family: inherit;
  outline: none;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  color: var(--text);
}
.search-btn {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: var(--financial); color: #fff;
  border: none; width: 36px; height: 36px;
  border-radius: 8px; cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* Nav search input */
.nav-search { margin-left: auto; }
.nav-search input {
  height: 34px; padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 13px;
  font-family: inherit; outline: none; width: 180px;
  background: var(--bg);
}
.nav-search input:focus { border-color: var(--financial); }

/* No-results message */
#no-results { padding: 60px 20px; text-align: center; color: var(--text-2); }

/* Responsive fixes */
@media (max-width: 768px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .stats-strip { gap: 24px; padding: 14px 16px; }
  .hero { padding: 48px 16px 40px; }
  .main { padding: 24px 14px 48px; }
  .nav-search { display: none; }
  .cat-hero { padding: 36px 16px; }
}
@media (max-width: 480px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card { padding: 14px 12px 12px; }
  .card h3 { font-size: 13px; }
}

/* Missing variables — aliases and additions */
:root {
  --surface: #FFFFFF;
  --financial-bg: var(--financial-light);
  --fitness-bg:   var(--fitness-light);
  --math-bg:      var(--math-light);
  --others-bg:    var(--others-light);
}

/* ===== Color conflict fixes (override original light-theme rules) ===== */

/* Hero — force white text on dark gradient */
.hero, .hero h1, .hero p, .hero .hero-badge { color: #fff; }
.hero h1 span { -webkit-text-fill-color: unset; background: none; color: #fff; }

/* Cat-hero — force white text */
.cat-hero, .cat-hero h1, .cat-hero p, .cat-hero .cat-hero-badge { color: #fff; }
.cat-hero p { color: rgba(255,255,255,0.88) !important; }

/* Ensure filter tab active uses financial color */
.filter-tab.active { color: var(--financial) !important; border-bottom-color: var(--financial) !important; }
