/* ═══════════════════════════════════════════════════════════════════════════
 * take-home-calc.css — Scoped styles for Take Home Paycheck Calculator
 * Namespace prefix: thp-
 * Path: assets/css/take-home-calc.css
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ── WIDGET WRAPPER ──────────────────────────────────────────────────────── */
#thp-calculator-container { padding: 0; overflow: hidden; }
.thp-calc { font-family: inherit; color: var(--clr-text-primary); }

/* ── UTILITY ─────────────────────────────────────────────────────────────── */
.thp-hidden { display: none !important; }

/* ── TABS ────────────────────────────────────────────────────────────────── */
.thp-tabs {
    display: flex;
    border-bottom: 2px solid var(--clr-border);
    padding: 1.25rem 1.5rem 0;
    background: var(--clr-bg-soft);
    gap: 0;
}
.thp-tab {
    position: relative;
    padding: 0.55rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--clr-text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: color .18s, background .18s;
    letter-spacing: .01em;
    white-space: nowrap;
}
.thp-tab:hover { color: var(--clr-accent); background: var(--clr-accent-light); }
.thp-tab--active { color: var(--clr-accent-dark); border-bottom-color: var(--clr-accent); background: var(--clr-bg); }

/* ── PANELS ──────────────────────────────────────────────────────────────── */
.thp-panel { padding: 1rem 1.5rem 0; }
.thp-panel--hidden { display: none; }

/* ── SECTION LABELS ──────────────────────────────────────────────────────── */
.thp-section-label {
    font-size: .695rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--clr-text-muted);
    margin: .85rem 0 .6rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--clr-border-soft);
}
.thp-section-label:first-child { margin-top: 0; }

/* ── INPUT GRID ──────────────────────────────────────────────────────────── */
.thp-input-grid { display: grid; gap: .7rem .9rem; }
.thp-input-grid--3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 700px) { .thp-input-grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .thp-input-grid--3 { grid-template-columns: 1fr; } }

/* ── INPUT GROUP ─────────────────────────────────────────────────────────── */
.thp-input-group { display: flex; flex-direction: column; gap: .22rem; }

.thp-label {
    display: flex;
    align-items: baseline;
    gap: .35rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--clr-text-primary);
    line-height: 1.3;
}
.thp-hint {
    font-size: .69rem;
    font-weight: 400;
    color: var(--clr-text-muted);
    white-space: nowrap;
}
.thp-input-desc {
    font-size: .69rem;
    color: var(--clr-text-muted);
    line-height: 1.4;
}

.thp-input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--clr-border);
    border-radius: 8px;
    background: var(--clr-bg);
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s;
}
.thp-input-wrap:focus-within {
    border-color: var(--clr-accent);
    box-shadow: var(--shadow-focus);
}
.thp-prefix, .thp-suffix {
    padding: 0 .5rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--clr-text-muted);
    background: var(--clr-bg-soft);
    align-self: stretch;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.thp-prefix { border-right: 1px solid var(--clr-border); }
.thp-suffix { border-left: 1px solid var(--clr-border); }

.thp-input {
    flex: 1; min-width: 0;
    padding: .42rem .6rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--clr-text-primary);
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
}
.thp-input::-webkit-inner-spin-button,
.thp-input::-webkit-outer-spin-button { opacity: .4; }

.thp-input-wrap--select { padding: 0; }
.thp-select {
    width: 100%;
    padding: .42rem .6rem;
    font-size: .84rem;
    font-weight: 500;
    color: var(--clr-text-primary);
    background: var(--clr-bg);
    border: none;
    outline: none;
    cursor: pointer;
}

/* ── BUTTON ROW ──────────────────────────────────────────────────────────── */
.thp-btn-row {
    display: flex;
    gap: .75rem;
    padding: 1rem 1.5rem 1.1rem;
    align-items: center;
}
.thp-btn-calc {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    padding: .58rem 1.4rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.thp-btn-clear {
    font-size: .875rem;
    padding: .56rem 1.1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}
@media (max-width: 420px) {
    .thp-btn-row { flex-direction: column; padding: .9rem 1.1rem; }
    .thp-btn-calc, .thp-btn-clear { width: 100%; justify-content: center; }
}

/* ── RESULTS ─────────────────────────────────────────────────────────────── */
.thp-results {
    border-top: 1px solid var(--clr-border-soft);
    padding: 1.1rem 1.5rem 1.5rem;
    background: var(--clr-bg-soft);
}

/* ── FREQUENCY TABS ──────────────────────────────────────────────────────── */
.thp-freq-tabs {
    display: inline-flex;
    background: var(--clr-bg-muted);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
    margin-bottom: .9rem;
}
.thp-freq-btn {
    padding: .3rem .85rem;
    font-size: .78rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--clr-text-secondary);
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.thp-freq-btn--active {
    background: var(--clr-bg);
    color: var(--clr-accent-dark);
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* ── TAKE-HOME BANNER ────────────────────────────────────────────────────── */
.thp-takehome-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--clr-accent-light);
    border: 1.5px solid var(--clr-accent-hover);
    border-radius: 12px;
    padding: .9rem 1.1rem;
    margin-bottom: .9rem;
    flex-wrap: wrap;
    gap: .5rem;
}
.thp-banner-label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--clr-accent-dark);
    text-transform: uppercase;
    letter-spacing: .06em;
    display: block;
    margin-bottom: .15rem;
}
.thp-banner-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--clr-accent-dark);
    display: block;
    line-height: 1.1;
}
.thp-banner-right { text-align: right; }
.thp-eff-label {
    font-size: .72rem;
    color: var(--clr-text-muted);
    display: block;
    margin-bottom: .15rem;
}
.thp-eff-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--clr-text-primary);
    display: block;
}

