/**
 * Global responsive UI helpers and app shell styles.
 */

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    width: 17rem;
    flex-shrink: 0;
    background-color: #fff;
    border-left: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1020;
}

.app-sidebar__brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.app-sidebar__brand-link {
    color: var(--bs-primary);
    font-weight: 700;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1.5;
}

.app-sidebar__nav {
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar-nav__link {
    display: flex;
    align-items: center;
    border-radius: 0.5rem;
    padding: 0.65rem 0.85rem;
    color: var(--bs-body-color);
    font-weight: 500;
}

.sidebar-nav__link.active {
    background-color: var(--bs-primary);
    color: #fff;
}

.app-main {
    min-width: 0;
    background-color: #f4f6f9;
}

.app-topbar {
    z-index: 1030;
}

.app-topbar__title {
    max-width: 12rem;
}

.app-offcanvas {
    width: min(18rem, 88vw);
}

.page-header {
    gap: 1rem;
}

.page-header__title {
    line-height: 1.4;
}

.page-header__actions .btn {
    white-space: nowrap;
}

.btn-touch {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    margin-bottom: 0.15rem;
}

.card-dashboard .display-6 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.responsive-heading {
    font-size: clamp(1.15rem, 2.5vw, 1.75rem);
}

.form-actions {
    gap: 0.5rem;
}

.exam-mobile-footer {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 991.98px) {
    .page-header,
    main .d-flex.justify-content-between.align-items-center.mb-4,
    main .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.gap-3.mb-4 {
        flex-direction: column;
        align-items: stretch !important;
    }

    main .d-flex.justify-content-between.align-items-center.mb-4 > .btn,
    main .d-flex.justify-content-between.align-items-center.mb-4 > a.btn,
    main .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.gap-3.mb-4 > .btn,
    main .d-flex.flex-column.flex-md-row.justify-content-between.align-items-md-center.gap-3.mb-4 > a.btn {
        width: 100%;
    }

    .page-header__actions {
        width: 100%;
    }

    .page-header__actions .btn,
    .page-header__actions .btn-group {
        width: 100%;
    }

    .form-actions .btn {
        width: 100%;
    }

    .card-header.d-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .card-header .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .container,
    .container-fluid {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .page-header__actions {
        flex-direction: column;
    }

    .table-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        justify-content: flex-start;
    }

    .table-actions .btn {
        flex: 1 1 auto;
        min-width: 4.5rem;
    }

    .btn-touch,
    .btn-lg {
        min-height: 44px;
    }

    .exam-footer .btn {
        width: 100%;
        min-height: 44px;
    }

    .exam-question-palette {
        justify-content: center;
    }

    .exam-palette-btn {
        min-width: 2.5rem;
        min-height: 44px;
    }

    .exam-header .exam-timer-display {
        font-size: 1.5rem !important;
    }

    .exam-option {
        min-height: 44px;
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
    }

    .exam-option .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
        margin-top: 0.15rem;
    }

    main .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    .display-6 {
        font-size: 1.75rem;
    }

    h1.h3,
    .h3 {
        font-size: 1.25rem;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .page-header__actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (min-width: 1920px) {
    .app-main .container-fluid {
        max-width: 1600px;
        margin-right: auto;
        margin-left: auto;
    }
}

.scroll-list-panel {
    max-height: 280px;
    overflow-y: auto;
}

.table-col-index {
    width: 3.75rem;
}

.dl-responsive dt {
    color: var(--bs-secondary-color);
}

@media (max-width: 575.98px) {
    .dl-responsive dt {
        margin-bottom: 0.15rem;
    }

    .dl-responsive dd {
        margin-bottom: 1rem;
    }
}

.card-dashboard .btn {
    width: 100%;
}

@media (min-width: 576px) {
    .card-dashboard .btn {
        width: auto;
    }
}
