/**
 * Mobile Responsive Styles
 * Global responsive overrides for Spektris eXcellence Platform
 */

/* ============================================
   Mobile Breakpoints (max-width: 767.98px)
   ============================================ */
@media (max-width: 767.98px) {
    /* Form Controls - Stack on mobile */
    .row .col-md-1,
    .row .col-md-2,
    .row .col-md-3,
    .row .col-md-4,
    .row .col-md-5,
    .row .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Time inputs side by side on mobile */
    .row .col-md-1:has(input[type="time"]) {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Filter form stacking */
    .card-body .row .col-2,
    .card-body .row .col-3,
    .card-body .row .col-4,
    .card-body .row .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.75rem;
    }

    /* Date range inputs */
    .input-daterange .form-control {
        width: 100% !important;
        float: none !important;
        margin-bottom: 0.5rem;
    }

    .input-daterange {
        flex-direction: column;
    }

    /* Button groups - wrap on mobile */
    .flex-shrink-0 {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .flex-shrink-0 .btn {
        flex: 1 1 auto;
        min-width: 120px;
    }

    /* Card header buttons */
    .card-body.border-bottom .d-flex {
        flex-direction: column;
        gap: 0.75rem;
    }

    .card-body.border-bottom .flex-shrink-0 {
        width: 100%;
        justify-content: center;
    }

    /* Modal dialog improvements */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

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

    .modal-body .row .col-md-2,
    .modal-body .row .col-md-3,
    .modal-body .row .col-md-4,
    .modal-body .row .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Calendar responsive height */
    #calendar {
        height: 400px !important;
        min-height: 300px;
    }

    /* Menu navigation */
    #menu-navi {
        flex-direction: column !important;
        gap: 0.5rem;
    }

    #menu-navi .d-sm-flex {
        justify-content: center;
    }

    #renderRange {
        text-align: center;
        margin: 0.5rem 0 !important;
    }

    /* Page title section */
    .page-title-box {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .page-title-right {
        justify-content: center;
    }

    /* Action buttons in tables */
    .hstack {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* DataTable adjustments */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: center;
        margin-bottom: 0.5rem;
    }

    .dataTables_wrapper .dataTables_length select {
        width: 60px;
    }

    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        margin-top: 0.5rem;
    }

    .dataTables_wrapper .dataTables_info {
        text-align: center;
    }

    /* Select2 adjustments */
    .select2-container {
        width: 100% !important;
    }

    /* Textarea full width */
    textarea.form-control {
        min-height: 100px;
    }

    /* Login page specific */
    .auth-full-bg {
        min-height: auto;
        padding: 2rem 1rem !important;
    }

    .auth-full-page-content {
        padding: 1.5rem !important;
    }

    .auth-full-bg .card-logo img {
        height: 100px !important;
    }
}

/* ============================================
   Small Mobile (max-width: 575.98px)
   ============================================ */
@media (max-width: 575.98px) {
    /* Even smaller calendar */
    #calendar {
        height: 300px !important;
    }

    /* Compact buttons */
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

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

    /* Form label spacing */
    .form-label {
        margin-bottom: 0.25rem;
        font-size: 0.875rem;
    }

    /* Hide breadcrumb on very small screens */
    .breadcrumb {
        display: none;
    }
}

/* ============================================
   Tablet Breakpoint (768px - 991.98px)
   ============================================ */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Two columns on tablet for some elements */
    .card-body .row .col-3,
    .card-body .row .col-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Calendar height for tablet */
    #calendar {
        height: 600px !important;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    /* Hide navigation */
    #layout-wrapper .vertical-menu,
    .topnav,
    .footer,
    .right-bar {
        display: none !important;
    }

    /* Full width content */
    .main-content {
        margin-left: 0 !important;
    }

    /* Calendar print height */
    #calendar {
        height: auto !important;
    }
}
