/* tools/css/tools.css
   Shared stylesheet for the HealthGyanHub Tools section (/tools/).
   Built on the same design tokens as css/style.css (used by the 34 health
   calculators) so the tools feel native to the site, but kept as its own
   file and its own URL path so this section's topical signals (finance,
   date/time, math/utility) stay separate from the health/fitness content
   in /calculators/. Do not link this file from /calculators/ pages. */

:root {
    --primary: #10b981;
    --secondary: #3b82f6;
    --accent: #f59e0b;
    --danger: #ef4444;
    --bg: #ffffff;
    --card-bg: #f0fdf4;
    --text: #1e293b;
    --muted: #64748b;
    --border: #d1d5db;
    --shadow: 0 20px 40px -15px rgba(16,185,129,0.15);
    --radius-card: 24px;
    --radius-btn: 16px;
    --font-size-base: clamp(1rem, 2.5vw, 1.125rem);
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: var(--font-size-base);
    line-height: 1.6;
    padding: 1rem;
}

a { color: inherit; }
:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }

/* ── Header / nav ───────────────────────────────────────── */
header { background: var(--bg); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 1000; }
.nav { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.nav-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.nav-container > a { font-size: clamp(1.1rem, 3vw, 1.4rem); font-weight: 700; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 0.5rem; }
.nav-tag { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; background: var(--card-bg); color: var(--primary); padding: 0.15rem 0.5rem; border-radius: 999px; }
.nav ul { display: flex; list-style: none; gap: 1rem; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--text); font-size: clamp(0.875rem, 2vw, 1rem); }
.nav ul a:hover { color: var(--primary); }

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb { max-width: 800px; margin: 0.75rem auto 0; padding: 0 1rem; font-size: 0.85rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }

/* ── Hero ───────────────────────────────────────────────── */
.calculator-hero { text-align: center; padding: 2rem 1rem 1rem; max-width: 800px; margin: 0 auto; }
.calculator-hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); color: var(--primary); margin-bottom: 0.5rem; }
.calculator-hero p { color: var(--muted); font-size: 1rem; }

/* ── Form ───────────────────────────────────────────────── */
.form-section { background: var(--card-bg); padding: 2rem; border-radius: var(--radius-card); box-shadow: var(--shadow); max-width: 600px; margin: 2rem auto; }
.form-group { margin-bottom: 1.5rem; }
.form-group:last-child { margin-bottom: 0; }
label { display: block; margin-bottom: 0.5rem; font-weight: bold; }
.field-hint { font-weight: normal; color: var(--muted); font-size: 0.85rem; margin-left: 0.35rem; }
input, select { width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; background: #fff; color: var(--text); }
input:focus, select:focus { border-color: var(--primary); }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 0.35rem; display: none; }
.form-group.has-error input { border-color: var(--danger); }
.form-group.has-error .error-msg { display: block; }

.unit-toggle, .toggle { display: flex; gap: 1rem; margin-top: 0.5rem; flex-wrap: wrap; }
.unit-toggle label, .toggle label { font-weight: normal; display: flex; align-items: center; gap: 0.35rem; }
.toggle input[type="radio"], .unit-toggle input[type="radio"] { width: auto; }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .input-row { grid-template-columns: 1fr; } }

button { font-family: inherit; }
.btn-primary, .form-section button[type="submit"] {
    width: 100%; background: var(--primary); color: #fff; border: none;
    padding: 0.9rem 1.5rem; border-radius: var(--radius-btn); font-size: 1rem;
    font-weight: 600; cursor: pointer; min-height: 48px;
}
.btn-primary:hover, .form-section button[type="submit"]:hover { filter: brightness(0.95); }
.btn-secondary, .form-section button[type="button"] {
    width: 100%; background: #94a3b8; color: #fff; border: none;
    padding: 0.9rem 1.5rem; border-radius: var(--radius-btn); font-size: 1rem;
    font-weight: 600; cursor: pointer; margin-top: 0.5rem; min-height: 48px;
}

/* ── Results ────────────────────────────────────────────── */
.results { background: var(--card-bg); padding: 2rem; border-radius: var(--radius-card); box-shadow: var(--shadow); margin: 2rem auto; max-width: 700px; text-align: center; }
.results h2 { color: var(--primary); font-size: clamp(1.4rem, 4vw, 1.9rem); }
.fine-print { color: var(--muted); font-size: 0.85rem; margin-top: 0.35rem; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin: 1.25rem 0; text-align: left; }
.metric-box { background: #fff; border-radius: 14px; padding: 0.9rem 1rem; box-shadow: 0 4px 14px -6px rgba(0,0,0,0.12); }
.metric-box .metric-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.metric-box .metric-value { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-top: 0.2rem; }
.metric-box.accent .metric-value { color: var(--primary); }

.split-bar { display: flex; height: 22px; border-radius: 999px; overflow: hidden; margin: 1rem 0 0.4rem; }
.split-bar span { display: block; height: 100%; }
.split-bar .seg-principal { background: var(--primary); }
.split-bar .seg-interest { background: var(--accent); }
.split-legend { display: flex; justify-content: center; gap: 1.25rem; font-size: 0.85rem; color: var(--muted); flex-wrap: wrap; }
.split-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.4rem; vertical-align: middle; }
.split-legend .lg-principal::before { background: var(--primary); }
.split-legend .lg-interest::before { background: var(--accent); }

