/* --- Main Container & Typography --- */
#cmt-calculator-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    max-width: 1200px;
    margin: 40px auto;
    padding: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* --- Mode Selector Buttons (Premium/Standard) --- */
.calculator-mode-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    background-color: #f0f2f5;
    border-radius: 25px;
    padding: 5px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.mode-btn {
    padding: 10px 25px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #555;
    border-radius: 20px;
    transition: all 0.3s ease-in-out;
}

.mode-btn.active {
    background-color: #0073aa;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 115, 170, 0.3);
}

/* --- Layout Grid --- */
.calculator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-bottom: 40px;
}

.calculator-column {
    min-width: 0;
}

/* --- NEW: Result Section Boxing --- */
.result-section-box {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

/* Condense space and remove bottom border for titles inside boxes */
.result-section-box .section-title {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 15px;
}

/* --- Input Fields Alignment & Styling --- */
.input-group, .option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 20px;
}

.input-group label, .option-item label {
    margin-bottom: 0;
    flex: 1;
    font-weight: 500;
    font-size: 0.95em;
    color: #444;
    line-height: 1.4;
}

.label-desc {
    display: block;
    font-weight: normal;
    font-style: italic;
    color: #777;
    font-size: 0.9em;
}

.yellow-input {
    background-color: #ffff00 !important;
    border: 1px solid #c0c000;
    padding: 10px 12px;
    box-sizing: border-box;
    border-radius: 4px;
    font-size: 1em;
    font-weight: bold;
    text-align: right;
    flex-basis: 180px;
    max-width: 180px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select.yellow-input {
    text-align: left;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230073aa%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
    padding-right: 30px;
}

/* --- Result Items Styling --- */
.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1em;
}
.result-group > .result-item:first-of-type {
    padding-top: 0;
}
.result-item:last-child { border-bottom: none; }
.result-item span:first-child { color: #555; }
.result-item span:last-child { font-weight: bold; color: #000; }

/* --- Revenue Section 3-Column Layout --- */
.revenue-group { font-size: 1em; }
.revenue-header, .revenue-line {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr;
    gap: 15px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}
.revenue-header {
    font-weight: bold;
    color: #000;
    border-bottom: 2px solid #e0e0e0;
}
.revenue-header .col-title { text-align: right; }
.revenue-line:last-child { border-bottom: none; }
.revenue-header span:not(:first-child), .revenue-line span:not(:first-child) {
    text-align: right;
    font-weight: bold;
}
.revenue-label { font-weight: 500; color: #555; }

/* --- Total & Special Labels Styling --- */
.total-line {
    border-top: 2px solid #ddd;
    margin-top: 8px;
    padding-top: 10px !important;
    font-weight: bold;
}
.total-label {
    color: #555;
    font-weight: bold;
    text-transform: uppercase;
}
.total-value {
    color: #000;
    font-weight: bold;
}
.sub-label { color: #000; }

/* --- ROI Section Styling --- */
.roi-section {
    background-color: #e6f4ea;
    border: 1px solid #cce8d4;
    padding: 20px;
    margin-bottom: 0;
}
.roi-section .section-title {
    color: #274e13;
}
.roi-section .total-label,
.roi-section .roi-value,
.roi-section .roi-percentage {
    color: #274e13;
}
.roi-group { padding: 0; }
.roi-group .result-item { border: none; padding: 10px 0; }

/* --- Chart & Disclaimer --- */
.chart-container, .calculator-disclaimer {
    margin-top: 40px; padding-top: 20px; border-top: 1px solid #e5e5e5;
}
.calculator-disclaimer { font-size: 0.85em; color: #666; line-height: 1.6; }
.calculator-disclaimer p { margin: 0; }
.chart-container { position: relative; height: 400px; width: 100%; }

/* --- Loading State UX --- */
.calculator-container.loading {
    opacity: 0.5; transition: opacity 0.3s; pointer-events: none;
}

/* --- Responsive Layout for Mobile --- */
@media (max-width: 900px) {
    /* Xếp 2 cột chính thành 1 */
    .calculator-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    /* Xếp label ở trên, input ở dưới */
    .input-group, .option-item {
        flex-direction: column;
        align-items: flex-start; /* Căn lề trái cho cả label và input */
        gap: 8px; /* Giảm khoảng cách giữa label và input */
    }

    /* Sửa lỗi hiển thị ô vàng trên mobile */
    .yellow-input {
        width: 100%;       /* Chiếm toàn bộ chiều rộng có sẵn */
        max-width: none;   /* Gỡ bỏ giới hạn chiều rộng tối đa */
        flex-basis: auto;  /* Gỡ bỏ chiều rộng cơ bản */
        text-align: left;  /* Căn trái các số trên mobile cho dễ đọc */
    }

    /* Các điều chỉnh khác cho dễ đọc trên mobile */
    .revenue-header, .revenue-line {
        grid-template-columns: 1.5fr 1fr 1fr;
        font-size: 0.9em;
    }
}