/**
 * Pollster Education - Premium Luxury Mega Menu Styles
 * Modern styling for Universities & Destinations dropdowns
 */

/* Container & Placement */
@media (min-width: 992px) {
    .header .container,
    .navbar .container {
        position: relative !important;
    }

    .header #navbarNav,
    .header .offcanvas-body,
    .nav-item.dropdown.pe-mega-dropdown,
    .nav-item.dropdown.pe-exam-dropdown {
        position: static !important;
    }

    /* Bridge from nav-link downwards into mega menu */
    .nav-item.dropdown.pe-mega-dropdown > .nav-link {
        position: relative;
    }
    .nav-item.dropdown.pe-mega-dropdown > .nav-link::after {
        content: '';
        position: absolute;
        left: -10px;
        right: -10px;
        top: 100%;
        height: 38px;
        background: transparent;
        z-index: 1005;
        pointer-events: auto;
    }

    /* Keep mega menu open via hover or active JS grace class */
    .nav-item.dropdown.pe-mega-dropdown:hover > .pe-uni-mega-menu,
    .nav-item.dropdown.pe-mega-dropdown.is-open > .pe-uni-mega-menu,
    .pe-uni-mega-menu.is-open {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .pe-uni-mega-menu {
        position: absolute !important;
        top: 100% !important;
        left: 12px !important;
        right: 12px !important;
        width: calc(100% - 24px) !important;
        max-width: calc(100% - 24px) !important;
        transform: none !important;
        border-radius: 16px !important;
        border: 1px solid rgba(226, 232, 240, 0.95) !important;
        box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.18), 0 0 1px 1px rgba(15, 23, 42, 0.05) !important;
        background: #ffffff !important;
        overflow: visible !important; /* Visible so upward hover bridge works */
        overscroll-behavior: contain !important;
        padding: 0 !important;
        margin-top: 2px !important;
        animation: peMenuFadeIn 0.18s ease-out !important;
    }

    /* Invisible hover bridge on the mega menu extending upward to navbar */
    .pe-uni-mega-menu::before {
        content: '' !important;
        position: absolute !important;
        top: -36px !important;
        left: 0 !important;
        right: 0 !important;
        height: 40px !important;
        background: transparent !important;
        z-index: 1000 !important;
        pointer-events: auto !important;
    }
}

@keyframes peMenuFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Scrollable Columns Body */
.pe-uni-scroll-body {
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}
.pe-uni-scroll-body::-webkit-scrollbar {
    width: 6px;
}
.pe-uni-scroll-body::-webkit-scrollbar-track {
    background: #f8fafc;
}
.pe-uni-scroll-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.pe-uni-scroll-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 4-Column Grid */
.pe-uni-cols {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    width: 100%;
}
@media (max-width: 991px) {
    .pe-uni-mega-menu {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
    .pe-uni-cols {
        grid-template-columns: 1fr;
    }
}
.pe-uni-col {
    padding: 22px 18px 20px 18px;
    border-right: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.pe-uni-col:last-child {
    border-right: none;
}

/* Country Header Badge */
.pe-country-header {
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 5;
    padding-top: 14px;
    margin-top: -14px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 14px;
}
.pe-country-title {
    font-size: 13px;
    font-weight: 800;
    color: #1e1b4b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    text-decoration: none;
    transition: color 0.18s ease;
}
.pe-country-title:hover {
    color: #f58634;
}
.pe-country-count {
    font-size: 11px;
    font-weight: 700;
    color: #f58634;
    background: rgba(245, 134, 52, 0.1);
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}
.pe-country-bar {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 38px;
    height: 2px;
    background: #f58634;
    border-radius: 2px;
}

/* University Links List */
.pe-uni-list {
    margin-bottom: 12px;
    flex-grow: 1;
}
.pe-uni-list li {
    margin-bottom: 2px;
}
.pe-uni-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    line-height: 1.35;
}
.pe-uni-link:hover {
    background: #fff8f1;
    color: #f58634;
    padding-left: 14px;
}
.pe-uni-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: calc(100% - 18px);
}
.pe-uni-chevron {
    font-size: 15px;
    color: #f58634;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.18s ease;
    flex-shrink: 0;
}
.pe-uni-link:hover .pe-uni-chevron {
    opacity: 1;
    transform: translateX(0);
}

