/* YPA responsive layout: desktop + tablet + mobile. 2026-10-17. */
:root {
    --ypa-page-max: 1440px;
}

html,
body {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    display: block;
    overflow: hidden;
}

.app {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    margin: 0;
}

.topbar,
.content,
.bottombar {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.content {
    min-height: 0;
    flex: 1 1 auto;
    isolation: isolate;
}

.topbar > .d-flex:first-child {
    min-width: 0;
    overflow: hidden;
}

.topbar > .d-flex:first-child > span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar {
    width: min(85vw, 350px);
    right: -380px;
    max-width: 100%;
    overflow-y: auto;
}

.sidebar.active {
    right: 0;
}

.home-grid {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--ypa-page-max);
    height: 100%;
    min-height: 0;
    margin-inline: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
}

.home-grid a {
    min-width: 0;
    text-align: center;
    overflow-wrap: anywhere;
}

.login-wrap,
.register-wrap {
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-block: 20px;
}

.max-cards,
.containerOfPacks,
.containerOfFest,
.fullSettings,
#connectedUsersList {
    min-width: 0;
    min-height: 0;
}

.max-cards .card,
.containerOfPacks .card,
.containerOfFest .card {
    min-width: 0;
}

/* Existing CSS assumes at least 370px for admin filters. */
.filters-insider {
    min-width: 0;
}

.ypa-pui.ypa-pui-scroll {
    min-width: 0;
    min-height: 0;
    max-width: 100%;
}

.ypa-pui.ypa-pui-scroll .ypa-pui-shell {
    box-sizing: border-box;
    width: 100%;
}

/* The request heading and list share one column of the same flex shell. */
.ypa-pui.ypa-pui-admin-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
    overflow-y: auto;
}

@media (min-width: 600px) {
    .home-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
        padding: 20px;
    }

    .home-grid a {
        min-height: 126px;
        height: auto;
        padding: 18px 12px;
        font-size: 15px;
    }

    .login-card {
        width: min(100%, 420px);
        max-width: 420px;
    }

    .register-card {
        width: min(100%, 490px);
        max-width: 490px;
    }

    .topbar {
        height: 64px;
        padding-inline: 20px;
    }

    .bottombar {
        min-height: 60px;
        height: 60px;
        justify-content: center;
        gap: 6px;
        padding: 6px 12px;
    }

    .bottombar a {
        flex: 0 1 98px;
        max-width: 98px;
        min-width: 56px;
        border-radius: 11px;
    }

    .tab-indicator {
        top: 6px;
        height: calc(100% - 12px);
        border-radius: 11px;
    }
}

@media (min-width: 900px) {
    .home-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 20px;
        padding: 28px;
    }

    .home-grid a {
        min-height: 150px;
        font-size: 16px;
    }

    .home-grid i {
        font-size: 34px;
    }

    .containerOfPacks {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
        grid-auto-rows: min-content;
        align-content: start;
        gap: 16px;
        padding: 4px;
        overflow-y: auto;
    }

    .containerOfPacks > * {
        min-width: 0;
    }

    .containerOfPacks > .no-fests {
        grid-column: 1 / -1;
        min-height: 200px;
    }

    #connectedUsersList .userRoleGroup > .d-flex.flex-wrap > .userCard.w-100 {
        width: calc(50% - 4px) !important;
    }

    #ypaRequestAdmin .ypa-pui-shell {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-content: start;
        align-items: start;
        gap: 14px;
    }

    #ypaRequestAdmin .ypa-pui-shell > :not(.ypa-admin-request) {
        grid-column: 1 / -1;
    }

    #ypaRequestAdmin .ypa-admin-request {
        min-width: 0;
        margin: 0;
    }

    .max-cards:has(> .card-pack) {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
        grid-auto-rows: min-content;
        align-content: start;
    }
}

@media (min-width: 1300px) {
    .home-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    #connectedUsersList .userRoleGroup > .d-flex.flex-wrap > .userCard.w-100 {
        width: calc(33.333% - 6px) !important;
    }
}

@media (max-width: 599.98px) {
    .home-grid {
        gap: 12px;
        padding: 12px;
    }

    .home-grid a {
        min-height: 110px;
        height: auto;
        padding: 12px 6px;
    }

    .ypa-pui-adminbar .ypa-pui-heading {
        min-width: 0;
    }

    .filter-head {
        min-height: 40px;
    }
}

@media (max-width: 375px) {
    .home-grid {
        gap: 8px;
        padding: 8px;
    }

    .topbar {
        padding-inline: 8px;
    }

    .filters-insider {
        gap: 5px;
        padding: 8px;
    }

    .ypa-pui.ypa-pui-scroll .ypa-pui-shell {
        padding-inline: 10px;
    }
}
