/* 
 * Mobile Optimization Stylesheet 
 * This file contains overrides and optimizations specifically for mobile devices.
 * It is loaded after all other CSS files to ensure it takes precedence on small screens.
 */

@media only screen and (max-width: 992px) {

    /* --- Touch Target Improvements --- */
    /* Form elements */
    select.browser-default,
    input[type=text],
    input[type=password],
    input[type=email],
    input[type=url],
    input[type=time],
    input[type=date],
    input[type=datetime],
    input[type=datetime-local],
    input[type=tel],
    input[type=number],
    input[type=search] {
        height: 3rem !important;
        font-size: 16px !important;
        /* Prevent iOS zoom on focus */
        padding: 0 10px !important;
        box-sizing: border-box;
    }

    textarea.materialize-textarea {
        font-size: 16px !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }

    /* Buttons */
    .btn,
    .btn-large,
    .btn-small,
    .btn-flat {
        min-height: 44px;
        line-height: 44px;
        font-size: 15px;
    }

    /* --- Padding & Readability (Spacing & Layout) --- */
    .container-body {
        padding-top: 20px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .container {
        width: 95% !important;
    }

    body {
        font-size: 15px;
    }

    /* --- Table Mobile Optimizations --- */
    /* Increase tap targets for table cells */
    table.bordered td,
    table.bordered th,
    table.bordered-horizontal td,
    table.bordered-horizontal th,
    table.test-list td,
    table.test-list th,
    table.status-list td,
    table.status-list th {
        padding: 12px 6px !important;
        font-size: 14px;
        word-break: keep-all;
    }

    #tasks_table td,
    #tasks_table th {
        word-break: break-all !important;
        white-space: normal !important;
    }

    /* --- Board List Improvements for Mobile --- */
    .view-link {
        font-size: 1.1rem;
        display: block;
        padding: 8px 0;
        line-height: 1.5;
    }

    /* Make the meta info block below titles more readable on mobile */
    .view-link>span.hide-on-large-only {
        display: block !important;
        margin-top: 6px;
        font-size: 0.85rem;
        color: #757575 !important;
        line-height: 1.4;
    }

    /* --- Home Countdown Optimizations --- */
    .ws-timer-wrapper {
        gap: 8px !important;
    }

    .ws-card {
        padding: 12px 2px !important;
        min-width: 75px !important;
    }

    .ws-val {
        font-size: 1.6rem !important;
    }

    /* --- Modals / Popups Mobile Adjustments --- */
    /* Fix popup width and height on small screens */
    .changepw .changepw-form,
    .changepw-pop .changepw-form,
    .addtempmember-pop .addtempmember-form,
    .completeinfo .completeinfo-form {
        width: 95% !important;
        height: auto !important;
        max-height: 90vh;
        overflow-y: auto;
        padding: 15px !important;
        top: 5% !important;
        transform: translate(-50%, 0) !important;
        /* adjust centering for long modals */
    }

    .completeinfo .completeinfo-form {
        padding-bottom: 20px !important;
        /* Overrides the weird 900px padding-bottom in common.css */
    }

    /* --- Navigation Adjustments --- */
    #nav-mobile.side-nav {
        width: 250px;
    }

    #nav-mobile .white-text {
        font-size: 1.1rem;
        padding: 0 20px;
    }

    /* --- Admin Responsive Tables --- */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* prevent vertical scrollbars on table wrappers */
        overflow-y: hidden;
        margin-bottom: 1rem;
    }

    .table-responsive>table {
        width: max-content;
        min-width: 100%;
    }
}

@media only screen and (max-width: 600px) {

    /* Extra adjustments for very small screens */
    .view-link {
        font-size: 1.05rem;
    }

    /* Responsive Images inside board contents */
    .board-content img {
        width: 100% !important;
        height: auto !important;
    }

    .board-content .chip img {
        width: 32px !important;
        height: 32px !important;
    }

    .row .col {
        padding: 0 0.5rem;
    }

    /* Smaller card items on today page */
    .today-charts>div {
        margin: 8px 0 !important;
    }
}