/* ==========================================================================
   TeraCalculators - Modern Fintech Salary Calculator Design System
   ========================================================================== */

/* Page Header / Hero */
.salary-page-header {
    padding: 24px 0 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.breadcrumbs a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs .sep {
    color: #cbd5e1;
    font-size: 0.75rem;
}

.salary-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.salary-title-row h1 {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.025em;
    margin: 0;
    line-height: 1.25;
}

.year-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.salary-subtitle {
    font-size: 0.98rem;
    color: var(--text-light);
    max-width: 780px;
    line-height: 1.5;
    margin: 0;
}

/* Horizontal Country Navigation Pill Bar */
.country-nav-wrapper {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color);
}

.country-nav-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.country-nav-scroll::-webkit-scrollbar {
    display: none;
}

.country-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 9999px;
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.country-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

.country-tab.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.country-flag {
    font-size: 1.05rem;
    line-height: 1;
}

/* Calculator Layout Grid */
.salary-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 28px;
    align-items: start;
    margin-bottom: 40px;
}

@media (max-width: 960px) {
    .salary-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Modern Card Container */
.fintech-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
    width: 100%;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

.card-title-sub {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

/* Form Controls & Inputs */
.form-field {
    margin-bottom: 18px;
}

.form-field:last-child {
    margin-bottom: 0;
}

.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Segmented Control / Toggle Tabs */
.segmented-control {
    display: flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 14px;
}

.segmented-btn {
    flex: 1;
    padding: 7px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.segmented-btn:hover {
    color: var(--text-main);
}

.segmented-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Currency Input Group */
.currency-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.currency-symbol {
    position: absolute;
    left: 14px;
    width: 20px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-light);
    pointer-events: none;
    z-index: 2;
    text-align: center;
    line-height: 1;
}

.currency-input {
    width: 100%;
    height: 48px;
    padding-left: 44px !important; /* Ample gap so numbers never overlap symbol */
    padding-right: 14px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.currency-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}

/* Preset Salary Pills */
.preset-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.preset-chip {
    padding: 5px 11px;
    border-radius: 9999px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

.preset-chip.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Custom Styled Select Dropdown */
.fintech-select {
    width: 100%;
    height: 44px;
    padding: 0 36px 0 14px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-main);
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' 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: calc(100% - 12px) center;
    background-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.fintech-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Optional Pre-Tax Deductions Accordion */
.accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 0;
    background: transparent;
    border: none;
    border-top: 1px dashed var(--border-color);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
}

.accordion-body {
    display: none;
    padding-top: 12px;
}

.accordion-body.open {
    display: block;
}

/* ==========================================================================
   Results Panel Styling
   ========================================================================== */

/* Hero Take-Home Box */
.takehome-hero {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1.5px solid #a7f3d0;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.06);
    box-sizing: border-box;
    width: 100%;
}

.takehome-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}

.takehome-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: #047857;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.takehome-amount {
    font-size: 2.6rem;
    font-weight: 800;
    color: #065f46;
    line-height: 1.1;
    margin-bottom: 12px;
    letter-spacing: -0.03em;
}

/* Takehome Period Switcher inside Result Box */
.takehome-period-pills {
    display: flex;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    margin-bottom: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.takehome-period-pills::-webkit-scrollbar {
    display: none;
}

.period-pill-btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #047857;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-align: center;
}

.period-pill-btn:hover {
    background: rgba(16, 185, 129, 0.1);
}

.period-pill-btn.active {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
}

/* Stats Metric Strip */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid rgba(16, 185, 129, 0.2);
}

.stat-item {
    text-align: center;
}

