/* Shop by Exam Bar */
:root {
    --shop-by-exam-bar-height: 60px; /* desktop: py-3 + content + border */
}
@media (max-width: 768px) {
    :root {
        --shop-by-exam-bar-height: 54px; /* mobile bar height */
    }
}

.shop-by-exam-bar-wrapper {
    position: relative;
    z-index: 998;
    padding-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: calc(-1.3 * var(--shop-by-exam-bar-height)) !important;
    overflow: visible;
}

.shop-by-exam-bar {
    background-color: #F6F7FB; /* match exam info / main content area gray */
    border-radius: 0 0 12px 12px;
    border: 2px solid #E3E0CF;
    border-top: none;
    margin-top: -30px;
    position: relative;
    box-shadow: 0 2px 8px var(--black-10);
    transition: border-radius 0.3s ease, box-shadow 0.3s ease;
    width: fit-content;
    max-width: 100%;
    min-width: fit-content;
    z-index: 998;
}

.shop-by-exam-bar-wrapper.expanded .shop-by-exam-bar {
    border-radius: 0;
    box-shadow: 0 2px 8px var(--black-10);
}

.shop-by-exam-title {
    padding-left: 24px;
}

.shop-by-exam-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--actex-navy);
    margin: 0;
    font-family: 'Figtree', sans-serif;
}

.exam-category-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 24px;
}

.exam-category-btn {
    background-color: rgba(255, 203, 5, 0.2);
    color: var(--actex-navy);
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Figtree', sans-serif;
    transition: all 0.2s;
    white-space: nowrap;
}

.exam-category-btn:hover {
    background-color: rgba(255, 203, 5, 0.3);
    color: var(--actex-navy);
    transform: translateY(-2px);
}

.exam-category-btn.active {
    background-color: var(--actex-yellow);
    color: var(--actex-navy);
    box-shadow: none;
}

.textbooks-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;
}

.textbooks-link-text {
    color: #242424;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Figtree', sans-serif;
    transition: color 0.2s;
}

.shop-by-exam-separator {
    width: 1px;
    background-color: #E3E0CF;
    margin: -1rem 16px;
    align-self: stretch;
}

.textbooks-link-text:hover {
    color: var(--aqua);
}

/* Shop by Exam Expandable Content */
.shop-by-exam-expandable {
    background-color: var(--white);
    border-radius: 0 0 12px 12px;
    border: 2px solid #E3E0CF;
    border-top: 1px solid #E3E0CF;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0;
    overflow: visible;
    width: 0;
    opacity: 0;
    visibility: hidden;
    z-index: 999;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.shop-by-exam-expandable:not(.d-none) {
    opacity: 1;
    visibility: visible;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shop-by-exam-content {
    min-height: 100px;
}

.shop-by-exam-expandable .shop-by-exam-content {
    padding: 24px 0;
}

/* Shop by Exam Content Styling */
.shop-by-exam-header-tag {
    display: inline-flex;
    align-items: center;
    position: relative;
    margin-bottom: 16px;
    height: 16px;
}

.shop-by-exam-header-tag svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 16px;
    pointer-events: none;
}

.shop-by-exam-header-text {
    position: relative;
    z-index: 1;
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    font-family: 'Figtree', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    white-space: nowrap;
}

.shop-by-exam-column {
    position: relative;
}

/* Align second column (and subsequent columns without headers) with first column's exam list */
.shop-by-exam-column-no-header {
    padding-top: 32px; /* Header height (16px) + margin-bottom (16px) */
}

/* Remove default dividers */
.shop-by-exam-expandable .row > .shop-by-exam-column::after {
    display: none;
}

/* Only show thinner divider on the last column */
.shop-by-exam-expandable .row > .shop-by-exam-column-last::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0.5px;
    background-color: #E3E0CF;
}

.shop-by-exam-column-divider {
    display: none;
}

.shop-by-exam-exam-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shop-by-exam-exam-item {
    margin-bottom: 12px;
}

.shop-by-exam-exam-link {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
    flex-wrap: wrap;
}

.shop-by-exam-exam-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    display: inline-block;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 5px;
}

.shop-by-exam-exam-link-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.shop-by-exam-exam-link:hover {
    opacity: 0.8;
}