@media (max-width: 480px) {
    .thp-banner-value { font-size: 1.3rem; }
    .thp-takehome-banner { flex-direction: column; align-items: flex-start; }
    .thp-banner-right { text-align: left; }
}

/* ── METRICS GRID ────────────────────────────────────────────────────────── */
.thp-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .55rem;
    margin-bottom: .9rem;
}
@media (max-width: 700px) { .thp-metrics-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 360px) { .thp-metrics-grid { grid-template-columns: 1fr 1fr; gap: .4rem; } }

.thp-metric-card {
    background: var(--clr-bg);
    border: 1.5px solid var(--clr-border);
    border-radius: 9px;
    padding: .6rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.thp-metric-label {
    font-size: .63rem;
    font-weight: 600;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    line-height: 1.3;
}
.thp-metric-value {
    font-size: .95rem;
    font-weight: 700;
    color: var(--clr-text-primary);
    line-height: 1.2;
    word-break: break-all;
}

/* Card accent borders */
.thp-metric--gross   { border-left: 3px solid var(--clr-accent); }
.thp-metric--pretax  { border-left: 3px solid var(--clr-teal); }
.thp-metric--federal { border-left: 3px solid #f97316; }
.thp-metric--state   { border-left: 3px solid #a855f7; }
.thp-metric--ss      { border-left: 3px solid var(--clr-interest); }
.thp-metric--medicare{ border-left: 3px solid #ec4899; }
.thp-metric--posttax { border-left: 3px solid #94a3b8; }
.thp-metric--net     { border-left: 3px solid var(--clr-green); background: #f0fdf4; }

/* ── CHART CARD ──────────────────────────────────────────────────────────── */
.thp-chart-card {
    background: var(--clr-bg);
    border: 1.5px solid var(--clr-border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: .9rem;
}
.thp-chart-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--clr-text-secondary);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin: 0 0 .7rem;
}

/* ── STACKED BAR ─────────────────────────────────────────────────────────── */
.thp-bar-wrap { margin-bottom: .75rem; }
.thp-bar {
    display: flex;
    height: 20px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--clr-bg-muted);
}
.thp-bar-seg {
    height: 100%;
    min-width: 0;
    transition: width .5s cubic-bezier(.4,0,.2,1);
}
.thp-bar-seg--net     { background: var(--clr-green); }
.thp-bar-seg--pretax  { background: var(--clr-teal); }
.thp-bar-seg--federal { background: #f97316; }
.thp-bar-seg--state   { background: #a855f7; }
.thp-bar-seg--fica    { background: var(--clr-interest); }
.thp-bar-seg--other   { background: #94a3b8; }

/* ── DONUT CHART ─────────────────────────────────────────────────────────── */
.thp-donut-wrap {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--clr-border-soft);
    padding-top: .85rem;
    margin-bottom: .85rem;
}
.thp-donut {
    width: 130px;
    height: 130px;
    flex-shrink: 0;
    transform: rotate(-90deg);
}
@media (max-width: 480px) {
    .thp-donut-wrap { flex-direction: column; align-items: center; gap: .65rem; }
    .thp-donut { width: 140px; height: 140px; }
}

/* circumference for r=78: ≈ 490 */
.thp-donut-bg { fill: none; stroke: var(--clr-bg-muted); stroke-width: 28; }
.thp-donut-seg {
    fill: none;
    stroke-width: 28;
    stroke-dasharray: 490;
    stroke-dashoffset: 490;
    transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1),
                stroke-dasharray  .6s cubic-bezier(.4,0,.2,1);
}
.thp-donut-seg--net     { stroke: var(--clr-green); }
.thp-donut-seg--pretax  { stroke: var(--clr-teal); }
.thp-donut-seg--federal { stroke: #f97316; }
.thp-donut-seg--state   { stroke: #a855f7; }
.thp-donut-seg--fica    { stroke: var(--clr-interest); }
.thp-donut-seg--other   { stroke: #94a3b8; }

.thp-donut-center-val {
    font-size: 13px;
    font-weight: 800;
    fill: var(--clr-text-primary);
    transform: rotate(90deg);
    transform-origin: 100px 100px;
}
.thp-donut-center-sub {
    font-size: 9px;
    fill: var(--clr-text-muted);
    transform: rotate(90deg);
    transform-origin: 100px 100px;
}

/* Donut Legend */
.thp-donut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .38rem;
    min-width: 200px;
}
.thp-dl-row {
    display: grid;
    grid-template-columns: 10px 1fr auto auto;
    align-items: center;
    gap: .4rem;
    font-size: .775rem;
}
.thp-dl-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.thp-dl-dot--net     { background: var(--clr-green); }
.thp-dl-dot--pretax  { background: var(--clr-teal); }
.thp-dl-dot--federal { background: #f97316; }
.thp-dl-dot--state   { background: #a855f7; }
.thp-dl-dot--fica    { background: var(--clr-interest); }
.thp-dl-dot--other   { background: #94a3b8; }

.thp-dl-name { color: var(--clr-text-secondary); }
.thp-dl-pct  { color: var(--clr-text-muted); font-size: .72rem; text-align: right; }
.thp-dl-val  { font-weight: 700; color: var(--clr-text-primary); text-align: right; white-space: nowrap; }

/* ── PER-PAYCHECK CALLOUT ────────────────────────────────────────────────── */
.thp-paycheck-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--clr-bg-soft);
    border: 1px solid var(--clr-border);
    border-radius: 8px;
    padding: .55rem .85rem;
}
.thp-paycheck-callout-label {
    font-size: .775rem;
    font-weight: 600;
    color: var(--clr-text-secondary);
}
.thp-paycheck-callout-val {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--clr-accent-dark);
}

/* ── DETAIL TOGGLE ───────────────────────────────────────────────────────── */
.thp-detail-toggle-wrap { margin-bottom: .75rem; }
.thp-detail-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--clr-accent-dark);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: .25rem 0;
    transition: color .15s;
}
.thp-detail-toggle:hover { color: var(--clr-accent); }
.thp-chevron { transition: transform .25s ease; flex-shrink: 0; }
.thp-detail-toggle[aria-expanded="true"] .thp-chevron { transform: rotate(180deg); }

/* ── TABLE ───────────────────────────────────────────────────────────────── */
.thp-detail-table-wrap {
    margin-top: .5rem;
    overflow-x: auto;
    border-radius: 10px;
    border: 1.5px solid var(--clr-border);
    margin-bottom: .75rem;
}
.thp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
    background: var(--clr-bg);
}
.thp-table thead tr {
    background: var(--clr-bg-muted);
    border-bottom: 1.5px solid var(--clr-border);
}
.thp-table th {
    padding: .5rem .8rem;
    font-size: .72rem;
    font-weight: 700;
    color: var(--clr-text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: left;
    white-space: nowrap;
}
.thp-table th:not(:first-child) { text-align: right; }
.thp-table tbody tr { border-bottom: 1px solid var(--clr-border-soft); }
.thp-table tbody tr:last-child { border-bottom: none; }
.thp-table tbody tr:nth-child(even) { background: var(--clr-bg-soft); }
.thp-table tbody tr.thp-row-total {
    background: var(--clr-accent-light);
    font-weight: 700;
    border-top: 1.5px solid var(--clr-accent-hover);
}
.thp-table td {
    padding: .5rem .8rem;
    color: var(--clr-text-secondary);
    vertical-align: middle;
}
.thp-table td:not(:first-child) {
    text-align: right;
    font-weight: 600;
    color: var(--clr-text-primary);
    white-space: nowrap;
}
.thp-table td.thp-td-deduction { color: var(--clr-teal); }
.thp-table td.thp-td-tax       { color: #dc2626; }
.thp-table td.thp-td-net       { color: var(--clr-green); }

/* ── DISCLAIMER ──────────────────────────────────────────────────────────── */
.thp-disclaimer {
    font-size: .715rem;
    color: var(--clr-text-muted);
    line-height: 1.55;
    padding: .6rem .85rem;
    background: var(--clr-bg-muted);
    border-radius: 8px;
    margin: 0;
    border-left: 3px solid var(--clr-border);
}
.thp-disclaimer strong { color: var(--clr-text-secondary); }

/* ── RESPONSIVE TWEAKS ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .thp-tabs    { padding: 1rem 1.1rem 0; }
    .thp-panel   { padding: .9rem 1.1rem 0; }
    .thp-btn-row { padding: .9rem 1.1rem; }
    .thp-results { padding: .9rem 1.1rem 1.25rem; }
}
@media (max-width: 480px) {
    .thp-metric-value { font-size: .85rem; }
    .thp-banner-value { font-size: 1.2rem; }
    .thp-dl-row { grid-template-columns: 10px 1fr auto; }
    .thp-dl-pct  { display: none; }
}
