/**
 * mobile-select-modal.css
 * Centered dialog modal thay thế Select2 dropdown trên mobile (≤ 992px).
 * Phong cách: title → options grid → footer Cancel/Apply.
 * Không ảnh hưởng đến desktop.
 */

/* ================================================================
   OVERLAY
================================================================ */
.msm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.msm-option.msm-full-width {
    display: none !important;
}
.msm-overlay.active {
    display: flex;
    animation: msmFadeIn 0.18s ease both;
}

@keyframes msmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ================================================================
   DIALOG (centered card)
================================================================ */
.msm-sheet {
    background: #ffffff;
    border-radius: 4px;
    width: 100%;
    max-width: 360px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(15, 23, 42, 0.28);
    animation: msmPopIn 0.22s cubic-bezier(0.34, 1.36, 0.64, 1) both;
}

@keyframes msmPopIn {
    from { opacity: 0; transform: scale(0.88) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ================================================================
   HEADER
================================================================ */
.msm-header {
    background: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 10px 10px;
    border-bottom: 1px solid #eef0f4;
    flex-shrink: 0;
    position: relative;
}

/* Keyframes cho line chạy ra 2 bên */
@keyframes msmHeaderLine {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Line animation ở bottom chạy đều ra 2 bên khi active */
.msm-header::after {
    content: '';
    position: absolute;
    bottom: -1px; /* đè khít lên border-bottom */
    left: 0;
    right: 0;
    height: 1px;
    background: #163f78;
    transform: scaleX(0);
    transform-origin: center;
}

.msm-overlay.active .msm-header::after {
    animation: msmHeaderLine 0.45s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.msm-title {
    font-size: 14px;
    font-weight: 700;
    color: #163f78;
    margin: 0;
    letter-spacing: 0.01em;
}

/* Không dùng nút X, đóng bằng Cancel */
.msm-close {
    display: none;
}

/* ================================================================
   SEARCH BAR
================================================================ */
.msm-search-wrap {
    padding: 12px 16px 10px;
    flex-shrink: 0;
    /* border-bottom: 1px solid #eef0f4; */
}

.msm-search {
    width: 100%;
    border: 1.5px solid #163f78;
    border-radius: 4px;
    padding: 8px 14px 8px 14px;
    font-size: 1.35rem;
    outline: none;
    /* background: #f5f7fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='%23aab' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.44 1.406A5.5 5.5 0 1 1 8 2.5a5.5 5.5 0 0 1-2.698 9.25z'/%3E%3C/svg%3E") no-repeat 11px center; */
    background-size: 15px;
    color: #333;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}

.msm-search:focus {
    border-color: #163f78;
    background-color: #fff;
}

/* ================================================================
   OPTIONS LIST — wrapper & custom scrollbar
================================================================ */
.msm-list-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
    display: flex;
}

.msm-list {
    max-height: 48vh;
    overflow-y: auto;
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    overscroll-behavior: contain;
    
    /* Ẩn scrollbar mặc định của trình duyệt */
    scrollbar-width: none !important;
}

.msm-list::-webkit-scrollbar {
    display: none !important;
}

/* Custom scrollbar track */
.msm-scrollbar-track {
    position: absolute;
    right: 4px;
    top: 8px;
    bottom: 8px;
    width: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    z-index: 10;
    pointer-events: none; /* Cho phép sự kiện kéo vuốt đi xuyên qua xuống list */
    display: none; /* Tự động ẩn/hiện bằng JS */
}

/* Custom scrollbar thumb */
.msm-scrollbar-thumb {
    position: absolute;
    width: 100%;
    background: #163f78;
    border-radius: 3px;
    top: 0;
    left: 0;
    will-change: transform;
}

/* Nếu chỉ có 1 cột (placeholder + ít options) */
.msm-list.single-col {
    grid-template-columns: 1fr;
}

/* ================================================================
   OPTION ITEM — kiểu card nhỏ, không checkbox
================================================================ */
.msm-option {
    border-radius: unset !important;
    display: flex;
    align-items: center;
    justify-content: left;
    text-align: center;
    padding: 13px 10px;
    background: #fff;
    font-size: 14px;
    font-weight: 500;
    color: #2d3a5a;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    transition: background 0.14s, color 0.14s, box-shadow 0.14s;
    line-height: 1.3;
    word-break: break-word;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.msm-option:active {
    background: #dde8ff;
    outline: none;
}

/* Chiếm toàn bộ 2 cột (dùng cho option placeholder) */
.msm-option.msm-full-width {
    grid-column: 1 / -1;
    justify-content: flex-start;
    text-align: left;
    color: #8a95b0;
    font-style: italic;
    font-weight: 400;
    background: #f8f9fc;
    /* border: 1.5px dashed #dde1ea; */
}

/* Option đang được chọn */
.msm-option.is-selected {
    background: #163f78;
    color: #ffffff;
    font-weight: 700;
    /* box-shadow: 0 3px 12px rgba(26, 110, 245, 0.30); */
}

.msm-option.is-selected:active {
    background: #163f78;
}

/* No result */
.msm-no-result {
    grid-column: 1 / -1;
    text-align: center;
    color: #aab2c8;
    font-size: 1.3rem;
    padding: 20px 0;
}


/* ================================================================
   DESKTOP: ẩn tuyệt đối
================================================================ */
@media (min-width: 993px) {
    .msm-overlay {
        display: none !important;
    }
}
