/* ================= THIẾT LẬP CHUNG ================= */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; }
body { background-color: #f4f5f7; color: #333; line-height: 1.6; }
a { text-decoration: none; color: #333; }
ul { list-style: none; }

.container-main { max-width: 1200px; margin: 15px auto; background: #fff; box-shadow: 0 0 10px rgba(0,0,0,0.1); }

/* ================= HEADER & BANNER CHUẨN TRANG CHỦ ================= */
.header-banner {
    background: linear-gradient(to right, #7f0000, #b71c1c, #d32f2f);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.banner-avatar {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 5px solid #ffc107;
    object-fit: cover;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.5);
    margin-right: 30px;
    z-index: 2;
}
.banner-content { z-index: 2; text-align: center; flex: 1; }
.banner-title {
    color: #ffda75; font-size: 42px; font-weight: 900; text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6); margin-bottom: 5px;
}
.banner-hotline {
    color: #ffffff; font-size: 36px; font-weight: bold; text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); margin-bottom: 5px;
}
.banner-slogan { color: #ffc107; font-size: 18px; font-style: italic; }

/* ================= MENU NAVBAR CHUẨN TRANG CHỦ ================= */
.main-nav {
    background-color: #7f0000;
    display: flex;
    border-bottom: 3px solid #ffc107;
}
.main-nav a {
    color: white;
    padding: 15px 25px;
    font-weight: bold;
    font-size: 15px;
    text-transform: uppercase;
    border-right: 1px solid #b71c1c;
    transition: 0.3s;
}
.main-nav a:hover, .main-nav a.active {
    background-color: #b71c1c;
    color: #ffc107;
}

/* ================= BỐ CỤC 3 CỘT ================= */
.main-wrapper {
    display: flex;
    padding: 15px;
    gap: 15px;
    flex-wrap: wrap;
}

.col-left {
    width: 20%;
}

.col-main {
    flex: 1;
    min-width: 0;
}

/* Thay width: 60% thành flex: 1 */
.col-right {
    width: 20%;
}

/* ================= BOX SIDEBAR ================= */
.sidebar-box { margin-bottom: 20px; border: 1px solid #e0e0e0; border-radius: 4px; overflow: hidden; }
.box-title {
    background-color: #b71c1c; color: white; padding: 10px 15px; font-weight: bold; text-transform: uppercase; font-size: 14px;
}
.box-content, .sidebar-list { padding: 10px; background: #fff; }
.sidebar-list li a {
    display: block; padding: 8px 10px; border-bottom: 1px dashed #ddd; font-size: 14px; transition: 0.2s; color: #333;
}
.menu-list li a:hover, .sidebar-list li a:hover { color: #d32f2f; background: #ffebee; padding-left: 15px; font-weight: bold; }

/* ================= KHU VỰC TÌM KIẾM ================= */
.search-section {
    background-color: #d32f2f;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
}
.search-section input {
    flex: 1; padding: 12px 15px; font-size: 16px; border: 2px solid #fff; border-radius: 4px 0 0 4px; outline: none;
}
.search-section button {
    background-color: #ffc107; color: #333; border: 2px solid #ffc107; padding: 0 25px;
    font-size: 16px; font-weight: bold; cursor: pointer; border-radius: 0 4px 4px 0; transition: 0.3s;
}
.search-section button:hover { background-color: #ffca28; transform: scale(1.02); }

/* ================= CÔNG CỤ DỰ TOÁN ================= */
.calculator-card { border: 1px solid #e0e0e0; border-radius: 6px; background: #fff; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow: hidden; }
.calculator-heading { background: #b71c1c; color: white; padding: 12px 15px; text-align: center; }
.calculator-heading h1 { margin: 0; font-size: 18px; font-weight: bold; text-transform: uppercase; }
#installmentForm { padding: 20px; }

.calc-grid { display: flex; flex-direction: column; gap: 15px; }
.calc-row { display: flex; align-items: center; }
.calc-label { width: 150px; font-weight: 600; color: #333; }
.calc-label span { color: red; margin-left: 3px; }
.calc-input { flex: 1; max-width: 400px; }
.calc-input input[type="text"], .calc-input input[type="tel"], .calc-input input[type="number"] {
    width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 4px; outline: none; font-size: 15px;
}
.calc-input { flex: 1; max-width: 400px; width: 100%; }

/* Khung giả bọc ngoài để nhét đơn vị vào trong */
.input-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s;
}

/* Đổi màu viền đỏ chuẩn khi click vào ô */
.input-wrapper:focus-within {
    border-color: #b71c1c; 
}

/* Ống nhập liệu chính (xóa viền vì đã có khung bọc) */
.input-wrapper input {
    flex: 1;
    width: 100%;
    padding: 8px 12px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
}

/* Chữ đ, tháng, /tr/ngày nằm gọn bên trong */
.input-wrapper .unit-text {
    padding-right: 12px;
    color: #666;
    white-space: nowrap;
}

/* Khung chọn Theo tiền / Theo % ép bằng size */
.rate-mode-switch { 
    display: flex; 
    width: 100%; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    overflow: hidden; 
}
.rate-mode-switch label { flex: 1; text-align: center; cursor: pointer; margin: 0; }
.rate-mode-switch input { display: none; }
.rate-mode-switch span { display: block; padding: 8px 15px; background: #f8f9fa; font-weight: 600; color: #555; transition: 0.2s; }
.rate-mode-switch input:checked + span { background: #d32f2f; color: white; }

.calculator-actions { display: flex; justify-content: center; gap: 15px; margin-top: 25px; padding-top: 20px; border-top: 1px dashed #eee; }
.calculate-button { background: #d32f2f; color: white; border: none; padding: 10px 30px; font-size: 16px; font-weight: bold; border-radius: 4px; cursor: pointer; transition: 0.2s; }
.calculate-button:hover { background: #b71c1c; }
.reset-button { background: #fff; color: #333; border: 1px solid #ccc; padding: 10px 20px; font-size: 15px; font-weight: bold; border-radius: 4px; cursor: pointer; transition: 0.2s; }
.reset-button:hover { background: #f0f0f0; }

/* ================= BẢNG KẾT QUẢ DỰ TOÁN ================= */
.result-card { border: 1px solid #4caf50; border-radius: 6px; background: #fff; overflow: hidden; margin-bottom: 20px; }
.result-heading { background: #e8f5e9; padding: 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #4caf50; }
.result-heading h2 { color: #2e7d32; margin: 0 0 0 10px; font-size: 20px; font-weight: 900; display: inline-block; }
.result-heading span { font-weight: bold; color: #555; }
.result-heading strong { background: #4caf50; color: white; padding: 5px 10px; border-radius: 4px; font-size: 14px; }

.summary-grid { display: flex; background: #fafafa; border-bottom: 1px solid #eee; }
.summary-item { flex: 1; padding: 15px; text-align: center; border-right: 1px solid #eee; }
.summary-item:last-child { border-right: none; }
.summary-item span { display: block; font-size: 13px; color: #666; margin-bottom: 5px; }
.summary-item strong { display: block; font-size: 18px; color: #d32f2f; }
.summary-total strong { color: #2e7d32; }

.schedule-wrap { padding: 15px; overflow-x: auto; }
.schedule-table { width: 100%; border-collapse: collapse; text-align: center; }
.schedule-table th, .schedule-table td { padding: 10px; border: 1px solid #ddd; font-size: 14px; }
.schedule-table th { background: #f5f5f5; font-weight: bold; }
.schedule-table tfoot th, .schedule-table tfoot td { font-weight: bold; background: #e8f5e9; color: rgb(0, 227, 19); }

/* ================= RESPONSIVE VÀ MOBILE CHUẨN ================= */
@media (max-width: 900px) {
    .main-wrapper { flex-wrap: wrap; }
    .col-main { width: 100%; order: 1; }
    .col-left, .col-right { width: calc(50% - 8px); order: 2; }
}

@media (max-width: 768px) {
    /* Chỉnh lại Header mobile */
    .header-banner { padding: 12px; }
    .banner-avatar { width: 70px; height: 70px; margin-right: 10px; }
    .banner-title { font-size: 20px; }
    .banner-hotline { font-size: 18px; }
    .banner-slogan { font-size: 11px; }

    /* Menu trượt ngang trên mobile cho gọn */
    .main-nav { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; }
    .main-nav a { padding: 10px 12px; font-size: 13px; }

    /* Cột sidebar tự động nhảy xuống dưới */
    .col-left, .col-right { width: 100%; }

    /* Form tìm kiếm chuẩn */
    .search-section { padding: 10px; margin-bottom: 10px; }
    .search-section input { padding: 6px 8px; font-size: 14px; }
    .search-section button { padding: 0 12px; font-size: 14px; }

    /* Giải phóng Form tính toán khỏi bị ép ngang */
    .calc-row { flex-direction: column; align-items: flex-start; }
    .calc-label { width: 100%; margin-bottom: 5px; }
    .calc-input { width: 100%; max-width: 100%; }
    
    .result-heading { flex-direction: column; align-items: flex-start; gap: 10px; }
    .summary-grid { flex-direction: column; }
    .summary-item { border-right: none; border-bottom: 1px solid #eee; }
}





@media (max-width: 768px) {
    /* Chỉnh lại Header mobile */
    .header-banner { padding: 12px; }
    .banner-avatar { width: 70px; height: 70px; margin-right: 10px; }
    .banner-title { font-size: 20px; }
    .banner-hotline { font-size: 18px; }
    .banner-slogan { font-size: 11px; }

    /* Menu trượt ngang trên mobile cho gọn */
    .main-nav { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; }
    .main-nav a { padding: 10px 12px; font-size: 13px; }

    /* Cột sidebar tự động nhảy xuống dưới */
    .col-left, .col-right { width: 100%; }

    /* Form tìm kiếm chuẩn */
    .search-section { padding: 10px; margin-bottom: 10px; }
    .search-section input { padding: 6px 8px; font-size: 14px; }
    .search-section button { padding: 0 12px; font-size: 14px; }

    /* Giải phóng Form tính toán khỏi bị ép ngang */
    .calc-row { flex-direction: column; align-items: flex-start; }
    .calc-label { width: 100%; margin-bottom: 5px; }
    .calc-input { width: 100%; max-width: 100%; }
    
    .result-heading { flex-direction: column; align-items: flex-start; gap: 10px; }
    
    /* 1. ÉP 3 CỤC TỔNG NẰM TRÊN 1 HÀNG NGANG */
    .summary-grid { 
        flex-direction: row; 
        flex-wrap: nowrap; 
    }
    .summary-item { 
        padding: 10px 2px; 
        border-bottom: none;
        border-right: 1px solid #eee;
    }
    .summary-item:last-child { border-right: none; }
    .summary-item span { font-size: 11px; margin-bottom: 3px; } /* Chữ tiêu đề nhỏ lại */
    .summary-item strong { font-size: 14px; } /* Số tiền nhỏ lại để vừa 3 ô */

    /* 2. ÉP BẢNG GỌN VÀO MÀN HÌNH */
    .schedule-wrap { padding: 10px 5px; }
    .schedule-table th, .schedule-table td { 
        padding: 6px 2px; /* Bóp lề các ô khít lại */
        font-size: 11px; /* Thu nhỏ chữ trong bảng */
        letter-spacing: -0.3px; /* Kéo khoảng cách chữ gọn lại xíu */
    }
    /* Thu hẹp riêng cột "Kỳ" vì nó chỉ chứa số ngắn */
    .schedule-table th:first-child, .schedule-table td:first-child { width: 25px; }
}




/* Xóa sạch vạch kẻ thừa bên trong ô nhập liệu */
.input-wrapper input[type="text"], 
.input-wrapper input[type="tel"], 
.input-wrapper input[type="number"] {
    border: none !important;
}





/* ================= BOX SIDEBAR ================= */
.sidebar-box {
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.box-title {
    background-color: #b71c1c;
    color: white;
    padding: 10px 15px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
}

.box-content, .sidebar-list {
    padding: 10px;
    background: #fff;
}

.menu-list li a, .sidebar-list li a {
    display: block;
    padding: 8px 10px;
    border-bottom: 1px dashed #ddd;
    font-size: 14px;
    transition: 0.2s;
    color: #333;
}




/* ================= CỘT PHẢI: TÌM SIM NĂM SINH ================= */
/* Ép lại giao diện 3 ô chọn ngày/tháng/năm cho đẹp, xóa mũi tên đỏ rác */
#dob-day,
#dob-month,
#dob-year {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    background-image: none !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    padding: 8px 5px !important;
    font-size: 14px !important;
    color: #333 !important;
    background-color: #fff !important;
    cursor: pointer !important;
    min-width: 65px !important;
}

/* Đổi màu viền khi click vào ô chọn */
#dob-day:focus,
#dob-month:focus,
#dob-year:focus {
    border-color: #d32f2f !important;
    outline: none !important;
}

/* Hiệu ứng di chuột cho nút Tìm Sim */
#btn-search-dob:hover {
    background-color: #ec971f !important;
    transform: scale(1.05);
}

/* ================= CỘT PHẢI: ĐƠN HÀNG MỚI (TRƯỢT TỰ ĐỘNG) ================= */
.don-hang-wrapper {
    height: 350px;
    overflow: hidden;
    position: relative;
}

.don-hang-scroll {
    animation: cuonLen 15s linear infinite;
}

.don-hang-wrapper:hover .don-hang-scroll {
    animation-play-state: paused;
}

@keyframes cuonLen {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-50%);
    }
}