/* View All in Country Link */
.pe-uni-more-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #6366f1;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px dashed #e2e8f0;
    transition: all 0.18s ease;
    margin-top: 4px;
}
.pe-uni-more-link:hover {
    background: #eef2ff;
    color: #4338ca;
    border-color: #a5b4fc;
    padding-left: 14px;
}

/* Mega Footer Strip */
.pe-mega-footer {
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    padding: 12px 22px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

@media (max-width: 767px) {
    .pe-mega-footer .d-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    .pe-mega-footer a.btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ==========================================================================
   Study Abroad Destination Mega Menu Styles
   ========================================================================== */

.pe-dest-cols {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    width: 100%;
}

@media (max-width: 991px) {
    .pe-dest-cols {
        grid-template-columns: 1fr;
    }
}

.pe-dest-col {
    padding: 22px 18px 20px 18px;
    border-right: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pe-dest-col:last-child {
    border-right: none;
}

.pe-dest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    color: #334155;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    line-height: 1.35;
    margin-bottom: 2px;
}

.pe-dest-item:hover {
    background: #fff8f1;
    color: #f58634;
    padding-left: 14px;
}

.pe-dest-item:hover .pe-uni-chevron {
    opacity: 1;
    transform: translateX(0);
}

.pe-dest-item .pe-dest-name {
    font-weight: 600;
    color: #1e293b;
    transition: color 0.18s ease;
}

.pe-dest-item:hover .pe-dest-name {
    color: #f58634;
}

.pe-dest-quick-card {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pe-dest-quick-card:hover {
    background: #fff8f1;
    border-color: #f58634;
    transform: translateY(-1px);
}

.pe-dest-quick-card .pe-quick-title {
    font-size: 12px;
    font-weight: 700;
    color: #1e1b4b;
    display: block;
}

.pe-dest-quick-card:hover .pe-quick-title {
    color: #f58634;
}

.pe-dest-quick-card .pe-quick-sub {
    font-size: 11px;
    color: #64748b;
    display: block;
}

/* Study Abroad Promo Card in Column 4 */
.pe-dest-promo-card {
    background: linear-gradient(145deg, #1e1b4b 0%, #2e266d 100%);
    border-radius: 14px;
    padding: 22px 20px;
    color: #ffffff;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(30, 27, 75, 0.25);
}

.pe-dest-promo-card::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 134, 52, 0.28) 0%, rgba(245, 134, 52, 0) 70%);
    pointer-events: none;
}

.pe-dest-promo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #f58634;
    background: rgba(245, 134, 52, 0.15);
    border: 1px solid rgba(245, 134, 52, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
    align-self: flex-start;
}

.pe-dest-promo-title {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
    color: #ffffff;
    margin-bottom: 8px;
}

.pe-dest-promo-desc {
    font-size: 12px;
    line-height: 1.5;
    color: #cbd5e1;
    margin-bottom: 14px;
}

.pe-dest-promo-features {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}

.pe-dest-promo-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #e2e8f0;
}

.pe-dest-promo-feature i {
    color: #f58634;
    font-size: 14px;
}

.pe-dest-promo-btn {
    background: linear-gradient(135deg, #f58634 0%, #e07324 100%);
    color: #ffffff !important;
    font-weight: 700;
    font-size: 12.5px;
    border-radius: 8px;
    padding: 10px 16px;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(245, 134, 52, 0.35);
    transition: all 0.2s ease;
}

.pe-dest-promo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(245, 134, 52, 0.5);
    color: #ffffff !important;
}

/* ==========================================================================
   Compact Floating Luxury Card for Exams Dropdown
   ========================================================================== */

