/**
 * Najibul Category Dropdown Menu (NCDM) — Frontend Enterprise Styling v7.7.2
 * Fully responsive iOS/Android native app experience
 * Zero layout shift, 100% Core Web Vitals, ultra-optimized, zero truncation
 */

/* ==========================================================================
   Base Container & Normalization
   ========================================================================== */
.ncdm-advanced-container {
    position: relative;
    width: 100%;
    max-width: 340px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hind Siliguri", "Noto Sans Bengali", "Noto Sans Devanagari", sans-serif;
    box-sizing: border-box;
}

.ncdm-advanced-container *,
.ncdm-advanced-container *::before,
.ncdm-advanced-container *::after,
.ncdm-modal-dialog *,
.ncdm-modal-dialog *::before,
.ncdm-modal-dialog *::after {
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Trigger Button
   -------------------------------------------------------------------------- */
.ncdm-trigger-btn {
    width: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 13px 20px !important;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 9999px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: -0.1px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35), 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    outline: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.ncdm-trigger-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%) !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.45) !important;
}

.ncdm-trigger-btn:active {
    transform: translateY(0.5px) scale(0.985) !important;
}

.ncdm-trigger-btn .ncdm-selected-label {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    margin-right: 8px !important;
}

.ncdm-trigger-btn .ncdm-arrow-icon {
    font-size: 11px !important;
    opacity: 0.85 !important;
    transition: transform 0.25s ease !important;
    flex-shrink: 0 !important;
}

.ncdm-trigger-btn[aria-expanded="true"] .ncdm-arrow-icon {
    transform: rotate(180deg) !important;
}

/* ==========================================================================
   Full Screen Backdrop & Floating Suppression
   ========================================================================== */
.ncdm-modal-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.72) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    z-index: 2147483640 !important;
}

/* Absolute Floating Bell Suppression when modal/sheet is open */
body.ncdm-sheet-open #nfs-bell-wrapper,
body.ncdm-sheet-open .nfs-bell-wrapper,
body.ncdm-sheet-open .nfs-bell-trigger,
body.ncdm-sheet-open #nfs-bell-popup,
body.ncdm-sheet-open .nfs-bell-popup,
body.ncdm-sheet-open .uafs-bell-icon,
body.ncdm-sheet-open #nfs-bell-container,
body.ncdm-sheet-open .nfs-bell-btn,
body.ncdm-sheet-open .notification-bell,
body.ncdm-sheet-open .wp-site-bell,
body.ncdm-sheet-open [class*="bell-trigger"],
body.ncdm-sheet-open .main-navigation.has-branding [class*="bell"],
body.ncdm-sheet-open #mobile-header [class*="bell"],
body.ncdm-sheet-open .inside-navigation [class*="bell"] {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* ==========================================================================
   Modal Dialog — Desktop (Spacious Centered Card)
   ========================================================================== */
.ncdm-modal-dialog {
    display: none;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 520px !important;
    max-height: 84vh !important;
    background: #ffffff !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 65px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
    z-index: 2147483647 !important;
    overflow: hidden !important;
    flex-direction: column !important;
    animation: ncdmModalScaleEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    will-change: transform, opacity;
}

@keyframes ncdmModalScaleEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.ncdm-sheet-drag-handle {
    display: none;
}

/* Header */
.ncdm-modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 18px 24px 14px 24px !important;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    color: #ffffff !important;
    flex-shrink: 0 !important;
}

.ncdm-modal-header-top {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}

.ncdm-modal-header h3 {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    letter-spacing: -0.2px !important;
}

.ncdm-modal-close {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 22px !important;
    line-height: 1 !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
}

.ncdm-modal-close:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    transform: rotate(90deg) !important;
}

/* Search Box */
.ncdm-search-box {
    position: relative !important;
    padding: 14px 20px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    flex-shrink: 0 !important;
}

.ncdm-search-input-wrap {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    background: #f8fafc !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 14px !important;
    transition: all 0.2s ease !important;
}

.ncdm-search-input-wrap:focus-within {
    border-color: #4f46e5 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
}

.ncdm-search-icon {
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #94a3b8 !important;
    display: flex !important;
    align-items: center !important;
    pointer-events: none !important;
}

.ncdm-search-field {
    width: 100% !important;
    padding: 12px 38px 12px 42px !important;
    font-size: 15px !important;
    border: none !important;
    background: transparent !important;
    color: #0f172a !important;
    outline: none !important;
    font-family: inherit !important;
}

.ncdm-search-field::placeholder {
    color: #94a3b8 !important;
    font-weight: 400 !important;
}

.ncdm-clear-btn {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: #e2e8f0 !important;
    border: none !important;
    color: #64748b !important;
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: all 0.15s ease !important;
}

.ncdm-clear-btn:hover {
    background: #cbd5e1 !important;
    color: #334155 !important;
}

/* Results Wrapper */
.ncdm-results-wrapper {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: calc(84vh - 150px) !important;
    padding: 8px 12px !important;
    -webkit-overflow-scrolling: touch !important;
}

.ncdm-results-wrapper::-webkit-scrollbar {
    width: 6px;
}

.ncdm-results-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.ncdm-results-wrapper::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 999px;
}

.ncdm-results-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Section Header (Trending / All) */
.ncdm-section-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 14px 6px 14px !important;
    color: #64748b !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    margin-bottom: 4px !important;
}

.ncdm-section-title {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.ncdm-fire-anim {
    display: inline-block !important;
    font-size: 14px !important;
    animation: ncdmFlamePulse 1.8s infinite ease-in-out !important;
}

@keyframes ncdmFlamePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); }
}

