/* ============================================================
   FBR Pakistan Salary & Income Tax Calculator — Styles
   Budget 2026-27
   ============================================================ */

.calc-fbr-tax {
    font-family: inherit;
}

/* ── Card wrapper ───────────────────────────────────────────── */
.fbr-tax-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0,0,0,.06);
}

@media (max-width: 640px) {
    .fbr-tax-card { padding: 1.25rem; border-radius: 12px; }
}

/* ── Input rows ─────────────────────────────────────────────── */
.fbr-input-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fbr-input-row--3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
    .fbr-input-row { grid-template-columns: 1fr 1fr; }
    .fbr-input-row--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .fbr-input-row,
    .fbr-input-row--3 { grid-template-columns: 1fr; }
}

/* ── Fields ─────────────────────────────────────────────────── */
.fbr-field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.fbr-field label {
    font-size: .8125rem;
    font-weight: 600;
    color: #374151;
    letter-spacing: .01em;
}

.fbr-input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color .2s;
}

.fbr-input-wrap:focus-within {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

.fbr-prefix {
    padding: 0 .7rem;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    font-size: .9rem;
    border-right: 1.5px solid #d1d5db;
    height: 100%;
    display: flex;
    align-items: center;
    user-select: none;
}

.fbr-input {
    flex: 1;
    border: none;
    outline: none;
    padding: .625rem .75rem;
    font-size: .9375rem;
    color: #111827;
    background: transparent;
    min-width: 0;
}

.fbr-input::placeholder { color: #9ca3af; }

.fbr-select {
    width: 100%;
    padding: .625rem .75rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: .9rem;
    color: #111827;
    background: #fff;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 14px;
    padding-right: 2.25rem;
    transition: border-color .2s;
}

.fbr-select:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

/* ── Advanced options ───────────────────────────────────────── */
.fbr-advanced {
    margin-bottom: 1rem;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}

.fbr-advanced > summary {
    padding: .625rem 1rem;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    list-style: none;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.fbr-advanced > summary::-webkit-details-marker { display: none; }
.fbr-advanced > summary::before {
    content: '▸';
    color: #16a34a;
    transition: transform .2s;
    display: inline-block;
}
.fbr-advanced[open] > summary::before { transform: rotate(90deg); }

.fbr-advanced-hint {
    font-weight: 400;
    color: #6b7280;
    font-size: .8rem;
}

.fbr-advanced-body {
    padding: 1rem;
    background: #fff;
}

/* ── Calculate button ───────────────────────────────────────── */
.fbr-btn-calc {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: .875rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: opacity .2s, transform .1s;
    letter-spacing: .015em;
    margin-top: .25rem;
}

.fbr-btn-calc:hover { opacity: .92; }
.fbr-btn-calc:active { transform: scale(.98); }
.fbr-btn-calc:focus-visible {
    outline: 3px solid #16a34a;
    outline-offset: 3px;
}

/* ── Badges ─────────────────────────────────────────────────── */
.fbr-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1.25rem;
}

.fbr-badge {
    display: inline-flex;
    align-items: center;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.fbr-badge--year  { background: #dcfce7; color: #15803d; }
.fbr-badge--filer { background: #dbeafe; color: #1d4ed8; }
.fbr-badge--slab  { background: #fef3c7; color: #b45309; }

/* ── KPI cards ──────────────────────────────────────────────── */
.fbr-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 720px) {
    .fbr-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
    .fbr-kpi-row { grid-template-columns: 1fr 1fr; }
}

.fbr-kpi {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    transition: box-shadow .2s;
}

.fbr-kpi:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }

.fbr-kpi-label {
    font-size: .75rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fbr-kpi-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fbr-kpi--tax .fbr-kpi-value   { color: #dc2626; }
.fbr-kpi--take .fbr-kpi-value  { color: #16a34a; }
.fbr-kpi--net .fbr-kpi-value   { color: #16a34a; }
.fbr-kpi--eff .fbr-kpi-value   { color: #7c3aed; }

/* ── Progress bar ───────────────────────────────────────────── */
.fbr-bar-wrap {
    margin-bottom: 1.5rem;
}

.fbr-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: .35rem;
}

.fbr-bar {
    height: 14px;
    border-radius: 999px;
    background: #f3f4f6;
    display: flex;
    overflow: hidden;
}

.fbr-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .5s ease;
}

.fbr-bar-fill--take { background: linear-gradient(90deg, #16a34a, #4ade80); }
.fbr-bar-fill--tax  { background: linear-gradient(90deg, #f87171, #dc2626); }

/* ── Tables ─────────────────────────────────────────────────── */
.fbr-breakdown,
.fbr-yoy {
    margin-bottom: 1.5rem;
}

.fbr-breakdown-title {
    font-size: .9375rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 .75rem;
}

.fbr-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.fbr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8625rem;
}

.fbr-table thead tr {
    background: #f3f4f6;
}

.fbr-table th {
    padding: .625rem .85rem;
    text-align: left;
    font-weight: 700;
    color: #374151;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.fbr-table td {
    padding: .6rem .85rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.fbr-table tbody tr:last-child td { border-bottom: none; }

.fbr-table tbody tr.fbr-row--active {
    background: #f0fdf4;
}

.fbr-table tbody tr.fbr-row--active td:first-child {
    border-left: 3px solid #16a34a;
}

.fbr-table tfoot tr td {
    font-weight: 800;
    color: #111827;
    background: #f9fafb;
    border-top: 2px solid #e5e7eb;
}

.fbr-yoy-saving--positive { color: #16a34a; font-weight: 700; }
.fbr-yoy-saving--negative { color: #dc2626; font-weight: 700; }

/* ── Results panel ──────────────────────────────────────────── */
.fbr-results {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e5e7eb;
    animation: fbr-fade-in .35s ease;
}

@keyframes fbr-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Disclaimer ─────────────────────────────────────────────── */
.fbr-disclaimer {
    font-size: .78rem;
    color: #6b7280;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: .625rem 1rem;
    display: flex;
    gap: .5rem;
    align-items: flex-start;
    line-height: 1.5;
    margin-top: 1rem;
}

.fbr-disclaimer i { color: #9ca3af; margin-top: .1rem; flex-shrink: 0; }

/* ── Error state ────────────────────────────────────────────── */
.fbr-error {
    margin-top: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: .75rem 1rem;
    color: #dc2626;
    font-weight: 600;
    font-size: .875rem;
    display: flex;
    gap: .5rem;
    align-items: center;
}
