/**
 * Mobile-specific overrides for Baxtercobb App
 * Loaded after main.css to ensure proper cascade
 * Fixes responsive layout issues on mobile (<768px) and improves touch targets
 */

/* Ensure all touch targets meet 44px minimum (WCAG 2.5.5) */
@media (width <= 767.98px) {
    .btn,
    .nav-link,
    .form-check-input,
    .form-select,
    .form-control {
        min-height: 44px;
        padding-bottom: 0.5rem;
        padding-top: 0.5rem;
    }
}

/* Calendar mobile optimizations */
@media (width <= 375.98px) {
    #calendar {
        font-size: 0.875rem;
    }

    .fc .fc-toolbar-title {
        font-size: 1rem !important;
    }

    .fc .fc-col-header-cell {
        padding: 0.25rem;
    }

    .fc .fc-daygrid-day-number {
        font-size: 0.875rem;
    }
}

/* Prevent horizontal overflow on very small screens */
@media (width <= 375.98px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .card {
        margin-left: 0;
        margin-right: 0;
    }

    .row {
        margin-left: -0.375rem;
        margin-right: -0.375rem;
    }

    [class*="col-"] {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }
}

/* Table mobile improvements */
@media (width <= 767.98px) {
    .table-responsive {
        font-size: 0.875rem;
    }

    .table td,
    .table th {
        padding: 0.5rem;
    }

    .table .btn-group {
        flex-direction: column;
        gap: 0.25rem;
    }

    .table .btn-group > .btn {
        width: 100%;
    }
}

/* Improve card stacking on mobile */
@media (width <= 576px) {
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* RES-L03: Scoped flex-wrap to page-header to avoid breaking other flex layouts */
    .page-header .d-flex.align-items-center {
        flex-wrap: wrap;
    }
}

/* Fix modal sizing on mobile */
@media (width <= 576px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        margin-bottom: 0;
    }
}

/* Improve button sizing on mobile */
@media (width <= 576px) {
    .btn {
        font-size: 0.95rem;
        padding: 0.5rem 1rem;
    }

    .btn-sm {
        font-size: 0.85rem;
        padding: 0.35rem 0.75rem;
    }

    .btn-lg {
        font-size: 1.05rem;
        padding: 0.75rem 1.5rem;
    }
}

/* Optimize form controls for mobile */
@media (width <= 576px) {
    .form-label {
        font-weight: 500;
        margin-bottom: 0.5rem;
    }

    .form-control,
    .form-select {
        font-size: 16px;
        /* Prevent zoom on iOS when input is focused */
    }

    .form-check {
        margin-bottom: 0.75rem;
    }
}

/* Improve link hover on touch devices */
@media (hover: none) {
    a:hover {
        text-decoration: underline;
    }

    .btn:hover {
        opacity: 0.9;
    }
}
