#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

/* Enhanced Topbar Mobile Styles */
@media (max-width: 991.98px) {
    .navbar-nav-wrap {
        padding: 0.5rem 1rem;
    }

    .navbar-topbar {
        padding: 0.5rem 0;
        background: #fff;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
    }

    .navbar-toggler {
        padding: 0.4rem;
        border: none;
        border-radius: 4px;
        transition: background-color 0.2s ease;
    }

    .navbar-toggler:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .navbar-toggler:focus {
        outline: none;
        box-shadow: 0 0 0 2px rgba(40, 125, 239, 0.25);
    }

    #topbarNavDropdown {
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        padding: 1rem;
        margin-top: 0.5rem;
    }

    .navbar-topbar-collapse {
        max-height: 85vh;
        overflow-y: auto;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }

    .nav-link:hover {
        background-color: rgba(40, 125, 239, 0.05);
    }

    .hs-mega-menu {
        border: none !important;
        box-shadow: none !important;
        padding: 0 0 0 1rem !important;
        margin-top: 0.5rem !important;
    }
}

/* Mobile-friendly footer styles */
@media (max-width: 480px) {
    footer .container {
        padding: 2rem 1rem;
    }

    footer .col-lg-3 {
        margin-bottom: 2rem !important;
    }

    footer .mb-7 {
        margin-bottom: 1.5rem !important;
    }

    footer h5 {
        text-align: center;
        margin-bottom: 1rem !important;
    }

    footer .list-unstyled {
        text-align: center;
    }

    footer .navbar-brand img {
        width: 140px;
        margin: 0 auto;
    }

    footer .list-py-1 > li {
        margin-bottom: 0.5rem;
    }

    /* Two-column layout for small screens */
    footer .row.content-space-t-2 {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    footer .col-lg-3 {
        width: 100%;
        margin-bottom: 2rem !important;
    }

    footer .col-sm {
        width: 50% !important;
        margin-bottom: 1.5rem !important;
        padding: 0 1rem;
    }

    footer .col-sm:last-child {
        margin-bottom: 1.5rem !important;
    }

    /* Single row for policy links */
    footer .list-inline {
        display: flex;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 0.5rem;
        margin: 0;
        padding: 0;
        list-style: none;
        font-size: 0.875rem;
    }

    footer .list-inline-item {
        margin: 0;
        white-space: nowrap;
    }

    footer .list-inline-item:not(:last-child):after {
        content: "/";
        margin-left: 0.5rem;
        color: rgba(0, 0, 0, 0.3);
    }

    footer .list-separator .list-inline-item:not(:last-child) {
        padding-right: 0;
        margin-right: 0;
    }
}

@media (max-width: 991.98px) {
    footer .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    footer .row {
        row-gap: 2rem;
    }

    footer .col-lg-3 {
        margin-bottom: 1rem !important;
    }

    footer img {
        width: 150px;
    }
}

@media (max-width: 768px) {
    footer {
        padding-bottom: 60px !important;
    }

    footer .container {
        padding-bottom: 1rem !important;
    }

    footer .row {
        text-align: center;
    }

    footer .col-sm {
        margin-bottom: 2rem !important;
    }

    footer .list-unstyled {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    footer h5 {
        margin-bottom: 1rem !important;
    }

    footer .list-py-1 > * {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    footer .mb-7 {
        margin-bottom: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    footer .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    footer img {
        width: 120px;
    }

    footer h5 {
        font-size: 1.1rem;
    }

    footer .link-sm {
        font-size: 0.9rem;
    }
}

/* Mobile-friendly pricing table styles */
@media (max-width: 768px) {
    .table-responsive-lg {
        margin: 0;
        padding: 0;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-lg {
        width: 100%;
        margin-bottom: 0;
    }

    .table-lg th,
    .table-lg td {
        min-width: 140px;
        padding: 1rem;
        vertical-align: middle;
    }

    .table-lg th:first-child,
    .table-lg td:first-child {
        min-width: 180px;
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 1;
        box-shadow: 2px 0 5px -2px rgba(0,0,0,0.1);
    }

    .table-text-center {
        text-align: center !important;
    }

    .badge {
        white-space: normal;
        text-align: center;
        display: inline-block;
        margin: 0.25rem 0;
        line-height: 1.4;
    }

    .table-lg .btn {
        white-space: nowrap;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        margin: 0.5rem 0;
    }

    .table thead th {
        border-bottom: 2px solid #e7eaf3;
    }
}

@media (max-width: 480px) {
    .table-lg th,
    .table-lg td {
        min-width: 120px;
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    .table-lg th:first-child,
    .table-lg td:first-child {
        min-width: 160px;
        font-size: 0.875rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
        display: inline-block;
        width: auto;
        max-width: 100%;
    }

    .table-lg .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8125rem;
    }

    .table-striped tbody tr:nth-of-type(odd) {
        background-color: rgba(0,0,0,.02);
    }
}

/* Mobile-friendly pricing table styles */
@media (max-width: 768px) {
    /* Hide table on mobile */
    .table-responsive-lg table {
        display: none;
    }

    /* Show cards instead */
    .table-responsive-lg {
        display: flex;
        flex-direction: column;
        gap: 2rem;
        margin: 0;
        padding: 0;
        width: 100%;
    }

    /* Create mobile pricing cards */
    .table-responsive-lg:after {
        content: "";
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Academic Version Card */
    .table-responsive-lg:before {
        content: "";
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .pricing-cards {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
        width: 100%;
    }

    .pricing-card {
        background: #fff;
        border: 1px solid #e7eaf3;
        border-radius: 0.5rem;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .pricing-card-header {
        text-align: center;
        padding-bottom: 1rem;
        border-bottom: 1px solid #e7eaf3;
    }

    .pricing-card-header h3 {
        margin: 0;
        font-size: 1.25rem;
        color: #1e2022;
    }

    .pricing-card-header .badge {
        margin-top: 0.5rem;
    }

    .pricing-feature {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.5rem 0;
    }

    .pricing-feature-label {
        flex: 1;
        font-size: 0.875rem;
        color: #677788;
    }

    .pricing-feature-value {
        font-size: 0.875rem;
        color: #1e2022;
    }

    .pricing-card-footer {
        margin-top: auto;
        padding-top: 1rem;
        text-align: center;
    }

    .pricing-card .badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
    }

    .pricing-card .btn {
        width: 100%;
        margin-top: 1rem;
    }

    /* Feature availability indicators */
    .feature-check {
        color: #00c9a7;
        font-size: 1.25rem;
    }

    .feature-none {
        color: #e7eaf3;
        font-size: 1.25rem;
    }
}

/* FAQ Styles */
.accordion-lg .accordion-button {
    padding: 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: #21325b;
    background: #fff;
    transition: all 0.3s ease;
}

.accordion-lg .accordion-button:not(.collapsed) {
    color: #0052ea;
    background-color: #f8fafd;
    box-shadow: none;
}

.accordion-lg .accordion-button:hover {
    background-color: #f8fafd;
}

.accordion-lg .accordion-body {
    padding: 1.5rem;
    font-size: 1rem;
    color: #677788;
    line-height: 1.7;
}

.accordion-lg .accordion-item {
    transition: all 0.3s ease;
}

.accordion-lg .accordion-item:hover {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .accordion-lg .accordion-button {
        padding: 1.25rem;
        font-size: 1rem;
    }

    .accordion-lg .accordion-body {
        padding: 1.25rem;
        font-size: 0.9375rem;
    }

    .accordion-lg .accordion-item {
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 480px) {
    .accordion-lg .accordion-button {
        padding: 1rem;
        font-size: 0.9375rem;
    }

    .accordion-lg .accordion-body {
        padding: 1rem;
        font-size: 0.875rem;
    }
}

/* Mobile Icon Navigation */
.mobile-icon-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    z-index: 1030;
    height: 45px;
}

.mobile-icon-nav .nav-icons {
    display: flex;
    justify-content: space-around;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 4px 0;
    height: 100%;
}

.mobile-icon-nav .nav-icon-item {
    text-align: center;
    flex: 1;
}

.mobile-icon-nav .nav-icon-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #677788;
    text-decoration: none;
    font-size: 0.65rem;
    height: 100%;
}

.mobile-icon-nav .nav-icon-link.commercial {
    color: #dc3545;
}

.mobile-icon-nav .nav-icon-link.commercial:hover {
    color: #bb2d3b;
}

.mobile-icon-nav .nav-icon-link:hover {
    color: #287def;
}

.mobile-icon-nav .nav-icon {
    font-size: 1.1rem;
    margin-bottom: 1px;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 45px;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    z-index: 1029;
}

.mobile-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    padding: 0 16px;
}

.mobile-header .navbar-brand {
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

.mobile-header .navbar-brand img {
    height: 50px;
    width: auto;
    max-width: none;
}

.mobile-header .navbar-toggler {
    padding: 8px 12px;
    border: 1px solid #e7eaf3;
    border-radius: 4px;
}

.mobile-header .navbar-toggler:focus {
    box-shadow: none;
    border-color: #287def;
}

/* Mobile Navigation Menu */
.mobile-header .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.mobile-header .nav-link {
    padding: 0.75rem 1rem;
    color: #677788;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.mobile-header .nav-link:hover {
    background-color: #f8f9fa;
    color: #287def;
}

.mobile-header .nav-link.text-primary {
    color: #287def !important;
}

.mobile-header .nav-link.text-primary:hover {
    background-color: rgba(40, 125, 239, 0.1);
}

@media (max-width: 991.98px) {
    .mobile-icon-nav,
    .mobile-header {
        display: block;
    }

    .navbar-topbar {
        display: none !important;
    }

    #header {
        display: none !important;
    }

    main {
        padding-top: 105px;
    }

    /* Fix for publications page - ensure content is below the mobile header */
    body:has(.featured-publication-card) main {
        padding-top: 105px !important;
    }

    /* Ensure proper spacing on publications page */
    .publications-page main {
        padding-top: 105px !important;
    }

    /* Ensure the heading is visible and not behind the header */
    .publications-page .container.content-space-3 {
        padding-top: 3.5rem !important;
    }

    /* Add extra space for the heading on mobile */
    .publications-page .border-top {
        padding-top: 2rem;
    }

    /* Additional spacing for the heading */
    .publications-page main {
        padding-top: 120px !important;
    }
}

/* Featured Publications Styling */
.featured-publication-card {
    background-color: #f8f9fa;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.featured-publication-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Special styling for the book card */
.featured-book-card {
    background-color: #e8f4ff;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.featured-book-card:before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 50px 50px 0;
    border-color: transparent #377dff transparent transparent;
    z-index: 1;
}

.featured-book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Common styling for all publication cards */
.publication-img-container {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.publication-img-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.publication-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    height: 2.8rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.publication-authors {
    font-size: 0.875rem;
    color: #677788;
    margin-bottom: 1rem;
    height: 1.3rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.read-btn {
    width: 100%;
    padding: 0.5rem 1rem;
}

/* Make content text justified rather than centered */
.card-text {
    text-align: justify;
}

/* Keep selection parts centered */
.nav-segment {
    text-align: center;
}

/* Responsive adjustments for featured publications */
@media (max-width: 991.98px) {
    .publication-title {
        height: 4.2rem;
        -webkit-line-clamp: 3;
    }

    /* Reduce spacing on mobile devices */
    main#content {
        padding-top: 0 !important;
    }

    /* Ensure proper spacing for content */
    .content-space-3 {
        padding-top: 3.5rem !important;
    }

    /* Reduce spacing between header and content on mobile */
    .border-top {
        margin-top: 0;
    }

    /* Adjust heading spacing */
    .mb-7 {
        margin-bottom: 2rem !important;
    }

    /* Specific fix for publications page heading */
    .publications-page .w-lg-50.text-center.mx-lg-auto.mb-7 {
        margin-top: 2.5rem !important;
    }
}

@media (max-width: 767.98px) {
    .publication-img-container {
        height: 160px;
    }

    /* Further reduce spacing on smaller devices */
    .content-space-2 {
        padding-top: 1.5rem !important;
    }

    /* Adjust heading spacing */
    .w-lg-50.text-center.mx-lg-auto.mb-7 {
        margin-bottom: 1.5rem !important;
    }
}

/* Hero Section Responsive Styles */
@media (min-width: 992px) {
    .container.d-lg-flex.align-items-lg-center.content-space-t-1.content-space-lg-1.min-vh-lg-100 {
        align-items: flex-start !important;
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }
    .col-lg-8.content-space-1 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    .display-5.mb-5 {
        margin-bottom: 2rem !important;
        padding-top: 1.5rem !important;
        padding-left: 0.5rem !important;
        text-align: left !important;
    }
}

@media (max-width: 991.98px) {
    .content-space-t-1 {
        padding-top: 1.5rem !important;
    }

    .content-space-b-2 {
        padding-bottom: 2rem !important;
    }

    .content-space-1 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    #welcome h1 {
        font-size: 2.25rem;
        margin-bottom: 1rem;
    }

    #welcome p {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }

    #welcome ul {
        margin-bottom: 1rem;
    }

    #welcome li {
        font-size: 0.95rem;
        line-height: 1.4;
        margin-bottom: 0.5rem;
    }

    #welcome .btn {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }

    #welcome .col-lg-6:first-child {
        margin-bottom: 2rem;
    }

    #welcome img {
        max-width: 100%;
        height: auto;
        margin: 0 auto;
        display: block;
    }

    /* Download page responsive styles */
    .content-space-t-5 {
        padding-top: 3rem !important;
    }

    .content-space-b-lg-5 {
        padding-bottom: 3rem !important;
    }

    /* Adjust sidebar on mobile */
    .col-md-4.col-lg-3.mb-9.mb-md-0 {
        margin-bottom: 2rem !important;
    }

    /* Center the download button on mobile */
    .d-grid.mb-7 {
        text-align: center;
    }

    /* Make the download button more visible */
    .btn-sm.btn-block.btn-primary {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    /* Improve tab navigation on mobile */
    .js-nav-scroller {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1.5rem !important;
    }

    .nav-segment {
        flex-wrap: nowrap;
        width: 100%;
    }

    .nav-segment .nav-link {
        white-space: nowrap;
        padding: 0.75rem 1.25rem;
    }

    /* Improve table display on mobile */
    .table-responsive {
        margin-bottom: 1.5rem;
    }

    .table-thead-bordered th {
        font-size: 0.875rem;
    }

    .table-align-middle td {
        padding: 1rem 0.75rem;
    }

    /* Make download buttons more prominent */
    .btn-ghost-secondary {
        border: 1px solid #e7eaf3;
    }

    /* Medium-sized screens table adjustments */
    .download-table {
        width: 100%;
    }

    /* Ensure table cells have proper spacing */
    .download-table td {
        padding: 0.75rem;
        vertical-align: middle;
    }

    /* Ensure buttons are properly aligned */
    .download-table .btn {
        white-space: nowrap;
    }

    /* Ensure table doesn't overflow */
    .card-table {
        width: 100%;
        margin-bottom: 0;
    }
}

@media (max-width: 575.98px) {
    .content-space-t-1 {
        padding-top: 1rem !important;
    }

    .content-space-b-2 {
        padding-bottom: 1.5rem !important;
    }

    #welcome h1 {
        font-size: 2rem;
    }

    #welcome p {
        font-size: 0.95rem;
    }

    #welcome li {
        font-size: 0.9rem;
    }

    /* Download page small screen styles */
    .col-md-4.col-lg-3 {
        text-align: center;
    }

    .avatar-xl.avatar-4x3 {
        width: 120px;
        height: auto;
        margin: 0 auto 1rem;
    }

    .d-none.d-md-block {
        display: block !important;
        text-align: center;
        margin-bottom: 1.5rem !important;
    }

    .list-pointer {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Transform tables to card layout on small screens */
    /* Hide table headers on small screens */
    .download-table thead {
        display: none;
    }

    /* Make each row a card */
    .download-table tbody tr {
        display: flex;
        flex-direction: column;
        border: 1px solid #e7eaf3;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    /* Style each cell as a row in the card */
    .download-table tbody td {
        display: flex;
        padding: 0.5rem 0;
        border: none;
        text-align: left;
    }

    /* Add labels for each cell */
    .download-table tbody td:nth-child(1)::before {
        content: "File Name: ";
        font-weight: 600;
        min-width: 100px;
        margin-right: 0.5rem;
    }

    .download-table tbody td:nth-child(2)::before {
        content: "Release Date: ";
        font-weight: 600;
        min-width: 100px;
        margin-right: 0.5rem;
    }

    .download-table tbody td:nth-child(3)::before {
        content: "Info: ";
        font-weight: 600;
        min-width: 100px;
        margin-right: 0.5rem;
    }

    /* Style the action buttons */
    .download-table tbody td:nth-child(4) {
        padding-top: 1rem;
        margin-top: 0.5rem;
        border-top: 1px solid #e7eaf3;
    }

    .download-table tbody td:nth-child(4) a {
        width: 100%;
        justify-content: center;
    }

    /* Fix alignment issues */
    .download-table .d-flex.align-items-center {
        width: 100%;
    }

    /* Make buttons more accessible */
    .btn-ghost-secondary {
        width: 100%;
        margin-top: 0.5rem;
        text-align: center;
        justify-content: center;
    }

    /* Fix button alignment */
    .download-table .btn-ghost-secondary {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile-specific enhancements */
    .download-table.mobile-view {
        background-color: transparent;
        border: none;
    }

    .download-table.mobile-view tbody tr {
        background-color: #fff;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .download-table.mobile-view tbody tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

    /* Enhanced buttons for mobile */
    .btn-ghost-secondary.mobile-btn {
        background-color: #f8f9fa;
        border: 1px solid #dee2e6;
        color: #287def;
        font-weight: 500;
        padding: 0.625rem 1rem;
        transition: all 0.2s ease;
    }

    .btn-ghost-secondary.mobile-btn:hover {
        background-color: #287def;
        border-color: #287def;
        color: #fff;
    }

    /* Improve OPStudio tab display */
    #featuresTwo .card {
        padding: 1rem;
    }

    #featuresTwo .card-title {
        font-size: 1.25rem;
    }

    #featuresTwo .card-text {
        font-size: 0.875rem;
    }

    #featuresTwo video {
        width: 100% !important;
        height: auto !important;
    }
}