/**
 * Shared mobile app shell (Home, Events, Race Results, Profile).
 * Homepage content styles stay on .page-home. Desktop navbar is unchanged.
 */
.page-app-shell {
    --home-app-pad: 16px;
    --home-app-radius: 16px;
    --home-touch: 44px;
    --home-bottom-nav: 56px;
}

.home-app-header,
.home-bottom-nav {
    display: none;
}

.page-home .event-type-card {
    background: transparent;
    border: 0;
    padding: 0;
    color: inherit;
    cursor: pointer;
    text-align: center;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.page-home .event-type-card:not(.typeFilter) {
    cursor: default;
}

.page-home .event-type-card.typeFilter[aria-pressed="true"] .icon-circle {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--blue-color);
}

.page-home .home-event-date {
    display: none;
}

.page-home .event-type-card:focus-visible,
.page-home .home-filter-btn:focus-visible,
.page-home .city-btn:focus-visible,
.page-home .login-btn:focus-visible,
.page-home .header-search:focus-visible,
.page-app-shell .home-app-location:focus-visible,
.page-app-shell .home-bottom-nav__item:focus-visible {
    outline: 2px solid var(--blue-color);
    outline-offset: 2px;
}

/* ---------- Mobile: dedicated app shell ---------- */
@media screen and (max-width: 767.98px) {
    .page-home {
        background: #f7f7f8;
    }

    .page-app-shell {
        padding-top: 0 !important;
        padding-bottom: calc(var(--home-bottom-nav) + 12px + env(safe-area-inset-bottom, 0px));
    }

    .page-app-shell > .navbar,
    .page-app-shell > .sub-navbar {
        display: none !important;
    }

    .page-race-result .race_result_bg_with_image,
    .page-race-result .race_result_bg_with_image2 {
        padding-top: 16px;
    }

    .page-app-shell .home-app-header {
        display: block;
        position: sticky;
        top: 0;
        z-index: 1100;
        background: #fff;
        box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
        padding: 10px var(--home-app-pad) 8px;
        padding-top: max(10px, env(safe-area-inset-top, 0px));
    }

    .page-app-shell .home-app-bar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 8px;
        min-height: var(--home-touch);
    }

    .page-app-shell .home-app-logo {
        display: flex;
        align-items: center;
        flex: 0 0 auto;
    }

    .page-app-shell .home-app-logo img {
        height: 34px;
        width: auto;
        display: block;
    }

    .page-app-shell .home-app-location {
        min-width: 0;
        min-height: var(--home-touch);
        max-width: 100%;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 0 10px;
        border: 0;
        border-radius: 12px;
        background: #f5f5f5;
        color: #111;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.2;
        text-align: left;
    }

    .page-app-shell .home-app-location .location-icon {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
    }

    .page-app-shell .home-app-location .navbar-city-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-app-shell .home-app-location .bi {
        font-size: 12px;
        color: #606060;
        flex-shrink: 0;
    }

    .page-app-shell .home-app-account {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 4px;
        min-height: var(--home-touch);
    }

    .page-app-shell .home-app-account .login-btn,
    .page-app-shell .home-app-account .btn-notification,
    .page-app-shell .home-app-account .profile-dropdown .nav-link,
    .page-app-shell .home-app-account .profile-dropdown img {
        min-width: var(--home-touch);
        min-height: var(--home-touch);
        width: var(--home-touch);
        height: var(--home-touch);
        margin: 0;
    }

    .page-app-shell .home-app-account .login-btn {
        padding: 0;
        border-radius: 12px;
        font-size: 0;
        line-height: 0;
    }

    .page-app-shell .home-app-account .login-btn::before {
        content: "\f007";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        font-size: 16px;
        line-height: var(--home-touch);
        color: #111;
    }

    .page-app-shell .home-app-account .profile-dropdown,
    .page-app-shell .home-app-account .notification-nav-wrap,
    .page-app-shell .home-app-account .navbar-nav {
        margin: 0;
    }

    .page-app-shell .home-app-account .profile-dropdown img {
        border-radius: 50%;
        object-fit: cover;
    }

    .page-app-shell .home-app-search {
        margin-top: 8px;
    }

    .page-app-shell .home-app-search .search-container,
    .page-app-shell .home-app-search [role="search"] {
        width: 100%;
        min-width: 0;
    }

    .page-app-shell .home-app-search .header-search {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 48px !important;
        font-size: 16px !important;
        border-radius: 14px;
        padding-left: 44px;
        padding-right: 14px;
        background: #f5f5f5;
        border: 1px solid #ececec;
        color: #212529;
    }

    .page-app-shell .home-app-search .search-icon {
        left: 16px;
        font-size: 16px;
        pointer-events: none;
    }

    .page-app-shell .home-app-search #searchResults {
        max-height: 50vh;
        border-radius: 12px;
    }

    .page-app-shell .home-app-quicknav {
        margin: 8px 0 2px;
        overflow: visible;
    }

    .page-app-shell .home-app-quicknav > ul {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        list-style: none;
        margin: 0;
        padding: 2px 0 6px;
        height: auto;
    }

    .page-app-shell .home-app-quicknav > ul::-webkit-scrollbar {
        display: none;
    }

    .page-app-shell .home-app-quicknav > ul > li {
        flex: 0 0 auto;
        margin: 0;
        position: relative;
    }

    .page-app-shell .home-app-quicknav .nav-link,
    .page-app-shell .home-app-quicknav .dropdown-toggle {
        display: inline-flex;
        align-items: center;
        min-height: 36px;
        padding: 6px 12px;
        border: 0;
        border-radius: 999px;
        background: #f5f5f5;
        color: #111;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        text-decoration: none;
    }

    .page-app-shell .home-app-quicknav ul li:hover > .dropdown-menu {
        display: none;
    }

    .page-app-shell .home-app-quicknav ul li.is-open > .dropdown-menu {
        display: none;
    }

    body.page-app-shell > .dropdown-menu.home-app-quicknav-menu {
        display: block;
        position: fixed;
        z-index: 1300;
        max-height: 50vh;
        overflow-y: auto;
        min-width: 180px;
        margin: 0;
    }

    .page-home main {
        overflow-x: hidden;
    }

    .page-home .white-bg {
        background: #f7f7f8;
    }

    .page-home .white-bg > .container:first-of-type {
        padding-left: var(--home-app-pad);
        padding-right: var(--home-app-pad);
    }

    .page-home .city-buttons-wrapper {
        overflow: visible;
        margin: 4px 0 4px;
    }

    .page-home .city-buttons {
        animation: none !important;
        width: auto;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        gap: 10px;
        padding: 8px 0 12px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        white-space: nowrap;
    }

    .page-home .city-buttons::-webkit-scrollbar {
        display: none;
    }

    .page-home .city-buttons .city-btn {
        scroll-snap-align: start;
        min-height: 56px;
        padding: 8px 16px 8px 8px;
        border-radius: 999px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
        background: #fff;
    }

    .page-home .city-buttons .city-btn .city-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .page-home .city-buttons .city-info .city-name {
        font-size: 15px;
        font-weight: 700;
    }

    .page-home .city-buttons .city-info .city-count {
        font-size: 12px;
    }

    .page-home .home-banner-section {
        padding-inline: var(--home-app-pad);
        margin-bottom: 4px;
    }

    .page-home .home-banner-carousel .item {
        border-radius: var(--home-app-radius);
        overflow: hidden;
        background: #fff;
    }

    .page-home .home-banner-carousel .item img {
        width: 100%;
        height: auto;
        max-height: none;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        display: block;
        border-radius: var(--home-app-radius);
    }

    .page-home .banner-info {
        padding: 12px 4px 4px;
        border: 0;
    }

    .page-home .banner-info .title {
        font-size: 20px !important;
        line-height: 1.25 !important;
        margin: 0;
    }

    .page-home .banner-info .sub-title {
        font-size: 13px !important;
        line-height: 1.35 !important;
        margin: 6px 0 10px !important;
    }

    .page-home .banner-info a {
        font-size: 14px;
        max-width: none;
        min-height: 40px;
        padding: 8px 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .page-home .home-banner-carousel .owl-nav {
        bottom: auto;
        top: 36%;
        width: 100%;
        padding-inline: 6px;
        justify-content: space-between;
        pointer-events: none;
        transform: none;
    }

    .page-home .home-banner-carousel .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: auto;
        background: rgba(255, 255, 255, 0.92);
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
    }

    .page-home .home-banner-carousel .owl-dots {
        margin-top: 4px;
    }

    .page-home #home-events-section {
        padding-left: var(--home-app-pad);
        padding-right: var(--home-app-pad);
    }

    .page-home .home-events-toolbar {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        margin: 8px 0 12px !important;
    }

    .page-home .home-events-title {
        font-size: 22px;
        line-height: 1.25;
        margin: 0 !important;
        flex: 1;
        min-width: 0;
    }

    .page-home .home-events-title-line {
        display: block;
    }

    .page-home .home-filter-btn,
    .page-home .filter-div button.home-filter-btn {
        min-height: var(--home-touch);
        min-width: 88px;
        padding: 8px 14px;
        border-radius: 12px;
        border: 1px solid #e6e6e6;
        background: #fff;
        font-weight: 600;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .page-home .cardContainer {
        padding-left: 0;
        padding-right: 0;
    }

    .page-home .event-card,
    .page-home .home-event-card {
        margin-bottom: 16px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
        background: #fff;
    }

    .page-home .event-card:hover {
        transform: none;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }

    .page-home .event-card .event-footer::before,
    .page-home .event-card .event-footer::after {
        display: none;
    }

    .page-home .event-image img {
        height: auto !important;
        max-height: none !important;
        aspect-ratio: 16 / 10;
        object-fit: cover;
    }

    .page-home .event-date-tag-overlay {
        display: none;
    }

    .page-home .home-event-date {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 4px;
        color: var(--blue-color);
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.02em;
        text-transform: uppercase;
    }

    .page-home .event-text {
        padding: 16px 16px 8px;
    }

    .page-home .event-text-title,
    .page-home .event-text h4 {
        font-size: 18px;
        line-height: 1.35;
        overflow: visible;
        white-space: normal;
        display: block;
        -webkit-line-clamp: unset;
        overflow-wrap: anywhere;
    }

    .page-home .event-location {
        font-size: 14px;
        white-space: normal;
        word-break: break-word;
    }

    .page-home .event-tag {
        margin-block: 10px;
    }

    .page-home .event-footer {
        padding: 12px 16px 16px;
    }

    .page-home .event-footer .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
    }

    .page-home .event-footer .green-btn {
        font-size: 15px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .page-home .event-footer .blue-btn {
        min-height: var(--home-touch);
        min-width: 96px;
        padding: 10px 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
    }

    .page-home #show-more-btn {
        min-height: var(--home-touch);
        min-width: 160px;
        border-radius: 12px;
    }

    .page-home .create-event-section {
        margin-top: 16px !important;
        margin-bottom: 16px !important;
        border-radius: 0;
    }

    .page-home .create-event-content {
        padding: 24px var(--home-app-pad) !important;
    }

    .page-home .create-event-content .title {
        font-size: 26px !important;
        line-height: 1.25 !important;
        margin: 16px 0 20px !important;
    }

    .page-home .create-event-section .info-card {
        font-size: 12px;
        max-width: 100%;
    }

    .page-home .create-event-section .create-event-btn,
    .page-home .create-event-content .create-event-btn {
        min-height: var(--home-touch);
        padding: 10px 22px !important;
        font-size: 15px;
    }

    .page-home .event-type-cards {
        justify-content: flex-start;
        max-width: none;
        gap: 14px;
        padding: 4px 2px 14px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .page-home .event-type-cards::-webkit-scrollbar {
        display: none;
    }

    .page-home .event-type-card {
        flex: 0 0 auto;
        width: 88px;
    }

    .page-home .event-type-card .icon-circle {
        width: 72px;
        height: 72px;
        padding: 10px;
        margin: 0 auto 8px;
    }

    .page-home .event-type-card .type-name {
        font-size: 13px;
        font-weight: 600;
        line-height: 1.2;
    }

    .page-home .create-event-content-2 {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
        margin-top: 8px;
        border-radius: var(--home-app-radius);
        background: #fff;
    }

    .page-home .create-event-content-2 .text {
        align-items: flex-start;
    }

    .page-home .create-event-content-2 .create-event-btn {
        width: 100%;
        min-height: var(--home-touch);
        margin: 0;
    }

    .page-home footer {
        padding-bottom: 8px;
    }

    .page-home footer .list-your-event {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        gap: 12px;
        padding: 16px;
        border-radius: var(--home-app-radius);
        margin-bottom: 24px;
    }

    .page-home footer .list-your-event .title {
        font-size: 24px;
        line-height: 1.25;
    }

    .page-home footer .list-your-event .sub-title {
        font-size: 14px;
        line-height: 1.45;
    }

    .page-home footer .list-your-event .create-event-btn {
        width: 100%;
        min-height: var(--home-touch);
        margin: 0;
    }

    .page-home footer .footer-mobile {
        justify-content: flex-start;
        flex-direction: column;
        align-items: flex-start;
    }

    .page-home footer .footer-links {
        text-align: left;
        flex-direction: column;
        gap: 0;
    }

    .page-home footer .footer-acc {
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        padding: 8px 0;
        width: 100%;
    }

    .page-home footer .footer-acc summary {
        list-style: none;
        cursor: pointer;
        font-size: 16px;
        font-weight: 700;
        min-height: var(--home-touch);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .page-home footer .footer-acc summary::-webkit-details-marker {
        display: none;
    }

    .page-home footer .footer-acc summary::after {
        content: "▾";
        font-size: 14px;
        opacity: 0.8;
    }

    .page-home footer .footer-acc[open] summary::after {
        content: "▴";
    }

    .page-home footer .footer-acc ul {
        padding-bottom: 8px;
    }

    .page-home footer .footer-acc a,
    .page-home footer .footer-acc li {
        min-height: 40px;
        display: flex;
        align-items: center;
    }

    .page-home footer .fotter-bottom-text {
        text-align: left;
        font-size: 12px;
        line-height: 1.5;
    }

    .page-home #filterModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100%;
        align-items: flex-end;
    }

    .page-home #filterModal .modal-content {
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
    }

    .page-home #filterModal .modal-header,
    .page-home #filterModal .modal-body,
    .page-home #filterModal .modal-footer {
        padding: 16px;
        margin-inline: 0;
        margin-top: 0;
    }

    .page-home #filterModal .modal-footer .btn {
        min-height: var(--home-touch);
        flex: 1;
    }

    .page-home #filterModal .form-check {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding-left: 1.75em;
    }

    .page-app-shell .home-bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1090;
        height: calc(var(--home-bottom-nav) + env(safe-area-inset-bottom, 0px));
        padding: 4px 8px env(safe-area-inset-bottom, 0px);
        background: #fff;
        border-top: 1px solid #ececec;
        justify-content: space-around;
        align-items: stretch;
    }

    .page-app-shell .home-bottom-nav__item {
        flex: 1 1 0;
        min-width: 0;
        min-height: 48px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: #6b6b6b;
        text-decoration: none;
        font-size: 11px;
        font-weight: 600;
        line-height: 1.2;
    }

    .page-app-shell .home-bottom-nav__item i {
        font-size: 18px;
        line-height: 1;
    }

    .page-app-shell .home-bottom-nav__item.is-active {
        color: var(--blue-color);
    }
}