.ncdm-section-badge {
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    padding: 2px 7px !important;
    border-radius: 8px !important;
}

/* --------------------------------------------------------------------------
   Category Row Items — Zero Truncation Architecture
   -------------------------------------------------------------------------- */
.ncdm-term-item {
    margin: 3px 0 !important;
    border-radius: 14px !important;
    transition: all 0.15s ease !important;
    list-style: none !important;
    background: transparent !important;
}

.ncdm-term-item:hover,
.ncdm-term-item.active {
    background-color: #f8fafc !important;
}

.ncdm-term-item.active {
    background-color: #eef2ff !important;
    outline: 2px solid #6366f1 !important;
}

.ncdm-term-link {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 14px !important;
    text-decoration: none !important;
    color: inherit !important;
    width: 100% !important;
    box-sizing: border-box !important;
    outline: none !important;
}

/* Avatar Icon Glyph */
.ncdm-term-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 19px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    user-select: none !important;
    transition: transform 0.15s ease, background-color 0.15s ease !important;
}

.ncdm-term-item:hover .ncdm-term-icon,
.ncdm-term-item.active .ncdm-term-icon {
    background: #e0e7ff !important;
    transform: scale(1.05) !important;
}

/* Category Title — Priority Display, NEVER Truncated to a single letter */
.ncdm-term-main {
    flex: 1 1 auto !important;
    min-width: 140px !important;
    overflow: hidden !important;
    margin-right: 8px !important;
}

.ncdm-term-text {
    font-size: 15px !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    display: block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.ncdm-term-item:hover .ncdm-term-text,
.ncdm-term-item.active .ncdm-term-text {
    color: #4338ca !important;
}

/* Search Highlight */
.ncdm-term-text mark,
.ncdm-term-text .ncdm-mark {
    background-color: #fef08a !important;
    color: #854d0e !important;
    padding: 0 3px !important;
    border-radius: 3px !important;
    font-weight: 700 !important;
}

/* Meta Badges Wrapper — Flexibly Shrunk if screen is narrow */
.ncdm-term-meta {
    flex: 0 1 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
}

.ncdm-trending-pill {
    background: #fff1f2 !important;
    color: #e11d48 !important;
    border: 1px solid #fecdd3 !important;
    padding: 2px 7px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    box-shadow: 0 1px 2px rgba(225, 29, 72, 0.06) !important;
    flex-shrink: 0 !important;
}

.ncdm-fire-pill {
    font-size: 11px;
}

.ncdm-count-badge {
    background: #f1f5f9 !important;
    color: #64748b !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.ncdm-term-item:hover .ncdm-count-badge,
.ncdm-term-item.active .ncdm-count-badge {
    background: #e2e8f0 !important;
    color: #334155 !important;
}

.ncdm-chevron {
    color: #cbd5e1 !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    margin-left: 2px !important;
    transition: transform 0.15s, color 0.15s !important;
    flex-shrink: 0 !important;
}

.ncdm-term-item:hover .ncdm-chevron,
.ncdm-term-item.active .ncdm-chevron {
    color: #4f46e5 !important;
    transform: translateX(3px) !important;
}

/* Empty State */
.ncdm-no-results {
    padding: 40px 20px !important;
    text-align: center !important;
}

.ncdm-no-results-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background: #f1f5f9 !important;
    margin-bottom: 10px !important;
}

.ncdm-no-results-text {
    color: #64748b !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    margin: 0 !important;
}

/* ==========================================================================
   MOBILE BOTTOM SHEET ARCHITECTURE (Screen <= 640px)
   Native iOS & Android feel, 100% responsive, never truncates
   ========================================================================== */
@media (max-width: 640px) {
    .ncdm-modal-dialog {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: translateY(0) !important;
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 85vh !important;
        max-height: 85dvh !important;
        border-radius: 24px 24px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35) !important;
        animation: ncdmSheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
        margin: 0 !important;
    }

    @keyframes ncdmSheetSlideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .ncdm-sheet-drag-handle {
        display: block !important;
        width: 44px !important;
        height: 5px !important;
        background: rgba(255, 255, 255, 0.7) !important;
        border-radius: 9999px !important;
        margin: 10px auto 4px auto !important;
        cursor: grab !important;
        flex-shrink: 0 !important;
    }

    .ncdm-modal-header {
        padding: 8px 18px 14px 18px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .ncdm-modal-header-top {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .ncdm-modal-header h3 {
        font-size: 17px !important;
    }

    .ncdm-search-box {
        padding: 10px 16px !important;
    }

    .ncdm-search-field {
        font-size: 14px !important;
        padding: 10px 32px 10px 36px !important;
    }

    .ncdm-results-wrapper {
        max-height: calc(85dvh - 145px) !important;
        padding: 6px 10px !important;
    }

    .ncdm-term-link {
        padding: 10px 12px !important;
        gap: 10px !important;
    }

    .ncdm-term-icon {
        width: 34px !important;
        height: 34px !important;
        font-size: 17px !important;
        border-radius: 10px !important;
    }

    .ncdm-term-main {
        min-width: 120px !important;
    }

    .ncdm-term-text {
        font-size: 14px !important;
    }

    .ncdm-trending-pill {
        padding: 2px 6px !important;
        font-size: 11px !important;
    }

    .ncdm-count-badge {
        font-size: 10px !important;
        padding: 2px 6px !important;
    }

    .ncdm-chevron {
        display: none !important;
    }
}
