/* --- Cấu trúc cơ bản --- */
.sticky-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    
    /* NÂNG CẤP: Thêm MARGIN để tạo khoảng cách với khối nội dung bên trên */
    margin-top: 50px; 
}
.scrolling-column, .sticky-column {
    position: relative;
}

/* === NÂNG CẤP (SỬA LỖI ITEM CUỐI) === */
/* Giảm padding-bottom để bớt khoảng trống ở cuối trang.
   Giá trị 50vh là quá nhiều, ta giảm xuống còn 25vh.
   Bạn có thể tự điều chỉnh con số này nếu muốn. */
.scrolling-column {
    padding-bottom: 25vh; /* <<< ĐÃ THAY ĐỔI TỪ 50vh XUỐNG 25vh */
}
/* === HẾT NÂNG CẤP === */


/* --- Tỷ lệ cột --- */
.ratio-30-70 .scrolling-column { width: 30%; }
.ratio-30-70 .sticky-column { width: 70%; }
.ratio-40-60 .scrolling-column { width: 40%; }
.ratio-40-60 .sticky-column { width: 60%; }
.ratio-50-50 .scrolling-column { width: 50%; }
.ratio-50-50 .sticky-column { width: 50%; }
.ratio-60-40 .scrolling-column { width: 60%; }
.ratio-60-40 .sticky-column { width: 40%; }
.ratio-70-30 .scrolling-column { width: 70%; }
.ratio-70-30 .sticky-column { width: 30%; }

/* --- Đảo vị trí cột --- */
.sticky-left .scrolling-column { order: 2; }
.sticky-left .sticky-column { order: 1; }
.sticky-right .scrolling-column { order: 1; }
.sticky-right .sticky-column { order: 2; }

/* --- Hiệu ứng Sticky --- */
.sticky-column {
    position: -webkit-sticky;
    position: sticky;
    top: 0; /* NÂNG CẤP: Dính vào đỉnh */
    height: 100vh; /* NÂNG CẤP: Chiếm toàn bộ chiều cao màn hình */

    /* NÂNG CẤP: Dùng flexbox để căn giữa khối ảnh con */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Nội dung cuộn --- */
.sticky-text-item {
    min-height: 70vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.sticky-text-item h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #000;
}
.sticky-text-item .content-wrapper p {
    font-size: 16px;
    line-height: 1.6;
    /* === NÂNG CẤP: Căn đều 2 bên theo yêu cầu === */
    text-align: justify;
    color: #000;
}
.sticky-text-item .sticky-button {
    display: inline-block;
    margin-top: 5px;
    padding: 8px 25px;
    background-color: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    align-self: flex-start;
    transition: background-color 0.3s ease;
}
.sticky-text-item .sticky-button:hover {
    background-color: #005a87;
}

/* --- Hình ảnh dính --- */
.sticky-image-container {
    position: relative;
    width: 100%;
    
    /* Vẫn cần 1 chiều cao cụ thể, 70vh là ví dụ (bạn có thể đổi) */
    height: 70vh; 
    
    /* NÂNG CẤP: Thêm padding và box-sizing theo yêu cầu */
    padding: 5px 0;
    box-sizing: border-box;

    /* NÂNG CẤP: Đã XÓA 'transform: translateY(-50%)' (nguyên nhân gây lỗi) */
}
.sticky-image-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Giữ nguyên ảnh, không cắt */
    opacity: 0;
    transition: opacity 0.7s ease-in-out;
    border-radius: 8px;
}
.sticky-image-item.is-active {
    opacity: 1;
}

/* --- Responsive cho điện thoại --- */
@media (max-width: 768px) {
    .sticky-wrapper {
        flex-direction: column;
        margin-top: 30px; /* Reset margin cho mobile */
    }
    .scrolling-column {
        width: 100% !important;
        order: unset !important;
        padding-bottom: 0; /* Reset padding-bottom cho mobile */
    }
    .sticky-text-item {
        min-height: auto;
    }
    
    /* Xóa bỏ hoàn toàn định dạng cũ dùng pseudo-element */
    .sticky-text-item::before,
    .sticky-text-item::after {
        display: none;
    }
    
    /* ĐỊNH DẠNG MỚI: Dành cho các ảnh đã được JS di chuyển */
    .mobile-moved-image {
        display: block !important;
        position: relative !important;
        opacity: 1 !important;
        width: 100%;
        height: auto; /* Giữ tỷ lệ ảnh gốc */
        object-fit: contain; /* Đảm bảo ảnh không bị bóp méo, cắt xén */
        margin-top: 20px; /* Khoảng cách với text ở trên */
        margin-bottom: 40px; /* Khoảng cách với khối text tiếp theo */
        border-radius: 8px;
    }

    /* === NÂNG CẤP: Căn đều 2 bên cho mobile === */
    .sticky-text-item .content-wrapper p {
        text-align: justify; /* <<< THAY ĐỔI: Từ left sang justify */
    }
}

/* --- CSS Cho Phần Đánh Số Item --- */
.sticky-item-counter {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}
.sticky-item-counter .dot {
    width: 10px;
    height: 10px;
    background-color: #9b2c9b;
    border-radius: 50%;
    margin-right: 12px;
}
.sticky-item-counter .number {
    font-size: 16px;
    font-weight: 600;
    color: #000;
    line-height: 1;
}