.shop-by-exam-exam-code {
    color: var(--actex-navy);
    font-weight: 600;
    font-size: 16px;
    font-family: 'Figtree', sans-serif;
    margin-right: 8px;
    min-width: 60px;
    display: block;
    width: 100%;
}

.shop-by-exam-exam-name {
    color: #81A5BF;
    font-style: normal;
    font-size: 12px;
    font-family: 'Figtree', sans-serif;
    flex: 1;
    display: block;
    width: 100%;
    margin-top: 2px;
}

/* Show mobile logo on medium screens (768px to 991px) */
@media (min-width: 768px) and (max-width: 1200px) {
    .shop-by-exam-bar-wrapper {
        padding-top: 20px;
    }

    .shop-by-exam-bar,
    .shop-by-exam-expandable {
        margin-left: 8px;
        margin-right: 8px;
    }

    .shop-by-exam-bar {
        margin-top: -20px;
    }

    .shop-by-exam-expandable {
        margin-top: -12px;
    }

    .shop-by-exam-separator {
        margin: 0 12px;
    }

    .exam-category-buttons {
        gap: 8px;
        margin: 0 12px;
    }

    .exam-category-btn {
        padding: 6px 16px;
        font-size: 14px;
    }

    .shop-by-exam-title h2 {
        font-size: 16px;
    }

    .textbooks-link-text {
        font-size: 14px;
    }

    .exam-category-btn {
        font-size: 12px;
    }
}

