/**
 * ==============================================================================
 * SYNCROMA TOOLS CORE DESIGN SYSTEM (syncroma-tools-core.css)
 * Universal Scoped Engine for All Calculators & Engineering Tools
 * Strictly scoped to .c-content — NEVER collides with site header or tools hub
 * ==============================================================================
 */

/* 0. UNIVERSAL DESIGN TOKENS FOR CALCULATORS */
:root {
    --bg-surface: #FFFFFF;
    --bg-elevated: #F8FAFC;
    --bg-card: #FFFFFF;
    --border: #E2E8F0;
    --border-subtle: #F1F5F9;
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-light: #EFF6FF;
    --success: #16A34A;
    --warning: #F59E0B;
    --danger: #DC2626;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

html[data-theme="dark"] {
    --bg-surface: #12141A;
    --bg-elevated: #161822;
    --bg-card: #12141A;
    --border: #262B38;
    --border-subtle: #1E222D;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --accent: #38BDF8;
    --accent-hover: #60A5FA;
    --accent-light: rgba(56, 189, 248, 0.12);
    --success: #22C55E;
    --warning: #FBBF24;
    --danger: #F87171;
}

/* 1. DYNAMICALLY HIDE GHOST PAGE HEADER ON ALL TOOL PAGES (BULLETPROOF ACROSS ALL BROWSERS) */
article[class*="tag-hash-tool"] .c-post__header,
article[class*="tag-hash-tool-cat-"] .c-post__header,
.tag-hash-tool-es .c-post__header,
.tag-hash-tool-en .c-post__header,
.tag-hash-tool-cat-tech .c-post__header,
.tag-hash-tool-cat-energy .c-post__header,
.tag-hash-tool-cat-finance .c-post__header,
.tag-hash-tool-cat-utils .c-post__header,
.c-post-article:has(.sc-hero) .c-post__header,
.c-post-article:has([id*="-calc"]) .c-post__header,
.c-post:has(.c-content header) > .c-post__header,
.c-post:has(.sc-hero) > .c-post__header,
.c-post:has(header.sc-hero) > .c-post__header,
.c-post:has(.c-content > header) > .c-post__header,
.c-post:has(.c-content > .sc-tool-root > header) > .c-post__header,
.c-post:has(.c-content > [id$="-calc"] > header) > .c-post__header,
.c-post:has(.c-content > [id*="-calc"] > header) > .c-post__header {
    display: none !important;
}

/* 2. BASE WRAPPER FOR ALL EMBEDDED CALCULATORS */
.c-content > .sc-tool-root,
.c-content > .syncroma-calc-container,
.c-content > #syncroma-calc-wrap,
.c-content > [id$="-calc"],
.c-content > [id*="-calc"],
.c-content > [class*="calc-wrap"],
.c-content > [class*="-tool-wrapper"],
.c-content > [class*="sync-tool-wrap"] {
    max-width: 920px;
    margin: 0 auto 36px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    box-sizing: border-box;
}

/* 3. HERO CARD INSIDE CALCULATOR (DARK BLUE IN BOTH MODES) */
.c-content > .sc-tool-root > header,
.c-content > .syncroma-calc-container > header,
.c-content > [id$="-calc"] > header,
.c-content > [id*="-calc"] > header,
.c-content .sc-hero {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%) !important;
    color: #FFFFFF !important;
    padding: 36px 30px !important;
    border-radius: 16px !important;
    margin-bottom: 28px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25) !important;
    box-sizing: border-box !important;
}

.c-content > .sc-tool-root > header h1,
.c-content > .syncroma-calc-container > header h1,
.c-content > [id$="-calc"] > header h1,
.c-content > [id*="-calc"] > header h1,
.c-content .sc-hero h1 {
    font-size: 28px !important;
    font-weight: 800 !important;
    color: #FFFFFF !important;
    margin: 0 0 12px 0 !important;
    line-height: 1.25 !important;
}

.c-content > .sc-tool-root > header p,
.c-content > .syncroma-calc-container > header p,
.c-content > [id$="-calc"] > header p,
.c-content > [id*="-calc"] > header p,
.c-content .sc-hero p {
    font-size: 15px !important;
    color: #CBD5E1 !important;
    margin: 0 0 16px 0 !important;
    line-height: 1.5 !important;
}