/* ---------- Tablet: intermediate app ---------- */
@media screen and (min-width: 768px) and (max-width: 1023.98px) {
    .page-app-shell .home-app-header,
    .page-app-shell .home-bottom-nav {
        display: none !important;
    }

    .page-home .navbar-container {
        padding-inline: 20px !important;
    }

    .page-home .city-buttons-wrapper {
        overflow: visible;
    }

    .page-home .city-buttons {
        animation: none !important;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 12px;
        width: auto;
        scrollbar-width: none;
    }

    .page-home .city-buttons::-webkit-scrollbar {
        display: none;
    }

    .page-home .home-banner-section {
        padding-inline: 20px;
    }

    .page-home .home-banner-carousel .item img {
        aspect-ratio: 21 / 9;
        object-fit: cover;
        width: 100%;
        height: auto;
        max-height: none;
        border-radius: 18px;
    }

    .page-home .home-events-toolbar {
        align-items: center;
    }

    .page-home .home-events-title {
        font-size: 28px;
        line-height: 1.25;
        margin-bottom: 0 !important;
    }

    .page-home .event-image img {
        height: auto !important;
        max-height: none !important;
        aspect-ratio: 16 / 10;
        object-fit: cover;
    }

    .page-home .event-type-cards {
        max-width: none;
        justify-content: flex-start;
    }

    .page-home .create-event-content .title {
        font-size: 36px !important;
        line-height: 1.2 !important;
    }
}

@media screen and (min-width: 768px) {
    .page-home footer .footer-acc {
        border-bottom: none;
        padding: 0;
        width: auto;
    }

    .page-home footer .footer-acc summary {
        list-style: none;
        cursor: default;
        pointer-events: none;
        font-size: 1.25rem;
        font-weight: 500;
        min-height: 0;
        display: block;
        margin-bottom: 1rem;
    }

    .page-home footer .footer-acc summary::-webkit-details-marker,
    .page-home footer .footer-acc summary::marker {
        display: none;
    }

    .page-home footer .footer-acc summary::after {
        display: none;
        content: none;
    }
}

@media screen and (min-width: 1024px) {
    .page-app-shell .home-app-header,
    .page-app-shell .home-bottom-nav {
        display: none !important;
    }

    .page-home .home-events-title-line {
        display: inline;
    }

    .page-home .home-events-title-line + .home-events-title-line::before {
        content: " ";
    }
}

@media (hover: none) {
    .page-home .event-card:hover {
        transform: none;
    }
}