.stat-item-lbl {
    font-size: 0.72rem;
    color: #047857;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}

.stat-item-val {
    font-size: 1.05rem;
    font-weight: 800;
    color: #064e3b;
}

/* Visualizer / Bar */
.visualizer-card {
    margin-bottom: 22px;
}

.fintech-progress-bar {
    height: 18px;
    border-radius: 9999px;
    display: flex;
    overflow: hidden;
    background: #e2e8f0;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.f-bar-net { background: #10b981; transition: width 0.3s ease; }
.f-bar-fed { background: #3b82f6; transition: width 0.3s ease; }
.f-bar-fica { background: #f59e0b; transition: width 0.3s ease; }
.f-bar-state { background: #8b5cf6; transition: width 0.3s ease; }

.breakdown-legend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 10px;
}

.legend-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.78rem;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-green { background: #10b981; }
.dot-blue { background: #3b82f6; }
.dot-amber { background: #f59e0b; }
.dot-purple { background: #8b5cf6; }

.legend-pct {
    font-weight: 700;
    color: var(--text-light);
    font-size: 0.78rem;
}

/* Detail Views: Schedule vs Deductions Tabs */
.view-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
    gap: 8px;
}

.view-tab-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 700;
    background: transparent;
    border: none;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.view-tab-btn:hover {
    color: var(--primary);
}

.view-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Paycheck Schedule Table - Strict 100% Fit */
.schedule-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.schedule-table {
    width: 100%;
    table-layout: fixed; /* Guaranteed proportions, never clips right edge */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.schedule-table th {
    background: #f8fafc;
    padding: 10px 8px;
    font-weight: 700;
    color: var(--text-main);
    text-align: right;
    border-bottom: 1.5px solid var(--border-color);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.schedule-table th:first-child {
    text-align: left;
    border-top-left-radius: 8px;
    width: 29%;
    padding-left: 8px;
}

.schedule-table th:nth-child(2) {
    width: 23%;
}

.schedule-table th:nth-child(3) {
    width: 23%;
}

.schedule-table th:last-child {
    border-top-right-radius: 8px;
    width: 25%;
    padding-right: 8px;
}

.schedule-table td {
    padding: 10px 8px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-table td:first-child {
    text-align: left;
    font-weight: 600;
    padding-left: 8px;
}

.schedule-table td:last-child {
    padding-right: 8px;
}

.schedule-table tr.row-annual {
    background: rgba(16, 185, 129, 0.05);
}

.schedule-table tr.row-annual td {
    font-weight: 700;
}

.schedule-table .net-col {
    font-weight: 700;
    color: #059669;
}

/* Deductions List View */
.deductions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deduction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    gap: 8px;
}

.deduction-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.deduction-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deduction-rate {
    font-size: 0.74rem;
    color: var(--text-light);
}

.deduction-amt {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: right;
    white-space: nowrap;
}

.deduction-amt-sub {
    font-size: 0.74rem;
    color: var(--text-light);
    text-align: right;
    white-space: nowrap;
}

/* Benchmark Card & Legend (Zero Collisions) */
.benchmark-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-top: 18px;
    box-sizing: border-box;
}

.benchmark-bar-track {
    background: #e2e8f0;
    height: 14px;
    border-radius: 7px;
    position: relative;
    margin: 12px 0 14px;
}

.benchmark-fill {
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.3s ease;
}

.benchmark-tick {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 20px;
    background: #475569;
    transform: translateX(-50%);
    border-radius: 1px;
}

.benchmark-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.bench-leg-item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.bench-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-min { background: #94a3b8; }
.dot-med { background: #3b82f6; }
.dot-you { background: #10b981; }

/* Responsive Table Wrapper for Long Editorial Tables */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .salary-page-header {
        padding: 16px 0;
    }

    .salary-title-row h1 {
        font-size: 1.45rem;
    }

    .fintech-card {
        padding: 16px 10px;
        border-radius: 12px;
    }

    .currency-input {
        font-size: 1.15rem;
        padding-left: 40px !important;
    }

    .takehome-amount {
        font-size: 2.1rem;
    }

    .stats-strip {
        gap: 6px;
    }

    .stat-item-val {
        font-size: 0.95rem;
    }

    .breakdown-legend-grid {
        grid-template-columns: 1fr;
    }

    .schedule-table {
        font-size: 0.77rem;
    }

    .schedule-table th, .schedule-table td {
        padding: 8px 3px;
    }

    .schedule-table th:first-child, .schedule-table td:first-child {
        padding-left: 4px;
        width: 28%;
    }

    .schedule-table th:last-child, .schedule-table td:last-child {
        padding-right: 4px;
        width: 26%;
    }
}
