/* =========================================
   PROPERTY ENTRY COST & STAMP DUTY CALCULATOR
   Shared form styles (.df-calc-box, .input-wrapper, .df-btn-primary,
   .df-calc-nav-card) come from the theme; this file only adds what is
   specific to this calculator.
   ========================================= */

/* --- LEFT: FORM --- */

.df-pec-box .df-input-group {
    margin-bottom: 20px;
}

/* Segmented controls (transaction type, property category) */
.df-pec-segment {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #F3F3F3;
    border-radius: 8px;
}

.df-pec-seg-btn {
    flex: 1;
    border: none !important;
    background: transparent !important;
    color: #0F2855 !important;
    font-family: Inter, sans-serif;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    padding: 9px 6px !important;
    border-radius: 6px !important;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.df-pec-seg-btn.active {
    background: #148DFB !important;
    color: #fff !important;
}

.df-pec-seg-btn:focus-visible {
    outline: 2px solid #bfdbfe;
    outline-offset: 1px;
}

/* Down payment: input + % / RM buttons */
.df-pec-down-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.df-pec-down-row .input-wrapper {
    flex: 1;
    min-width: 0;
}

.df-pec-box .df-pec-down-row input[type="text"] {
    padding-left: 0;
}

.df-pec-unit {
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
    padding: 0 !important;
    border: 1px solid #D6DCE5 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #64748b !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: all 0.2s;
}

.df-pec-unit.active {
    border-color: #148DFB !important;
    background: #E7F2FF !important;
    color: #0F2855 !important;
}

/* Selects */
.df-pec-box select {
    width: 100%;
    min-height: 44px;
    padding: 0 40px 0 15px;
    border: none;
    border-radius: 8px;
    background-color: #F3F3F3;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23148DFB' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    font-size: 15px;
    color: #0F2855;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.df-pec-box select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
    background-color: #fff;
}

/* Errors and notes */
.df-pec-error {
    display: none;
    color: #ef4444;
    font-size: 12px;
    font-weight: 500;
    margin-top: 6px;
}

.df-pec-box .input-wrapper.has-error {
    box-shadow: 0 0 0 1px #ef4444;
}

.df-pec-note {
    display: none;
    margin: 6px 0 0 0 !important;
    font-size: 12px;
    line-height: 1.5;
    color: #475569;
}

/* Fee toggles */
.df-pec-switches {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.df-pec-switch {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    color: #0F2855 !important;
    cursor: pointer;
    position: relative;
}

.df-pec-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.df-pec-slider {
    flex: 0 0 36px;
    width: 36px;
    height: 20px;
    border-radius: 20px;
    background: #E2E8F0;
    position: relative;
    transition: background 0.2s;
}

.df-pec-slider::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 40, 85, 0.2);
    transition: transform 0.2s;
}

.df-pec-switch input:checked + .df-pec-slider {
    background: #148DFB;
}

.df-pec-switch input:checked + .df-pec-slider::after {
    transform: translateX(16px);
}

.df-pec-switch input:focus-visible + .df-pec-slider {
    box-shadow: 0 0 0 2px #bfdbfe;
}

.df-pec-box .df-btn-primary {
    margin-top: 4px;
}

/* --- RIGHT: RESULTS --- */

.df-pec-results {
    font-family: Inter, sans-serif;
    width: 100%;
    max-width: 655px;
}

.df-pec-results-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 32px;
}

.df-pec-results-title {
    color: #fff !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
}

.df-pec-total-wrap {
    text-align: right;
}

.df-pec-total-label {
    display: block;
    color: #FFD84B;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.df-pec-total {
    display: block;
    color: #fff;
    font-size: 44px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

/* Empty state: faded panel */
.df-pec-results:not(.is-calculated) .df-pec-results-head,
.df-pec-results:not(.is-calculated) .df-pec-card,
.df-pec-results:not(.is-calculated) .df-pec-table-card {
    opacity: 0.5;
}

.df-pec-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px 26px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.df-pec-card-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #0F2855 !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
}

.df-pec-card-sub {
    font-size: 12px !important;
    color: #475569 !important;
    margin: 0 0 16px 0 !important;
}

/* Stacked bar */
.df-pec-bar {
    display: flex;
    gap: 2px;
    height: 14px;
    border-radius: 10px;
    overflow: hidden;
    background: #E2E8F0;
}

.df-pec-bar .seg {
    height: 100%;
    min-width: 4px;
    transition: width 0.5s ease;
}

.df-pec-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    list-style: none;
    margin: 14px 0 0 0 !important;
    padding: 0 !important;
}

.df-pec-legend li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    font-size: 12px;
    font-weight: 600;
    color: #0F2855;
}

.df-pec-legend li strong {
    font-weight: 600;
    margin-left: 2px;
}

.df-pec-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 8px;
}

.df-pec-empty-note {
    display: none;
    margin: 12px 0 0 0 !important;
    text-align: center;
    font-size: 11px !important;
    color: #475569 !important;
}

.df-pec-results:not(.is-calculated) .df-pec-empty-note {
    display: block;
}

/* Item and MOT tier tables */
.df-pec-table-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.df-pec-table-card[hidden] {
    display: none;
}

.df-pec-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 !important;
    border: none !important;
    font-size: 14px;
}

.df-pec-table th,
.df-pec-table td {
    padding: 12px 16px !important;
    border: none !important;
    text-align: left;
    vertical-align: middle;
    background: transparent !important;
}

