/* Shared mobile UX patterns — breakpoint matches Bootstrap md (768px) */

@media (max-width: 767.98px) {
    /* Tables → stacked cards when cells have data-label */
    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        padding: 0.85rem 1rem;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
        border: 1px solid #eee;
    }

    .mobile-card-table tbody tr:hover {
        background: #fff;
    }

    .mobile-card-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.35rem 0;
        border: none;
        text-align: right;
    }

    .mobile-card-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        text-align: left;
        flex-shrink: 0;
    }

    .mobile-card-table tbody td[data-label=""]::before,
    .mobile-card-table tbody td:not([data-label])::before {
        content: none;
    }

    /* Checkbox-only column (payment selection) */
    .mobile-card-table tbody td.mobile-card-check {
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #eee;
        margin-bottom: 0.25rem;
    }

    .mobile-card-table tbody td.mobile-card-check::before {
        content: none;
    }

    .mobile-card-table tfoot {
        display: none;
    }

    /* Profile: stack columns full width */
    .profile-mobile-stack .col-md-8,
    .profile-mobile-stack .col-md-4,
    .profile-mobile-stack .col-md-6 {
        width: 100%;
    }

    .profile-mobile-stack .form-control,
    .profile-mobile-stack .form-select {
        min-height: 44px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .profile-mobile-stack .btn-primary {
        width: 100%;
        min-height: 48px;
    }

    /* Sticky payment footer */
    .mobile-payment-footer {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #dee2e6;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    }

    .mobile-payment-footer .btn-success {
        width: 100%;
        min-height: 48px;
        font-weight: 600;
    }

    .mobile-payment-footer .payment-method-stack {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    /* Public results header actions */
    .results-mobile-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .results-mobile-header .form-select {
        width: 100% !important;
    }

    /* Entry list accordion badges wrap on small screens */
    .entry-list-accordion .accordion-button .badge {
        font-size: 0.7rem;
    }

    /* Contestant "My Account" block in hamburger menu */
    .navbar-nav .nav-link.active {
        font-weight: 600;
    }

    /* Bottom tab bar */
    body.has-mobile-tab-bar {
        padding-bottom: calc(3.5rem + env(safe-area-inset-bottom));
    }

    body.has-mobile-tab-bar .footer {
        margin-bottom: calc(3.5rem + env(safe-area-inset-bottom));
    }

    body.has-mobile-tab-bar .mobile-payment-footer {
        bottom: calc(3.5rem + env(safe-area-inset-bottom));
    }

    body.has-mobile-tab-bar .mobile-btn-footer {
        bottom: calc(3.5rem + env(safe-area-inset-bottom));
    }

    .mobile-tab-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        display: flex;
        align-items: stretch;
        min-height: 3.5rem;
        padding-bottom: env(safe-area-inset-bottom);
        background: #fff;
        border-top: 1px solid #dee2e6;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    }

    .mobile-tab-bar__item {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.15rem;
        padding: 0.35rem 0.25rem 0.25rem;
        color: #6c757d;
        text-decoration: none;
        font-size: 0.68rem;
        font-weight: 500;
        line-height: 1.1;
        border: none;
        background: transparent;
        min-height: 3.5rem;
    }

    .mobile-tab-bar__item i {
        font-size: 1.25rem;
        line-height: 1;
    }

    .mobile-tab-bar__item.is-active {
        color: #0d6efd;
        font-weight: 600;
    }

    .mobile-tab-bar__item--button.is-active {
        color: #0d6efd;
    }

    .mobile-tab-bar__icon-wrap {
        position: relative;
        display: inline-flex;
        line-height: 1;
    }

    .mobile-tab-bar__badge {
        position: absolute;
        top: -0.35rem;
        right: -0.55rem;
        min-width: 1rem;
        height: 1rem;
        padding: 0 0.25rem;
        border-radius: 999px;
        background: #dc3545;
        color: #fff;
        font-size: 0.625rem;
        font-weight: 700;
        line-height: 1rem;
        text-align: center;
    }

    .mobile-tab-bar__badge--dot {
        min-width: 0.5rem;
        width: 0.5rem;
        height: 0.5rem;
        padding: 0;
        top: -0.1rem;
        right: -0.25rem;
    }

    .mobile-account-sheet {
        --bs-offcanvas-height: min(75vh, 520px);
        border-top-left-radius: 1rem;
        border-top-right-radius: 1rem;
    }

    .mobile-account-sheet .list-group-item {
        min-height: 3rem;
        display: flex;
        align-items: center;
        gap: 0.65rem;
        font-size: 1rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .mobile-account-sheet .list-group-item i {
        width: 1.25rem;
        text-align: center;
    }
}
