/* MSB Saving Rate Table Styles */
/* Extracted from msb-saving-calculator and isolated */

.msb-saving-rate-table-wrapper {
    max-width: 1366px;
    margin: 0 auto;
}

.msb-saving-rate-table {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #111;
    background: #fff;
    padding: 24px;
    border: 1px solid #E5E7EB;
    box-shadow: 0px 0px 16px 0px #1d29390f;
    border-radius: 12px;
}

.msb-saving-rate-table * {
    box-sizing: border-box;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 20px 0;
}

/* ========== RATE TABLE SECTION ========== */
.rate-table-wrapper {
    overflow-x: auto;
    margin-bottom: 16px;
}

.rate-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
}

.rate-table th,
.rate-table td {
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    vertical-align: middle;
    line-height: 1.4;
}

.rate-table thead th {
    background: #1F2937;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    height: 48px;
    box-sizing: border-box;
    text-align: left;
}

.rate-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.rate-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.rate-table tbody tr:hover td {
    background-color: #FFF7ED;
}

.rate-table tbody td {
    height: 48px;
    box-sizing: border-box;
    color: #374151;
}

.rate-table tbody td:first-child {
    font-weight: 600;
    color: #1F2937;
    background: #F9FAFB;
    text-align: left;
}

/* ========== FULL TABLE CONTROLS ========== */
.full-table-controls {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: end;
    gap: 24px 32px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 14px;
    font-weight: 600;
    color: #4B5563;
}

.control-radios {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
}

.term-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: #6B7280;
    transition: color 0.2s;
}

.term-tab input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.term-tab input[type="radio"]:checked + .term-tab-radio {
    border-color: #F37021;
    background: #fff;
}

.term-tab input[type="radio"]:checked + .term-tab-radio::after {
    opacity: 1;
}

.term-tab input[type="radio"]:checked + .term-tab-radio + span {
    color: #1F2937;
}

.term-tab .term-tab-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #D1D5DB;
    border-radius: 50%;
    background: #fff;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}

.term-tab .term-tab-radio::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #F37021;
    opacity: 0;
    transition: opacity 0.2s;
}

/* Select Wrapper */
.msb-select-wrapper {
    position: relative;
    min-width: 120px;
}

.msb-select-wrapper::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 6px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    pointer-events: none;
}

.msb-select-wrapper select {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-color: #fff;
    cursor: pointer;
    width: 100%;
    padding: 10px 36px 10px 16px;
    height: 44px !important;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 16px;
}

/* Footer Section */
.result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
}

.footer-left {
    font-size: 12px;
    line-height: 1.5;
}

.update-time {
    display: block;
    color: #4B90E2;
    font-size: 13px;
    margin-bottom: 4px;
}

.disclaimer {
    color: #6B7280;
    font-size: 12px;
    font-style: italic;
}

.view-rate-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #F37021;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .full-table-controls {
        display: flex;
        flex-direction: column;
        align-items: normal;
        gap: 20px;
        margin-bottom: 24px;
    }

    .term-tab input[type="radio"]:checked + .term-tab-radio + span {
        color: #091E42;
    }

    .form-control {
        font-weight: 500;
        color: #091E42;
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    /* .control-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
    } */

    .control-label {
        font-weight: 600;
        color: #091E42;
        font-size: 15px;
    }

    .control-radios {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .term-tab {
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
    }

    .rate-table-matrix {
        display: block;
        border: none !important;
    }

    .js-full-table-head {
        display: none;
    }

    .js-full-table-body {
        display: block;
    }

    .js-full-table-body tr {
        display: block;
        background-color: #fff;
        border: 1px solid #E1E4E8;
        border-radius: 12px;
        margin-bottom: 12px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        transition: all 0.3s ease;
    }

    .js-full-table-body tr td:first-child {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 18px 16px;
        font-weight: 500;
        font-size: 18px;
        color: #091E42;
        cursor: pointer;
        order: -1; 
    }

    .js-full-table-body tr td:first-child::after {
        content: url("data:image/svg+xml,%3Csvg width='14' height='9' viewBox='0 0 14 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='%23091E42' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        transition: transform 0.3s ease;
        transform: rotate(0deg); 
        display: inline-block;
    }

    .js-full-table-body tr.is-expanded td:first-child::after {
        transform: rotate(-180deg); 
    }

    /* --- PHẦN SỬA ĐỔI: HIỂN THỊ 2 CỘT KHI MỞ --- */
    .js-full-table-body tr.is-expanded td:not(:first-child) {
        display: grid !important; /* Chuyển sang grid để chia 2 cột */
        grid-template-columns: 1fr 1fr; 
        padding: 0;
        border-top: 1px solid #EDF0F3;
        align-items: center;
    }

    /* Tạo cột trái từ table-head (Sử dụng thuộc tính data-label) */
    .js-full-table-body tr.is-expanded td:not(:first-child)::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 16px;
        color: #DEE5EF !important;
        border-right: 1px solid #EDF0F3;
        height: 100%;
        display: flex;
        align-items: center;
        background: #091E42;
    }

    /* Cột phải (Giá trị phần trăm) */
    .js-full-table-body tr.is-expanded td:not(:first-child) {
        color: #091E42;
        text-align: left;
        font-weight: 400;
        font-size: 14px;
        text-indent: 16px;
        background: #ffffff;
    }

    /* Ẩn nội dung khi chưa mở */
    .js-full-table-body tr td:not(:first-child) {
        display: none;
    }

    /* Cấu hình bo góc cho khối bảng dữ liệu khi mở */
    .js-full-table-body tr.is-expanded {
        border: 1px solid #E1E4E8;
        border-radius: 12px;
        margin-bottom: 16px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
}