@media (max-width: 767px) {
    .shop-by-exam-bar-wrapper {
        padding-top: 15px;
        max-width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        z-index: 10002; /* Higher than mobile bar (10001) and dropdown (9999) */
    }

    .shop-by-exam-bar,
    .shop-by-exam-expandable {
        margin-left: 0;
        margin-right: 0;
    }

    .shop-by-exam-bar {
        margin-top: 0;
        border-radius: 0;
    }

    .shop-by-exam-expandable {
        margin-top: -12px;
        border-radius: 0;
        display: none !important; /* Hide desktop expandable on mobile */
    }

    .shop-by-exam-separator {
        display: none;
    }

    .shop-by-exam-bar .container-fluid > div {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .shop-by-exam-title {
        width: 100%;
    }

    .exam-category-buttons {
        width: 100%;
        justify-content: flex-start;
        margin: 0;
    }

    .textbooks-link {
        width: 100%;
    }

    /* Hide desktop version on mobile */
    .shop-by-exam-desktop {
        display: none !important;
    }

    /* Show mobile version on mobile */
    .shop-by-exam-mobile {
        display: block !important;
        width: 95% !important;
        max-width: 95% !important;
        min-width: 95% !important;
        height: 54px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        border-radius: 100px !important;
        border: 1px solid #E3E0CF !important;
        position: relative !important;
        z-index: 10001 !important; /* Higher than dropdown to stay on top */
    }

    /* Mobile Container */
    .shop-by-exam-mobile-container {
        padding: 0;
        height: 100%;
        display: flex;
        align-items: center;
    }

    /* Mobile Scroll Wrapper - contains buttons and scrollable content */
    .shop-by-exam-mobile-scroll-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        overflow: hidden;
        height: 100%;
        padding-right: 5px;
    }

    /* Scrollable Content Container (Title + Buttons) */
    .shop-by-exam-mobile-scrollable {
        display: flex;
        align-items: center;
        gap: 12px;
        overflow-x: scroll;
        overflow-y: hidden;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        flex: 1;
        padding-left: 16px; /* Prevent content from overflowing on the left */
        padding-right: 3px; /* Stop content 3px before the end */
        border-bottom-left-radius: 100px;
        border-top-left-radius: 100px;
    }

    .shop-by-exam-mobile-scrollable::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }

    /* Mobile Shop by Exam Title */
    .shop-by-exam-title-mobile {
        padding-left: 16px;
        padding-right: 0;
        flex-shrink: 0;
    }

    .shop-by-exam-title-mobile h2 {
        font-size: 16px;
        font-weight: 600;
        color: var(--actex-navy);
        margin: 0;
        font-family: 'Figtree', sans-serif;
        white-space: nowrap;
    }

    /* Exam Category Buttons Container */
    .exam-category-buttons-mobile {
        display: flex;
        gap: 12px;
        flex-shrink: 0;
    }

    /* Mobile Exam Category Buttons */
    .exam-category-btn-mobile {
        background-color: rgba(255, 203, 5, 0.2);
        color: var(--actex-navy);
        text-decoration: none;
        padding: 8px 20px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 500;
        font-family: 'Figtree', sans-serif;
        transition: all 0.2s;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .exam-category-btn-mobile:hover {
        background-color: rgba(255, 203, 5, 0.3);
        color: var(--actex-navy);
    }

    .exam-category-btn-mobile.active {
        background-color: var(--actex-yellow);
        color: var(--actex-navy);
    }

    /* Scroll Indicator (non-clickable) - Semicircle with chevron */
    .shop-by-exam-scroll-indicator {
        width: 27px !important;
        height: 54px !important;
        border-radius: 0 27px 27px 0 !important;
        background-color: var(--white);
        border: 1px solid #E3E0CF;
        border-left: none;
        display: flex !important;
        align-items: center;
        justify-content: center;
        cursor: default !important;
        pointer-events: none !important;
        position: absolute;
        z-index: 10;
        transition: all 0.2s;
        color: var(--actex-navy);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        top: 50%;
        transform: translateY(-50%);
        flex-shrink: 0;
        box-sizing: border-box;
        right: 0;
        user-select: none;
    }
    
    /* Ensure no button-like interactions */
    .shop-by-exam-scroll-indicator:hover,
    .shop-by-exam-scroll-indicator:active,
    .shop-by-exam-scroll-indicator:focus {
        background-color: var(--white) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        transform: translateY(-50%) !important;
        cursor: default !important;
        outline: none !important;
    }

    .shop-by-exam-scroll-indicator svg {
        width: 24px;
        height: 24px;
    }

    /* Hide scroll indicator when scrolling is not available */
    .shop-by-exam-scroll-indicator.hidden {
        display: none !important;
    }

    /* Mobile Dropdown Modal */
    .shop-by-exam-mobile-dropdown {
        position: fixed !important;
        inset: 0 !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: flex-start;
        justify-content: center;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        pointer-events: none !important; /* Don't block clicks on container */
    }

    .shop-by-exam-mobile-dropdown.d-none,
    .shop-by-exam-mobile-dropdown.mobile-dropdown-hidden {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    .shop-by-exam-mobile-dropdown:not(.d-none):not(.mobile-dropdown-hidden),
    .shop-by-exam-mobile-dropdown.mobile-dropdown-open {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Disable box-shadow on shop-by-exam bar when dropdown is open */
    body:has(.shop-by-exam-mobile-dropdown.mobile-dropdown-open) .shop-by-exam-bar-wrapper .shop-by-exam-bar,
    body:has(.shop-by-exam-mobile-dropdown.mobile-dropdown-open) .shop-by-exam-bar-wrapper .shop-by-exam-mobile {
        box-shadow: none !important;
    }

    .shop-by-exam-mobile-dropdown-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: transparent; /* No dark overlay */
        z-index: 1;
        pointer-events: none; /* Don't intercept clicks */
    }

    .shop-by-exam-mobile-dropdown-content {
        position: absolute;
        top: 102px;
        z-index: 2;
        background-color: var(--white);
        width: 100%;
        max-width: 95% !important;
        max-height: 70vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        padding: 16px;
        box-sizing: border-box;
        pointer-events: auto;
        border-bottom-left-radius: 24px !important;
        border-bottom-right-radius: 24px !important;
        box-shadow: 0px 8px 14px 0px #0000001A, 0px 4px 8px 0px #00000040;
        border: 1px solid #ECF1F4;
        padding-top: 50px;
    }

    /* Mobile Dropdown Header */
    .shop-by-exam-mobile-dropdown-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 24px;
        padding-bottom: 16px;
        border-bottom: 1px solid #E3E0CF;
    }

    .shop-by-exam-mobile-dropdown-title {
        color: var(--actex-navy);
        font-size: 18px;
        font-weight: 600;
        font-family: 'Figtree', sans-serif;
        margin: 0;
    }

    .shop-by-exam-mobile-dropdown-close {
        background: var(--white);
        border: 1px solid #E3E0CF;
        padding: 0;
        cursor: pointer;
        color: var(--actex-navy);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        transition: background-color 0.2s;
    }

    .shop-by-exam-mobile-dropdown-close:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .shop-by-exam-mobile-dropdown-close svg {
        width: 24px;
        height: 24px;
    }

    /* Mobile Dropdown Category Buttons */
    .shop-by-exam-mobile-dropdown-categories {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 24px;
        padding-bottom: 24px;
        border-bottom: 1px solid #E3E0CF;
    }

    .shop-by-exam-mobile-dropdown-category-btn {
        background-color: rgba(255, 203, 5, 0.2);
        color: var(--actex-navy);
        text-decoration: none;
        padding: 8px 20px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 500;
        font-family: 'Figtree', sans-serif;
        transition: all 0.2s;
        white-space: nowrap;
        display: inline-block;
    }

    .shop-by-exam-mobile-dropdown-category-btn:hover {
        background-color: rgba(255, 203, 5, 0.3);
        color: var(--actex-navy);
    }

    .shop-by-exam-mobile-dropdown-category-btn.active {
        background-color: var(--actex-yellow);
        color: var(--actex-navy);
    }

    /* Mobile Dropdown Exam List */
    .shop-by-exam-mobile-dropdown-exams {
        flex: 0 1 auto;
        overflow-y: auto;
        padding-top: 0;
    }

    .shop-by-exam-mobile-dropdown-header-tag {
        display: inline-flex;
        align-items: center;
        position: relative;
        margin-bottom: 16px;
        margin-top: 24px;
        height: 16px;
    }

    .shop-by-exam-mobile-dropdown-header-tag:first-child {
        margin-top: 0;
    }

    .shop-by-exam-mobile-dropdown-header-tag svg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 16px;
        pointer-events: none;
    }

    .shop-by-exam-mobile-dropdown-header-text {
        position: relative;
        z-index: 1;
        color: var(--white);
        font-size: 12px;
        font-weight: 600;
        font-family: 'Figtree', sans-serif;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        padding: 4px 12px;
        white-space: nowrap;
    }

    .shop-by-exam-mobile-dropdown-exam-list {
        list-style: none;
        padding: 0;
        margin: 0 0 24px 0;
    }

    .shop-by-exam-mobile-dropdown-exam-item {
        margin-bottom: 12px;
    }

    .shop-by-exam-mobile-dropdown-exam-link {
        display: flex;
        align-items: flex-start;
        text-decoration: none;
        color: inherit;
        transition: opacity 0.2s;
        flex-wrap: wrap;
    }

    .shop-by-exam-mobile-dropdown-exam-icon {
        width: 16px;
        height: 16px;
        margin-right: 8px;
        display: inline-block;
        flex-shrink: 0;
        align-self: flex-start;
        margin-top: 5px;
    }

    .shop-by-exam-mobile-dropdown-exam-link-content {
        display: flex;
        flex-direction: column;
        flex: 1;
    }

    .shop-by-exam-mobile-dropdown-exam-link:hover {
        opacity: 0.8;
    }

    .shop-by-exam-mobile-dropdown-exam-code {
        color: var(--actex-navy);
        font-weight: 600;
        font-size: 16px;
        font-family: 'Figtree', sans-serif;
        margin-right: 8px;
        min-width: 60px;
        display: block;
        width: 100%;
    }

    .shop-by-exam-mobile-dropdown-exam-name {
        color: #81A5BF;
        font-style: italic;
        font-size: 12px;
        font-family: 'Figtree', sans-serif;
        flex: 1;
        display: block;
        width: 100%;
        margin-top: 2px;
    }
}

/* Desktop: Hide mobile version, show desktop version */
@media (min-width: 768px) {
    .shop-by-exam-desktop {
        display: block !important;
    }

    .shop-by-exam-mobile {
        display: none !important;
    }

    /* Hide mobile dropdown on desktop */
    .shop-by-exam-mobile-dropdown {
        display: none !important;
    }

    /* Show desktop expandable on desktop */
    .shop-by-exam-expandable {
        display: block !important;
    }
}