.tip-box { background: #fff; border-left: 4px solid var(--accent); border-radius: 8px; padding: 0.85rem 1rem; margin: 1rem 0; text-align: left; font-size: 0.92rem; }
.formula-box { background: #0f172a; color: #e2e8f0; font-family: 'Courier New', monospace; padding: 1rem 1.25rem; border-radius: 12px; margin: 1rem 0; overflow-x: auto; font-size: 0.92rem; }

.action-row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; margin-top: 1.25rem; }
.action-btn { background: var(--secondary); color: #fff; border: none; padding: 0.65rem 1.1rem; border-radius: var(--radius-btn); cursor: pointer; font-size: 0.9rem; min-height: 44px; display: inline-flex; align-items: center; gap: 0.4rem; }
.action-btn.alt { background: var(--primary); }
.action-btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }

.feedback-widget { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(0,0,0,0.08); }
.feedback-widget p { margin-bottom: 0.5rem; color: var(--muted); font-size: 0.9rem; }
.fb-btns { display: flex; gap: 0.6rem; justify-content: center; }
.fb-btns button { background: #fff; border: 1px solid var(--border); padding: 0.5rem 1rem; border-radius: var(--radius-btn); cursor: pointer; min-height: 44px; }
.fb-btns button.selected { background: var(--card-bg); border-color: var(--primary); color: var(--primary); }
.feedback-thanks { display: none; margin-top: 0.5rem; color: var(--primary); font-size: 0.9rem; }

/* ── Amortization / data table ─────────────────────────────*/
.data-table-wrap { overflow-x: auto; margin: 1rem 0; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 480px; }
table.data-table th, table.data-table td { padding: 0.55rem 0.7rem; text-align: right; border-bottom: 1px solid #e2e8f0; }
table.data-table th:first-child, table.data-table td:first-child { text-align: left; }
table.data-table th { background: var(--card-bg); color: var(--text); font-weight: 700; }
table.data-table tbody tr:hover { background: #f8fafc; }

/* ── Content section ────────────────────────────────────── */
.content-section { max-width: 800px; margin: 2rem auto; padding: 1rem; }
.content-section h2 { color: var(--primary); margin: 1.75rem 0 0.75rem; font-size: clamp(1.2rem, 3vw, 1.5rem); }
.content-section h2:first-of-type { margin-top: 0; }
.content-section p { margin-bottom: 0.85rem; }
.content-section ul, .content-section ol { margin: 0 0 0.85rem 1.4rem; }
.content-section li { margin-bottom: 0.4rem; }

.toc { background: var(--card-bg); border-radius: var(--radius-card); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.toc summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.toc ul { margin: 0.75rem 0 0 1.2rem; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--primary); }

.faq { background: var(--card-bg); border-radius: var(--radius-card); padding: 0.5rem 1.25rem; }
.faq details { padding: 0.75rem 0; border-bottom: 1px solid rgba(0,0,0,0.08); }
.faq details:last-child { border-bottom: none; }
.faq summary { cursor: pointer; font-weight: 700; color: var(--secondary); }
.faq p { margin: 0.6rem 0 0.2rem; }

.ref-list { color: var(--muted); font-size: 0.9rem; }

.related { display: grid; grid-template-columns: 1fr; gap: 0.85rem; }
@media (min-width: 480px) { .related { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
.related-card { background: var(--card-bg); padding: 1rem 1.1rem; border-radius: var(--radius-card); text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 0.6rem; font-weight: 600; }
.related-card i { color: var(--primary); font-size: 1.1rem; }
.related-card:hover { background: #e6faf1; }

.disclaimer-box { background: #fff8ec; border: 1px solid #fde5b8; border-radius: 12px; padding: 1rem 1.25rem; font-size: 0.9rem; color: var(--text); }

/* ── Footer ─────────────────────────────────────────────── */
footer.site-footer { text-align: center; padding: 2rem 1rem; background: var(--card-bg); margin-top: 2rem; color: var(--muted); font-size: 0.85rem; border-radius: var(--radius-card); }
footer.site-footer a { color: var(--primary); }

/* ── Directory / hub page (tools/index.html) ───────────────*/
.tools-intro { max-width: 800px; margin: 0 auto 1.5rem; text-align: center; padding: 0 1rem; color: var(--muted); }
.tool-category { max-width: 1100px; margin: 0 auto 2.5rem; padding: 0 1rem; }
.tool-category h2 { color: var(--text); font-size: 1.4rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.tool-category h2 i { color: var(--primary); }
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 560px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-card { background: var(--card-bg); border-radius: var(--radius-card); padding: 1.25rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform 0.2s; display: flex; flex-direction: column; gap: 0.35rem; }
.tool-card:hover { transform: translateY(-3px); }
.tool-card i { font-size: 1.6rem; color: var(--primary); }
.tool-card h3 { font-size: 1.05rem; }
.tool-card p { font-size: 0.85rem; color: var(--muted); }

/* ── Responsive ─────────────────────────────────────────── */
@media (min-width: 768px) {
    body { padding: 2rem; padding-top: 0; }
    .nav-container { padding: 0 1rem; }
    .form-section, .results { padding: 2.5rem; }
}
@media (min-width: 1440px) { .nav-container { max-width: 1200px; margin: 0 auto; } }

button, input[type="submit"] { min-height: 48px; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
