/* =========================================
   1. CẤU TRÚC CONTAINER (MODERN LAYOUT)
   ========================================= */
.mas-accordion-wrapper.mas-layout-modern_card {
    display: flex;
    width: 100%;
    /* QUAN TRỌNG: Để có layout giống ảnh 1, ta cần chiều cao cố định */
    height: 600px; 
    
    /* Gap giữa các thẻ */
    gap: 15px;
    padding: 20px 0; /* Padding trên dưới để bóng đổ không bị cắt */
    box-sizing: border-box;
    
    position: relative;
    overflow: hidden; /* Ẩn những gì tràn ra ngoài wrapper */
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    
    /* Biến CSS từ PHP */
    --mas-title-size: 28px;
    --mas-label-size: 20px;
}

/* =========================================
   2. ITEM SLIDE (LOGIC CO GIÃN MỚI)
   ========================================= */
.mas-acc-item {
    position: relative;
    height: 100%;
    
    /* LOGIC MỚI:
       - flex: 1; -> Tất cả các thẻ đóng chia đều phần đất ít ỏi còn lại.
       - min-width: 80px; -> Đảm bảo thẻ đóng không bị bóp quá bé, vẫn nhìn thấy ảnh.
    */
    flex: 1; 
    min-width: 80px; 
    
    border-radius: 30px; /* Bo góc tròn trịa */
    overflow: hidden;
    cursor: pointer;
    
    /* Hiệu ứng chuyển động mượt mà */
    transition: flex 0.8s cubic-bezier(0.25, 1, 0.5, 1), min-width 0.5s;
    
    /* Ảnh nền */
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    
    /* Bóng đổ & Viền */
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.15);
}

/* TRẠNG THÁI ACTIVE (KHỐI MỞ) */
.mas-acc-item.active {
    /* flex: 5; -> Khối này chiếm không gian gấp 5 lần khối thường.
       Điều này tạo ra hình dáng to, rộng giống ảnh mẫu 1.
       Nếu muốn nó rộng hơn nữa, tăng số này lên 6 hoặc 7.
    */
    flex: 5;
    
    cursor: default; 
    
    /* Bỏ giới hạn min-width để nó giãn tự nhiên */
    min-width: unset; 
}

/* =========================================
   3. CÁC THÀNH PHẦN VISUAL
   ========================================= */

/* Lớp phủ tối (Gradient) */
.mas-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    /* Gradient đen từ dưới lên để làm nổi bật chữ trắng */
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.9) 100%);
    transition: background 0.4s;
    pointer-events: none;
    z-index: 1;
}
/* Khi active thì tối hơn chút để đọc chữ dễ hơn */
.mas-acc-item.active .mas-overlay {
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.95) 100%);
}

/* SỐ THỨ TỰ (Góc trên PHẢI - Như yêu cầu) */
.mas-bg-number {
    position: absolute;
    top: 25px; 
    right: 25px;
    
    font-size: 24px;
    font-weight: 800;
    z-index: 10;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* LABEL DỌC (Cho các khối đang đóng) */
.mas-acc-strip {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5;
    pointer-events: none; 
    transition: opacity 0.4s; /* Mờ dần khi mở */
}

/* Ẩn strip khi thẻ Active */
.mas-acc-item.active .mas-acc-strip {
    opacity: 0;
    visibility: hidden;
    transition-delay: 0s;
}

/* Khi không active thì hiện strip lên */
.mas-acc-item:not(.active) .mas-acc-strip {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.3s; /* Hiện lại chậm chút sau khi đóng */
}

.mas-strip-inner {
    display: flex; 
    flex-direction: column;
    justify-content: flex-end; /* Đẩy chữ xuống đáy */
    align-items: center;
    height: 100%;
    padding-bottom: 30px;
}

.mas-strip-top { display: none; } /* Ẩn mũi tên */

.mas-label {
    writing-mode: vertical-rl; 
    transform: rotate(180deg);
    text-transform: uppercase;
    font-size: 18px;
    letter-spacing: 2px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* =========================================
   4. NỘI DUNG CHÍNH (Trong khối Active)
   ========================================= */
.mas-acc-content {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; 
    visibility: hidden;
    transform: translateY(20px); /* Hiệu ứng trượt lên nhẹ */
    transition: all 0.5s ease-out;
    transition-delay: 0.2s; /* Chờ slide mở ra rồi mới hiện chữ */
    z-index: 6;
}

.mas-acc-item.active .mas-acc-content {
    opacity: 1; 
    visibility: visible;
    transform: translateY(0);
}

.mas-content-inner {
    width: 100%; height: 100%;
    display: flex; flex-direction: column; 
    justify-content: space-between; /* Tách nút (trên) và text (dưới) */
    padding: 40px; 
    box-sizing: border-box;
}

/* NÚT BẤM (Góc trên TRÁI) */
.mas-btn {
    position: absolute; top: 25px; left: 25px;
    
    display: inline-flex; align-items: center;
    padding: 10px 24px;
    
    /* Style kính mờ */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    
    color: #fff !important;
    text-decoration: none; font-size: 14px; font-weight: 600;
    transition: all 0.3s;
}
.mas-btn:hover {
    background: #fff; color: #000 !important;
}
.icon-arrow { margin-left: 8px; }

/* TEXT CONTENT (Góc dưới TRÁI) */
.mas-img-wrap {
    width: 100%; height: 100%; 
    display: flex; align-items: flex-end; /* Căn đáy */
}
.mas-text-wrap {
    width: 100%;
    box-sizing: border-box;
    max-width: 600px; 
    text-align: left;
}
.mas-title {
    font-size: var(--mas-title-size);
    margin: 0 0 15px 0;
    line-height: 1.2;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.mas-desc {
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255,255,255,0.95);
    margin: 0;
    /* Giới hạn 4 dòng */
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

/* =========================================
   5. MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 991px) {
    .mas-accordion-wrapper.mas-layout-modern_card { 
        flex-direction: column; 
        height: auto; 
        padding: 15px;
        gap: 15px;
    }
    
    .mas-acc-item { 
        width: 100%; 
        flex: none; /* Mobile không dùng flex grow */
        height: 80px; /* Chiều cao khi đóng */
        border-radius: 20px;
    }
    
    .mas-acc-item.active { 
        flex: none;
        height: 500px; /* Chiều cao cố định khi mở trên mobile */
    }
    
    /* Điều chỉnh vị trí mobile */
    .mas-bg-number { top: 20px; right: 20px; font-size: 20px; }
    .mas-btn { top: 20px; left: 20px; padding: 8px 16px; font-size: 12px; }
    
    .mas-strip-inner { 
        flex-direction: row; justify-content: flex-start; 
        padding: 0 25px; align-items: center; height: 100%; padding-bottom: 0;
    }
    .mas-label { 
        writing-mode: horizontal-tb; transform: none; 
        font-size: 16px; white-space: normal; line-height: 1.4;
    }
    
    .mas-content-inner { padding: 25px; }
    .mas-title { font-size: 22px; }
}