/*
 * Settlement Tax Calculator -- extracted from
 * /Demand-Letters/Tools/settlement-tax-calculator.html (v35).
 *
 * Everything below was previously inline in two <style> blocks plus 25
 * inline style="" attrs scattered across static markup and dynamic template
 * literals inside calculateTax(). Moving it here:
 *   - drops the HTML by ~10 KB inline CSS
 *   - lets the browser cache the rules across sessions
 *   - keeps the visual identical
 */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-dark: #0f172a;
    --color-dark-mid: #1e293b;
    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;
    --color-border: #e2e8f0;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-family); line-height: 1.6; color: var(--color-text); background: var(--color-bg); }

.nav {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand { color: white; text-decoration: none; font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.nav-links { display: flex; gap: 8px; }
.nav-links a { color: white; text-decoration: none; font-size: 0.85rem; padding: 6px 12px; background: rgba(255,255,255,0.15); border-radius: 6px; }
.nav-links a:hover { background: rgba(255,255,255,0.25); }

.hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #7c2d12 100%);
    color: white;
    padding: 48px 24px;
    text-align: center;
}
.hero h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 12px; }
.hero p { font-size: 1.1rem; color: rgba(255,255,255,0.9); max-width: 700px; margin: 0 auto 20px; }
.hero-badges { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.hero-badge { background: rgba(255,255,255,0.15); padding: 8px 16px; border-radius: 20px; font-size: 0.9rem; }

.main { max-width: 1200px; margin: 0 auto; padding: 40px 24px; }
.calculator-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 900px) { .calculator-grid { grid-template-columns: 450px 1fr; } }

.panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
}
.panel-header {
    background: var(--color-bg);
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-body { padding: 20px; }

.form-section { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--color-border); }
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title { font-size: 0.85rem; font-weight: 600; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 16px; }

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.95rem; }
.form-group input, .form-group select {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-hint { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* v35: classes that replace inline style="" attrs on the noAgreementYet checkbox block */
.stt-pre-signing-row { margin-top: 12px; }
.stt-pre-signing-row label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-weight: 500; }
.stt-pre-signing-row input[type="checkbox"] { width: auto; margin-top: 3px; }
.stt-pre-signing-row .form-hint { margin-top: 4px; }

.calculate-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}
.calculate-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }

.results-placeholder { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }
.results-placeholder-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

