/* Responsive CSS for entire application */

/* Base responsive adjustments */
@media (max-width: 767.98px) {
    .card-title {
        font-size: 1.1rem;
    }

    .card-tools {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-top: 10px;


    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-tools .btn {
        margin: 5px 0;
        width: 100%;
    }

    .btn-group {
        display: flex;
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
    }

    /* Adjust tables for mobile */
    .table-responsive {
        width: 100%;
        display: block;
        overflow-x: auto;
    }

    /* Make modals more mobile-friendly */
    .modal-dialog {
        margin: 0.5rem;
        max-width: 100%;
    }

    /* Fix form layouts on mobile */
    .form-group {
        margin-bottom: 1rem;
    }

    /* Make filter elements stack on mobile */
    .filter-form .col-md-3,
    .filter-form .col-md-6 {
        margin-bottom: 10px;
    }

    .filter-form .btn-group {
        flex-direction: column;
    }

    .filter-form .btn-group .btn {
        margin-bottom: 5px;
        border-radius: 4px !important;
    }

    /* Card adjustments */
    .card-body .row > div {
        margin-bottom: 15px;
    }
}

/* Specific table responsive fixes */
@media (max-width: 575.98px) {
    /* Make tables more readable on very small screens */
    table.dataTable thead .sorting:after,
    table.dataTable thead .sorting_asc:after,
    table.dataTable thead .sorting_desc:after {
        display: none;
    }

    .dataTable th,
    .dataTable td {
        font-size: 0.8rem;
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Add horizontal scroll indicator */
    .table-responsive::after {
        content: "← Scroll →";
        display: block;
        text-align: center;
        font-size: 0.8rem;
        color: #6c757d;
        padding: 5px;
        opacity: 0.8;
    }

    /* Optimize action buttons in tables */
    .btn-group .btn-sm {
        padding: 0.25rem 0.4rem;
    }

    .btn-group .btn-sm i {
        font-size: 0.8rem;
    }
}

/* Modal improvements for mobile */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .modal-header {
        padding: 0.75rem;
    }

    .modal-body {
        padding: 0.75rem;
        overflow-y: auto;
    }

    .modal-footer {
        padding: 0.75rem;
    }
}

/* DataTables responsive adjustments */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
}

/* Custom card summaries for better mobile display */
@media (max-width: 767.98px) {
    .mobile-summary-card {
        display: flex;
        flex-direction: column;
        padding: 10px;
        margin-bottom: 5px;
        border-bottom: 1px solid #dee2e6;
    }

    .mobile-summary-card strong {
        margin-bottom: 5px;
    }

    .card-body .row > div:last-child .mobile-summary-card {
        border-bottom: none;
    }
}

/* Fix filter dropdown on mobile */
@media (max-width: 767.98px) {
    .dtsb-searchBuilder {
        width: 100%;
        overflow-x: auto;
    }

    div.dataTables_wrapper div.dataTables_filter {
        text-align: left;
        margin-top: 10px;
    }
}

/* Fix for date inputs on mobile */
@media (max-width: 575.98px) {
    input[type="month"],
    input[type="datetime-local"] {
        padding: 0.25rem;
    }
}

/* Main content wrapper adjustments */
@media (max-width: 767.98px) {
    .content-wrapper {
        padding-bottom: 60px; /* Make room for potential bottom navigation */
    }

    .main-sidebar {
        width: 250px;
        transform: translateX(-250px);
    }

    .sidebar-open .main-sidebar {
        transform: translateX(0);
    }

    .sidebar-open .wrapper::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1032;
    }
}

/* Footer adjustments */
@media (max-width: 767.98px) {
    .main-footer {
        text-align: center;
        padding: 10px;
    }
}

/* Mobile-specific helper classes */
@media (max-width: 767.98px) {
    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-mb-2 {
        margin-bottom: 0.5rem !important;
    }

    .mobile-mt-2 {
        margin-top: 0.5rem !important;
    }

    .mobile-p-2 {
        padding: 0.5rem !important;
    }
}

/* Action buttons container for better mobile layout */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Toast notifications for mobile */
.toast-container {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
}

@media (max-width: 767.98px) {
    .toast-container {
        left: 10px;
        right: 10px;
    }

    .toast {
        width: 100%;
    }
}

/* Scrollable modals */
.modal-scrollable {
    overflow-y: auto;
    max-height: 85vh;
}

/* Better mobile tables */
@media (max-width: 767.98px) {
    .responsive-table-card tr {
        display: block;
        border: 1px solid #dee2e6;
        margin-bottom: 10px;
        border-radius: 4px;
        padding: 8px;
    }

    .responsive-table-card td {
        display: flex;
        justify-content: space-between;
        border: none !important;
        padding: 8px 4px !important;
        border-bottom: 1px solid #f3f3f3 !important;
    }

    .responsive-table-card td:last-child {
        border-bottom: none !important;
    }

    .responsive-table-card td:before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 5px;
    }
}

/* Form improvements for mobile */
@media (max-width: 767.98px) {
    .form-group label {
        font-size: 0.9rem;
    }

    .input-group-text {
        padding: 0.375rem 0.5rem;
    }
}

