/* Main Container */
.ncdm-advanced-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin: 20px auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Trigger Button - Smooth Hover */
.ncdm-trigger-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: 
        transform 0.3s ease-out,
        box-shadow 0.3s ease-out,
        background 0.5s ease;
    backface-visibility: hidden;
}

.ncdm-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #5e7cea, #8f5fe3);
}

/* Modal Styles */
.ncdm-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

.ncdm-modal-dialog {
    display: none;
    position: fixed;
    top: 3%;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 480px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    z-index: 9999;
    overflow: hidden;
    animation: modalOpen 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Enhanced Modal Header with Larger Close Button */
.ncdm-modal-header {
    padding: 18px 24px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.ncdm-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ncdm-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 36px; /* আরও বড় সাইজ */
    cursor: pointer;
    padding: 8px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    position: relative;
    margin-left: 15px;
}

.ncdm-modal-close:hover {
    transform: rotate(90deg) scale(1.1);
    background: rgba(255,255,255,0.2);
}

.ncdm-modal-close::before {
    content: "×";
    position: absolute;
    font-weight: bold;
}

/* Search Box */
.ncdm-search-box {
    position: relative;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.ncdm-search-field {
    width: 100%;
    padding: 14px 50px 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background-color: #f9f9f9;
}

.ncdm-search-field:focus {
    border-color: #6e8efb;
    box-shadow: 0 0 0 4px rgba(110, 142, 251, 0.2);
    outline: none;
    background-color: white;
}

.ncdm-clear-btn {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #aaa;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s;
}

.ncdm-clear-btn:hover {
    color: #6e8efb;
    transform: translateY(-50%) scale(1.1);
}

/* Results Wrapper - Scrollbar Customized */
.ncdm-results-wrapper {
    overflow-y: auto;
    max-height: calc(90vh - 180px);
    scrollbar-width: thin;
    scrollbar-color: #6e8efb #f0f0f0;
}

.ncdm-results-wrapper::-webkit-scrollbar {
    width: 8px;
}

.ncdm-results-wrapper::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.ncdm-results-wrapper::-webkit-scrollbar-thumb {
    background-color: #6e8efb;
    border-radius: 4px;
}

/* Results List */
.ncdm-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ncdm-results-list li {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s;
    border-bottom: 1px solid #f8f8f8;
}

.ncdm-results-list li:hover {
    background-color: #f8f9ff;
    transform: translateX(5px);
}

.ncdm-results-list li.highlight {
    background-color: #f0f4ff;
    border-left: 4px solid #6e8efb;
}

/* Term Items */
.ncdm-term-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 15px;
    flex-shrink: 0;
    font-size: 18px;
}

.ncdm-term-text {
    flex-grow: 1;
    font-size: 16px;
    color: #333;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ncdm-results-list li:hover .ncdm-term-text {
    color: #6e8efb;
}

.ncdm-category-tag {
    background: #e9f0ff;
    color: #4a6cf7;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
    flex-shrink: 0;
}

/* Enhanced Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalOpen {
    0% {
        opacity: 0;
        transform: translate(-50%, -20px) scale(0.95);
    }
    50% {
        transform: translate(-50%, 5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes modalClose {
    0% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -20px) scale(0.95);
    }
}

/* Highlight matching text */
.ncdm-term-text mark {
    background-color: #fff9c4;
    color: #ff8f00;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 600;
}

/* Responsive Design with Enhanced Close Button */
@media (max-width: 768px) {
    .ncdm-advanced-container {
        max-width: 90%;
    }
    
    .ncdm-trigger-btn {
        padding: 16px 22px;
        font-size: 18px;
    }
    
    .ncdm-modal-dialog {
        width: 96%;
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .ncdm-results-wrapper {
        max-height: calc(90vh - 180px);
    }
    
    .ncdm-modal-close {
        font-size: 34px;
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 480px) {
    .ncdm-modal-dialog {
        top: 2%;
        max-height: 94vh;
    }
    
    .ncdm-trigger-btn {
        padding: 18px 24px;
        font-size: 20px;
    }
    
    .ncdm-modal-header h3 {
        font-size: 22px;
    }
    
    .ncdm-search-field {
        padding: 16px 50px 16px 18px;
        font-size: 18px;
    }
    
    .ncdm-term-text {
        font-size: 17px;
        white-space: normal;
    }
    
    .ncdm-term-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .ncdm-results-list li {
        flex-wrap: wrap;
    }
    
    .ncdm-category-tag {
        margin-left: 0;
        margin-top: 8px;
    }
    
    .ncdm-modal-close {
        font-size: 32px;
        width: 44px;
        height: 44px;
    }
}