.result-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.result-card {
    padding: 20px;
    border-radius: var(--radius-sm);
    text-align: center;
}
.result-card.highlight { grid-column: span 2; background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); }
.result-card.success { background: #dcfce7; }
.result-card.warning { background: #fef3c7; }
.result-card.danger { background: #fee2e2; }
.result-card.info { background: #dbeafe; }
.result-card-label { font-size: 0.75rem; font-weight: 600; color: var(--color-text-secondary); text-transform: uppercase; margin-bottom: 4px; }
.result-card-value { font-size: 1.5rem; font-weight: 700; }
.result-card.highlight .result-card-value { font-size: 2rem; color: #166534; }

.breakdown { background: var(--color-bg); border-radius: var(--radius-sm); padding: 20px; margin-bottom: 20px; }
.breakdown h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 16px; }
.breakdown-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--color-border); font-size: 0.95rem; }
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row.total { font-weight: 700; border-top: 2px solid var(--color-border); margin-top: 8px; padding-top: 16px; }
.breakdown-label { color: var(--color-text-secondary); }
.breakdown-value { font-weight: 600; }
.breakdown-value.tax-free { color: var(--color-success); }
.breakdown-value.taxable { color: var(--color-danger); }

.info-box { padding: 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }
.info-box.warning { background: #fef3c7; border-left: 4px solid #f59e0b; }
.info-box.info { background: #dbeafe; border-left: 4px solid var(--color-primary); }
.info-box.success { background: #dcfce7; border-left: 4px solid var(--color-success); }
.info-box h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; }

.tax-rules { margin-top: 32px; }
.tax-rules h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; }
.rule-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--color-primary);
}
.rule-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.rule-card p { color: var(--color-text-secondary); font-size: 0.95rem; margin-bottom: 12px; }
.rule-card .tag { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.rule-card .tag.tax-free { background: #dcfce7; color: #166534; }
.rule-card .tag.taxable { background: #fee2e2; color: #991b1b; }
.rule-card .tag.depends { background: #fef3c7; color: #92400e; }

/* v35: replaces inline style on the disclaimer info-box */
.info-box-top-32 { margin-top: 32px; }

/* v35: classes for the related-letters block (was 6 inline styles) */
.related-letters {
    background: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 24px;
    margin: 32px 0;
}
.related-letters h3 { margin: 0 0 12px; font-size: 18px; color: #1e40af; }
.related-letters > p { color: #374151; font-size: 14px; margin: 0 0 16px; }
.related-letters .links { display: flex; flex-direction: column; gap: 8px; }
.related-letters .link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #1e40af;
    font-weight: 500;
    text-decoration: none;
}

footer {
    background: var(--color-dark);
    color: rgba(255,255,255,0.7);
    padding: 32px 24px;
    text-align: center;
    margin-top: 48px;
}
/* v35: replaces inline font-size/margin-top on footer disclaimer */
footer p.disclaimer { font-size: 0.85rem; margin-top: 8px; }

@media (max-width: 640px) {
    .hero h1 { font-size: 1.75rem; }
    .nav-links { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .result-cards { grid-template-columns: 1fr; }
    .result-card.highlight { grid-column: span 1; }
}

/* ────────────────────────────────────────────────────────────────────────── */
/* Inline explainer animation card -- was inline style block #2.              */
.stc-explainer { max-width: 1100px; margin: 24px auto 0; padding: 0 16px; }
.stc-explainer-card {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #0a0a0a;
    box-shadow: 0 20px 40px rgba(15,23,42,.14);
}
.stc-explainer-card .head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #312e81 100%);
    color: #fff;
    font-family: Inter, system-ui, sans-serif;
}
.stc-explainer-card .head b { font-weight: 800; letter-spacing: -.01em; font-size: 15px; }
.stc-explainer-card .head .sub { font-size: 12px; color: #cbd5e1; }
.stc-explainer-card .head a.openfull {
    font-size: 12px;
    font-weight: 700;
    color: #c7d2fe;
    text-decoration: none;
    border: 1px solid rgba(199,210,254,.35);
    padding: 6px 12px;
    border-radius: 999px;
}
.stc-explainer-card .head a.openfull:hover { background: rgba(199,210,254,.12); }
.stc-explainer-frame { position: relative; width: 100%; aspect-ratio: 16/9; background: #0a0a0a; }
.stc-explainer-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 640px) {
    .stc-explainer-card .head .sub { display: none; }
}

/* ────────────────────────────────────────────────────────────────────────── */
/* v35: classes for the inline service CTA built inside calculateTax(). The   */
/* original used a 200-byte inline style on each of 5 nested divs/buttons.    */
.stt-service-cta {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2b55 100%);
    border-radius: 12px;
    padding: 28px 24px;
    margin: 28px 0;
    color: #fff;
    font-family: 'Inter', -apple-system, sans-serif;
}
.stt-service-cta .row {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.stt-service-cta .col-main { flex: 1; min-width: 220px; }
.stt-service-cta .col-cta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: none;
    align-self: center;
}
.stt-service-cta h4 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}
.stt-service-cta p.body {
    margin: 0 0 14px;
    font-size: 14px;
    opacity: .9;
    line-height: 1.6;
}
.stt-service-cta p.body strong { color: #a5b4fc; }
.stt-service-cta .checks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 12px;
    opacity: .8;
}
.stt-service-cta .primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    background: #6366f1;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background .15s;
}
.stt-service-cta .primary-btn:hover { background: #4f46e5; }
.stt-service-cta .secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,.2);
    cursor: pointer;
    transition: background .15s;
}
.stt-service-cta .secondary-btn:hover { background: rgba(255,255,255,.2); }
.stt-service-cta .disclaimer {
    font-size: 11px;
    opacity: .45;
    margin: 12px 0 0;
    text-align: center;
}

/* v35: classes for the PDF-export button block */
.stt-pdf-row { text-align: center; margin-top: 24px; }
.pdf-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--color-primary, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.pdf-export-btn .icon { font-size: 20px; }
.pdf-export-btn:hover { background: var(--color-primary-dark, #1d4ed8); }
