/* ==========================================================================
   BDS Desktop DX Core - Mortgage Calculator Modern (mortgage-desktop.css)
   Fintech-grade Split-Screen layout, Sticky live summary, 60fps performance
   Scope: #the-post-mortgage-desktop
   ========================================================================== */

#the-post-mortgage,
#the-post-mortgage-desktop {
    --d-primary: #008c95;
    --d-primary-dark: #006e75;
    --d-primary-light: #e6f7f8;
    --d-goc: #059669;
    --d-goc-bg: #ecfdf5;
    --d-lai: #6366f1;
    --d-lai-bg: #eef2ff;
    --d-text-dark: #0f172a;
    --d-text-muted: #64748b;
    --d-text-sub: #94a3b8;
    --d-border: #e2e8f0;
    --d-border-light: #f1f5f9;
    --d-card-bg: #ffffff;
    --d-radius: 16px;
    --d-radius-sm: 10px;
    --d-shadow: 0 4px 24px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);

    width: 100%;
    margin: 28px 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--d-text-dark);
}

#the-post-mortgage *,
#the-post-mortgage *::before,
#the-post-mortgage *::after {
    box-sizing: border-box;
}

/* -------------------------------------------------------------
   1. SECTION HEADER
   ------------------------------------------------------------- */
#the-post-mortgage .d-section-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--d-border);
}

#the-post-mortgage .d-section-title {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--d-text-dark);
    letter-spacing: -0.3px;
}

#the-post-mortgage .d-section-title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 22px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--d-primary), #10b981);
}

#the-post-mortgage .d-section-subtitle {
    display: block;
    margin-top: 5px;
    font-size: 13.5px;
    color: var(--d-text-muted);
    font-weight: normal;
    padding-left: 14px;
}

/* -------------------------------------------------------------
   2. MAIN WRAPPER & SPLIT-SCREEN GRID (58% / 42%)
   ------------------------------------------------------------- */
#the-post-mortgage .d-card-wrapper {
    background: var(--d-card-bg);
    border: 1px solid var(--d-border);
    border-radius: var(--d-radius);
    padding: 26px 24px;
    box-shadow: var(--d-shadow);
}

.d-mortgage-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.95fr;
    gap: 30px;
    align-items: start;
}

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

/* -------------------------------------------------------------
   3. LEFT COLUMN: INPUT CONTROLS
   ------------------------------------------------------------- */
.d-mortgage-inputs {
    min-width: 0;
}

.d-group {
    margin-bottom: 22px;
}

.d-group:last-child {
    margin-bottom: 0;
}

.d-group-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.d-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--d-text-dark);
    margin: 0;
}

.d-label-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--d-primary-dark);
}

.d-label-badge .badge-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--d-text-muted);
}

/* Input price box */
.d-input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.d-input-price {
    width: 100%;
    height: 48px;
    padding: 0 54px 0 16px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--d-radius-sm);
    font-size: 16.5px;
    font-weight: 700;
    color: var(--d-text-dark);
    outline: none;
    transition: all 0.2s ease;
}

.d-input-price:focus {
    background: #ffffff;
    border-color: var(--d-primary);
    box-shadow: 0 0 0 3px rgba(0, 140, 149, 0.12);
}

.d-input-unit {
    position: absolute;
    right: 16px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--d-text-muted);
    pointer-events: none;
}

/* Quick chips */
.d-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.d-chip {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.d-chip:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.d-chip.active {
    background: var(--d-primary);
    border-color: var(--d-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 140, 149, 0.25);
}

/* Segmented switch for calculation method */
.d-segmented-switch {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    gap: 6px;
    margin-top: 6px;
}

.d-switch-item {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.d-switch-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.d-switch-item .switch-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 9px 8px;
    border-radius: 9px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-height: 48px;
}

.d-switch-item input[type="radio"]:checked + .switch-btn {
    background: #ffffff;
    color: var(--d-primary-dark);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.d-switch-item .switch-sub {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    font-weight: normal;
    margin-top: 2px;
}

.d-switch-item input[type="radio"]:checked + .switch-btn .switch-sub {
    color: #0d9488;
}

/* -------------------------------------------------------------
   4. ION RANGE SLIDER RESKIN FOR DESKTOP
   ------------------------------------------------------------- */
#the-post-mortgage .irs--round {
    height: 52px;
}

#the-post-mortgage .irs--round .irs-line {
    top: 25px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
}