@media (min-width: 992px) {
    .nav-item.dropdown.pe-exam-dropdown {
        position: static !important;
    }

    /* Downward invisible hover bridge from Exams nav-link */
    .nav-item.dropdown.pe-exam-dropdown > .nav-link {
        position: relative;
    }
    .nav-item.dropdown.pe-exam-dropdown > .nav-link::after {
        content: '';
        position: absolute;
        left: -12px;
        right: -12px;
        top: 100%;
        height: 38px;
        background: transparent;
        z-index: 1005;
        pointer-events: auto;
    }

    /* Keep open on hover or active JS grace class */
    .nav-item.dropdown.pe-exam-dropdown:hover > .pe-exam-menu,
    .nav-item.dropdown.pe-exam-dropdown.is-open > .pe-exam-menu,
    .pe-exam-menu.is-open {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .pe-exam-menu {
        position: absolute !important;
        top: 100% !important; /* Starts cleanly below the header border line */
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 480px !important;
        max-width: calc(100vw - 32px) !important;
        border-radius: 16px !important;
        border: 1px solid rgba(226, 232, 240, 0.95) !important;
        box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.18), 0 0 1px 1px rgba(15, 23, 42, 0.05) !important;
        background: #ffffff !important;
        overflow: visible !important;
        padding: 0 !important;
        margin-top: 9px !important; /* Exactly touches the header bottom border (97px) */
        animation: peMenuFadeIn 0.18s ease-out !important;
        z-index: 1050 !important;
    }

    /* Upward invisible hover bridge */
    .pe-exam-menu::before {
        content: '' !important;
        position: absolute !important;
        top: -36px !important;
        left: 0 !important;
        right: 0 !important;
        height: 40px !important;
        background: transparent !important;
        z-index: 1000 !important;
        pointer-events: auto !important;
    }
}

/* Exam Menu Header: Clean Title Strip */
.pe-exam-menu-header {
    padding: 12px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}
.pe-exam-header-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #1e1b4b;
    letter-spacing: 0.2px;
}
.pe-exam-count-badge {
    font-size: 11px;
    font-weight: 700;
    color: #f58634;
    background: rgba(245, 134, 52, 0.1);
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

/* 2-Column Grid */
.pe-exam-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 12px 14px 16px 14px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}
.pe-exam-col {
    padding: 0 6px;
    display: flex;
    flex-direction: column;
}
.pe-exam-col:first-child {
    border-right: 1px solid #f1f5f9;
}
.pe-exam-cat-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #475569;
    margin-bottom: 6px;
    padding: 4px 6px;
}
.pe-exam-cat-title i {
    font-size: 14px;
    color: #f58634;
}

/* Individual Exam Item: Only Name, Icon, and Chevron */
.pe-exam-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 2px;
}
.pe-exam-item:hover {
    background: #fff8f1;
    padding-left: 14px;
}
.pe-exam-icon-box {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #f1f5f9;
    color: #1e1b4b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.18s ease;
}
.pe-exam-item:hover .pe-exam-icon-box {
    background: #f58634;
    color: #ffffff;
}
.pe-exam-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    flex-grow: 1;
    transition: color 0.18s ease;
}
.pe-exam-item:hover .pe-exam-name {
    color: #f58634;
}
.pe-exam-chevron {
    font-size: 15px;
    color: #f58634;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.18s ease;
    flex-shrink: 0;
}
.pe-exam-item:hover .pe-exam-chevron {
    opacity: 1;
    transform: translateX(0);
}

/* Exam Menu Bottom Footer Ribbon */
.pe-exam-footer {
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    padding: 10px 16px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}
.pe-exam-footer-text {
    font-size: 11px;
    color: #475569;
}
.pe-exam-footer-btn {
    background: linear-gradient(135deg, #f58634 0%, #e07324 100%);
    color: #ffffff !important;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(245, 134, 52, 0.3);
    transition: all 0.18s ease;
    white-space: nowrap;
}
.pe-exam-footer-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 134, 52, 0.45);
    color: #ffffff !important;
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
    .pe-exam-menu {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
        margin-top: 8px !important;
    }
    .pe-exam-cols {
        grid-template-columns: 1fr;
        padding: 10px 8px;
    }
    .pe-exam-col:first-child {
        border-right: none;
        border-bottom: 1px solid #f1f5f9;
        padding-bottom: 8px;
        margin-bottom: 8px;
    }
    .pe-exam-footer {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }
    .pe-exam-footer-btn {
        width: 100%;
        justify-content: center;
    }
}
