/* Mobile Compatibility Styles */

/* Modal improvements for mobile */
@media (max-width: 768px) {
    /* Make modals full-width on mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-lg {
        max-width: calc(100% - 1rem);
    }

    /* Modal header - wrap long titles */
    .modal-header .modal-title {
        font-size: 0.9rem;
        line-height: 1.4;
        word-wrap: break-word;
        padding-right: 2rem;
    }

    /* Modal body padding */
    .modal-body {
        padding: 1rem;
        font-size: 0.9rem;
    }

    /* Button groups - stack vertically on mobile */
    .row .col-3,
    .row .col-sm-3,
    .row .col-md-3 {
        margin-bottom: 0.5rem;
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Buttons in modal - full width on mobile */
    .modal-body .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        padding: 0.75rem;
        font-size: 1rem;
    }

    /* Button row spacing */
    .modal-body .row:last-child {
        margin-top: 1rem;
    }

    /* Verify button section - stack on mobile */
    #pre_verify .col-md-11,
    #pre_verify .col-md-1 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }

    #pre_verify .col-md-1 {
        margin-bottom: 0;
    }

    /* Post verify buttons - stack on mobile */
    #post_verify .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Jumbotron buttons - stack on mobile */
    .jumbotron .col-md-6 {
        margin-bottom: 1rem;
    }

    .jumbotron .btn {
        width: 100%;
    }

    /* Card filters - stack on mobile */
    .card .row .col-md-6 {
        margin-bottom: 1rem;
    }

    /* Tables - make scrollable on mobile */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Navbar - adjust for mobile */
    .navbar-nav {
        text-align: center;
    }

    /* Footer - stack on mobile */
    footer .col-md-8,
    footer .col-md-3 {
        text-align: center;
        margin-bottom: 1rem;
    }

    /* Info cards - full width on mobile */
    .info-card,
    .donation-card {
        margin-bottom: 1rem;
    }

    /* Game cards - full width on mobile */
    .game-card {
        margin-bottom: 1rem;
    }

    /* Form controls - full width on mobile */
    .form-control,
    .form-select,
    select.form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Modal footer buttons - stack on mobile */
    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0.25rem 0;
    }

    /* QR code container - center on mobile */
    #qrcode {
        text-align: center;
        margin: 1rem 0;
    }

    /* Second page modal - stack content on mobile */
    .modal-body #second_page .col-md-8,
    .modal-body #second_page .col-md-4 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Even smaller text on very small screens */
    .modal-header .modal-title {
        font-size: 0.85rem;
    }

    .modal-body {
        font-size: 0.85rem;
        padding: 0.75rem;
    }

    /* Smaller padding in containers */
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Jumbotron adjustments */
    .jumbotron {
        padding: 1.5rem 1rem;
    }

    .jumbotron h1 {
        font-size: 1.5rem;
    }

    .jumbotron h3 {
        font-size: 1.1rem;
    }

    /* Card padding */
    .card-body {
        padding: 1rem;
    }

    /* Button text - ensure readable */
    .btn {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        white-space: normal;
        word-wrap: break-word;
    }

    /* Table font size */
    .table {
        font-size: 0.85rem;
    }

    /* Footer text */
    footer {
        font-size: 0.85rem;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 90vh;
    }

    .modal-body {
        max-height: calc(90vh - 200px);
        overflow-y: auto;
    }
}

/* Touch-friendly button sizes */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }

    .close {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem;
    }
}