#the-post-mortgage .irs--round .irs-bar {
    top: 25px;
    height: 6px;
    background: linear-gradient(90deg, var(--d-primary), #14b8a6);
    border-radius: 999px;
}

#the-post-mortgage .irs--round .irs-handle {
    top: 16px;
    width: 24px;
    height: 24px;
    background: #ffffff;
    border: 3px solid var(--d-primary);
    box-shadow: 0 2px 8px rgba(0, 140, 149, 0.35);
    border-radius: 50%;
    cursor: grab;
    transition: transform 0.15s ease;
}

#the-post-mortgage .irs--round .irs-handle:hover,
#the-post-mortgage .irs--round .irs-handle:active {
    transform: scale(1.15);
    background: #ffffff;
    border-color: var(--d-primary-dark);
}

#the-post-mortgage .irs--round .irs-single {
    top: 0;
    background: var(--d-text-dark);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#the-post-mortgage .irs--round .irs-single::before {
    border-top-color: var(--d-text-dark);
}

#the-post-mortgage .irs--round .irs-min,
#the-post-mortgage .irs--round .irs-max {
    top: 36px;
    font-size: 10px;
    color: #94a3b8;
    background: transparent;
    padding: 0;
}

#the-post-mortgage .irs--round .irs-grid {
    display: none;
}

/* -------------------------------------------------------------
   5. RIGHT COLUMN: STICKY FINANCIAL HERO SUMMARY
   ------------------------------------------------------------- */
.d-mortgage-results {
    position: sticky;
    top: 20px;
    min-width: 0;
}

.d-hero-card {
    background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
    border: 1.5px solid #99f6e4;
    border-radius: 14px;
    padding: 20px 18px;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.08);
}

.d-hero-header {
    text-align: center;
}

.d-hero-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #0f766e;
    margin: 0 0 6px 0;
    letter-spacing: -0.2px;
}

.d-hero-amount {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.5px;
}

.d-hero-unit {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    margin-left: 2px;
}

.d-hero-sub {
    font-size: 12px;
    color: #0d9488;
    margin: 4px 0 0 0;
}

/* Ratio Segmented Progress Bar */
.d-ratio-bar-wrap {
    margin: 16px 0 12px 0;
}

.d-ratio-bar {
    display: flex;
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.d-bar-goc {
    background: linear-gradient(90deg, #059669, #10b981);
    height: 100%;
    transition: width 0.3s ease;
}

.d-bar-lai {
    background: linear-gradient(90deg, #6366f1, #818cf8);
    height: 100%;
    transition: width 0.3s ease;
}

.d-ratio-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-top: 8px;
}

.d-ratio-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.d-ratio-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.d-ratio-dot.dot-goc {
    background: #059669;
}

.d-ratio-dot.dot-lai {
    background: #6366f1;
}

.d-ratio-item strong {
    font-weight: 700;
}

.d-ratio-item.item-goc strong {
    color: #047857;
}

.d-ratio-item.item-lai strong {
    color: #4f46e5;
}

/* -------------------------------------------------------------
   6. 2x2 METRICS GRID
   ------------------------------------------------------------- */
.d-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 14px;
}

.d-metric-card {
    background: #ffffff;
    border: 1px solid var(--d-border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.d-metric-label {
    font-size: 12px;
    color: var(--d-text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.d-metric-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--d-text-dark);
    line-height: 1.3;
}

.d-metric-card.theme-goc .d-metric-value {
    color: #059669;
}

.d-metric-card.theme-lai .d-metric-value {
    color: #6366f1;
}

.d-metric-card.theme-total .d-metric-value {
    color: var(--d-primary-dark);
}

.d-metric-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

/* -------------------------------------------------------------
   7. DISCLAIMER NOTICE
   ------------------------------------------------------------- */
.d-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 14px;
    font-size: 11.5px;
    line-height: 1.5;
    color: #64748b;
}

.d-disclaimer-icon {
    color: #0284c7;
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
}