.df-pec-table th:first-child,
.df-pec-table td:first-child {
    padding-left: 40px !important;
}

.df-pec-table th:last-child,
.df-pec-table td:last-child {
    padding-right: 40px !important;
}

.df-pec-table thead tr {
    background: #1F5A93 !important;
}

.df-pec-table thead th {
    background: #1F5A93 !important;
    box-shadow: 1px 0 0 0 #1F5A93;
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
}

.df-pec-table tbody td {
    color: #0F2855;
}

.df-pec-table tbody tr:nth-child(even) td {
    background: #EEF5FE !important;
}

.df-pec-table .num {
    text-align: right;
    white-space: nowrap;
}

.df-pec-items td.num,
.df-pec-tiers td.strong,
.df-pec-table tr.is-total td {
    font-weight: 600;
}

.df-pec-table tr.is-total td {
    background: #EEF5FE !important;
}

.df-pec-items .col-basis {
    width: 36%;
    font-size: 12px;
    color: #64748b;
}

.df-pec-items tbody td.col-basis {
    color: #64748b;
}

.df-pec-items .item-basis {
    display: none;
}

.df-pec-disclaimer {
    font-size: 11px !important;
    line-height: 1.5 !important;
    color: rgba(255, 255, 255, 0.9) !important;
    margin: 0 !important;
}

/* --- ARTICLE: TABLES + FORMULA --- */

.df-pec-table-wrap {
    overflow-x: auto;
    border: 1px solid #D1DEEE;
    border-radius: 12px;
    margin-bottom: 24px;
}

.df-pec-article-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 !important;
    font-size: 14px;
    border: none !important;
}

.df-pec-article-table th,
.df-pec-article-table td {
    padding: 14px 16px !important;
    text-align: left;
    vertical-align: top;
    color: #364156;
    border: none !important;
    border-bottom: 1px solid #E5EDF7 !important;
    background: transparent !important;
}

.df-pec-article-table thead th {
    background: #E3F1FE !important;
    color: #0F2855;
    font-weight: 600;
}

.df-pec-article-table tbody tr:last-child td {
    border-bottom: none !important;
}

.df-pec-article-table .num,
.df-pec-price-table th:not(:first-child),
.df-pec-price-table td:not(:first-child) {
    text-align: right;
}

.df-pec-price-table td {
    white-space: nowrap;
}

.df-pec-price-table tbody tr {
    transition: background 0.15s;
}

.df-pec-price-table tbody tr:hover td {
    background: #F5FAFF !important;
}

.df-pec-formula {
    background: #E7F2FF;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 0 0 16px 0 !important;
    font-weight: 600 !important;
    color: #0F2855 !important;
}

/* --- ARTICLE: theme components sized to the Figma for this page --- */

.right-div-content .df-info-card {
    margin-bottom: 28px;
}

.right-div-content .df-stats-container {
    width: auto;
    gap: 12px;
}

.right-div-content .df-stat-card {
    flex: 0 0 auto;
    min-width: 0;
    padding: 18px 20px;
}

.right-div-content .df-stat-card h5 {
    margin-bottom: 8px;
}

.right-div-content .df-stat-value .stat-suffix {
    margin: 0;
    font-size: 13px;
    font-weight: 400;
}

@media (min-width: 768px) {
    .right-div-content .df-info-card {
        max-width: none;
    }

    .right-div-content .df-info-card h3 {
        margin-bottom: 16px;
    }

    .right-div-content .df-info-list {
        gap: 16px;
    }

    .right-div-content .df-num-circle {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .right-div-content .df-info-text p {
        font-size: 14px;
        color: #0F2855;
    }
}

/* --- RESPONSIVE --- */

@media (max-width: 1024px) and (min-width: 768px) {
    .df-pec-total {
        font-size: 36px;
    }
}

@media (max-width: 767px) {
    /* Transaction type as a 2 x 2 grid */
    .df-pec-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .df-pec-seg-btn {
        font-size: 13px !important;
        padding: 10px 4px !important;
    }

    .df-pec-results-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin-bottom: 20px;
    }

    .df-pec-results-title {
        margin-bottom: 8px !important;
    }

    .df-pec-total-wrap {
        text-align: left;
    }

    .df-pec-total {
        font-size: 36px;
    }

    .df-pec-card {
        padding: 22px 24px;
    }

    .df-pec-legend {
        flex-direction: column;
        gap: 10px;
    }

    .df-pec-table {
        font-size: 13px;
    }

    .df-pec-table th,
    .df-pec-table td {
        padding: 12px 10px !important;
    }

    .df-pec-table th:first-child,
    .df-pec-table td:first-child {
        padding-left: 16px !important;
    }

    .df-pec-table th:last-child,
    .df-pec-table td:last-child {
        padding-right: 16px !important;
    }

    /* Basis moves under the item name */
    .df-pec-items .col-basis {
        display: none;
    }

    .df-pec-items .item-basis {
        display: block;
        margin-top: 4px;
        font-size: 12px;
        color: #64748b;
    }

    .df-pec-items td.num {
        font-size: 14px;
    }

    .df-pec-tiers th,
    .df-pec-tiers td {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .df-pec-tiers .is-total td.num:nth-child(3) {
        white-space: normal;
    }

    .df-pec-article-table {
        font-size: 13px;
    }

    .df-pec-article-table th,
    .df-pec-article-table td {
        padding: 12px 10px !important;
    }
}