.c-content > .sc-tool-root > header a,
.c-content > .syncroma-calc-container > header a,
.c-content > [id$="-calc"] > header a,
.c-content > [id*="-calc"] > header a,
.c-content .sc-hero a {
    color: #60A5FA !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

/* 4. KPI DASHBOARD CONTAINER (DARK BY DESIGN IN BOTH MODES) */
.c-content div[style*="background: #0f172a"],
.c-content div[style*="background:#0f172a"],
.c-content .sc-kpi-dark {
    background: #0F172A !important;
    border: 1px solid #1E293B !important;
    border-radius: 12px !important;
    padding: 22px !important;
    color: #FFFFFF !important;
    margin-bottom: 24px !important;
    box-sizing: border-box !important;
}

.c-content div[style*="background: #0f172a"] div[style*="background: rgba(255, 255, 255"],
.c-content div[style*="background:#0f172a"] div[style*="background: rgba(255, 255, 255"],
.c-content .sc-kpi-dark div[style*="background: rgba(255, 255, 255"] {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}

.c-content div[style*="background: #0f172a"] div[style*="color: #cbd5e1"],
.c-content div[style*="background:#0f172a"] div[style*="color: #cbd5e1"],
.c-content div[style*="background: #0f172a"] div[style*="color: #94a3b8"],
.c-content div[style*="background:#0f172a"] div[style*="color: #94a3b8"],
.c-content .sc-kpi-dark div[style*="color: #cbd5e1"],
.c-content .sc-kpi-dark div[style*="color: #94a3b8"] {
    color: #CBD5E1 !important;
}

/* 5. INTERACTIVE CARDS & FORMS IN LIGHT MODE */
html[data-theme="light"] .c-content div[style*="background: #ffffff"],
html[data-theme="light"] .c-content div[style*="background:#ffffff"],
html[data-theme="light"] .c-content section[style*="background: #ffffff"],
html[data-theme="light"] .c-content section[style*="background:#ffffff"],
html[data-theme="light"] .c-content .sc-tool-card,
html[data-theme="light"] .c-content .calc-wrap {
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 16px !important;
    color: #1E293B !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    box-sizing: border-box !important;
}

html[data-theme="light"] .c-content label {
    color: #0F172A !important;
}

html[data-theme="light"] .c-content input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
html[data-theme="light"] .c-content select {
    background: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    color: #0F172A !important;
}

html[data-theme="light"] .c-content button[style*="background: #f1f5f9"],
html[data-theme="light"] .c-content .calc-btn {
    background: #F1F5F9 !important;
    border: 1px solid #CBD5E1 !important;
    color: #334155 !important;
}

/* 6. INTERACTIVE CARDS & FORMS IN DARK MODE */
html[data-theme="dark"] .c-content div[style*="background: #ffffff"],
html[data-theme="dark"] .c-content div[style*="background:#ffffff"],
html[data-theme="dark"] .c-content div[style*="background: white"],
html[data-theme="dark"] .c-content section[style*="background: #ffffff"],
html[data-theme="dark"] .c-content section[style*="background:#ffffff"],
html[data-theme="dark"] .c-content section[style*="background: white"],
html[data-theme="dark"] .c-content .sc-tool-card,
html[data-theme="dark"] .c-content .calc-wrap {
    background: #12141A !important;
    border: 1px solid #262B38 !important;
    border-radius: 16px !important;
    color: #E2E8F0 !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35) !important;
    box-sizing: border-box !important;
}

/* All inner boxes with light backgrounds switch to dark surface in dark mode */
html[data-theme="dark"] .c-content div[style*="background: #f8fafc"],
html[data-theme="dark"] .c-content div[style*="background:#f8fafc"],
html[data-theme="dark"] .c-content div[style*="background: #f1f5f9"],
html[data-theme="dark"] .c-content div[style*="background:#f1f5f9"],
html[data-theme="dark"] .c-content .calc-kpi,
html[data-theme="dark"] .c-content [id^="sc-port-"] {
    background: #161822 !important;
    border-color: #2D3344 !important;
    color: #CBD5E1 !important;
}

/* Dark mode text contrast overrides for ALL elements */
html[data-theme="dark"] .c-content h2,
html[data-theme="dark"] .c-content h3,
html[data-theme="dark"] .c-content h4,
html[data-theme="dark"] .c-content label,
html[data-theme="dark"] .c-content [style*="color: #0f172a"],
html[data-theme="dark"] .c-content [style*="color:#0f172a"],
html[data-theme="dark"] .c-content [style*="color: #111827"],
html[data-theme="dark"] .c-content [style*="color:#111827"] {
    color: #F8FAFC !important;
}

html[data-theme="dark"] .c-content [style*="color: #1e293b"],
html[data-theme="dark"] .c-content [style*="color:#1e293b"],
html[data-theme="dark"] .c-content [style*="color: #334155"],
html[data-theme="dark"] .c-content [style*="color:#334155"] {
    color: #E2E8F0 !important;
}

html[data-theme="dark"] .c-content [style*="color: #64748b"],
html[data-theme="dark"] .c-content [style*="color:#64748b"],
html[data-theme="dark"] .c-content [style*="color: #475569"],
html[data-theme="dark"] .c-content [style*="color:#475569"] {
    color: #94A3B8 !important;
}

/* Form controls in dark mode */
html[data-theme="dark"] .c-content input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
html[data-theme="dark"] .c-content select {
    background: #161822 !important;
    border: 1px solid #2D3344 !important;
    color: #F8FAFC !important;
}

html[data-theme="dark"] .c-content select option {
    background: #161822 !important;
    color: #F8FAFC !important;
}

html[data-theme="dark"] .c-content button[style*="background: #f1f5f9"],
html[data-theme="dark"] .c-content .calc-btn {
    background: #1A1D28 !important;
    border: 1px solid #2D3344 !important;
    color: #E2E8F0 !important;
}

html[data-theme="dark"] .c-content button[style*="background: #f1f5f9"]:hover,
html[data-theme="dark"] .c-content .calc-btn:hover {
    background: #F06A57 !important;
    border-color: #F06A57 !important;
    color: #FFFFFF !important;
}

/* 7. COMPARISON TABLES IN DARK MODE */
html[data-theme="dark"] .c-content table {
    border-color: #262B38 !important;
    background: #12141A !important;
}

html[data-theme="dark"] .c-content thead tr,
html[data-theme="dark"] .c-content thead tr[style*="background"] {
    background: #1A1E29 !important;
    border-bottom: 2px solid #262B38 !important;
}

html[data-theme="dark"] .c-content thead th {
    background: #1A1E29 !important;
    color: #F8FAFC !important;
    border-bottom: 2px solid #262B38 !important;
}

html[data-theme="dark"] .c-content tbody tr,
html[data-theme="dark"] .c-content tbody tr[style*="border-bottom"] {
    background: #12141A !important;
    border-bottom-color: #262B38 !important;
}

html[data-theme="dark"] .c-content tbody tr:nth-child(even) {
    background: #161822 !important;
}

html[data-theme="dark"] .c-content tbody td {
    color: #E2E8F0 !important;
    border-bottom-color: #262B38 !important;
}

/* Force light cells in table body to switch to dark mode */
html[data-theme="dark"] .c-content tbody td[style*="background: #f8fafc"],
html[data-theme="dark"] .c-content tbody td[style*="background:#f8fafc"],
html[data-theme="dark"] .c-content tbody td[style*="background: #ffffff"],
html[data-theme="dark"] .c-content tbody td[style*="background:#ffffff"] {
    background: #161822 !important;
    color: #F8FAFC !important;
}

html[data-theme="dark"] .c-content tbody td strong {
    color: #F8FAFC !important;
}

html[data-theme="dark"] .c-content tbody td strong[style*="color: #2563eb"] {
    color: #60A5FA !important;
}

html[data-theme="dark"] .c-content tbody td strong[style*="color: #059669"] {
    color: #34D399 !important;
}

html[data-theme="dark"] .c-content tbody td strong[style*="color: #dc2626"] {
    color: #F87171 !important;
}

/* 8. AMBER DIAGNOSTIC & NOTICE ALERT BOXES */
#sc-alert-box,
.sc-alert-box {
    border-radius: 8px !important;
    padding: 16px 20px !important;
    margin-bottom: 24px !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    box-sizing: border-box !important;
}

html[data-theme="light"] #sc-alert-box,
html[data-theme="light"] .sc-alert-box,
html[data-theme="light"] .c-content div[style*="background: rgb(255, 251, 235)"],
html[data-theme="light"] .c-content div[style*="background: #fffbeb"] {
    background: #FEF3C7 !important;
    border-left: 6px solid #F59E0B !important;
    color: #92400E !important;
}

html[data-theme="dark"] #sc-alert-box,
html[data-theme="dark"] .sc-alert-box,
html[data-theme="dark"] .c-content div[style*="background: rgb(255, 251, 235)"],
html[data-theme="dark"] .c-content div[style*="background: #fffbeb"] {
    background: rgba(245, 158, 11, 0.12) !important;
    border-left: 6px solid #F59E0B !important;
    color: #FDE68A !important;
}

/* 9. FAQ ACCORDIONS & ENGINEERING NOTES */
html[data-theme="dark"] .c-content details,
html[data-theme="dark"] .c-content .sc-faq-card {
    background: #161822 !important;
    border-color: #262B38 !important;
    color: #E2E8F0 !important;
}

html[data-theme="dark"] .c-content summary,
html[data-theme="dark"] .c-content .sc-faq-card h3 {
    color: #F8FAFC !important;
}
