/* Sidebar toggle */
#wrapper.toggled #sidebar-wrapper {
    margin-left: -250px;
}

#sidebar-wrapper {
    width: 250px;
    transition: all 0.25s ease-out;
}

#page-content-wrapper {
    width: 100%;
}

body {
    overflow-x: hidden;
}

/* Additional styles */
.sidebar-heading {
    padding: 1rem;
    font-size: 1.2rem;
}

.list-group-item {
    cursor: pointer;
}

.container {
    margin-top: 20px;
}

/* Modal styles for all screen sizes */
.modal-dialog {
    max-width: 90%;
    margin: 1.75rem auto;
}

.modal-content {
    max-height: 90vh;
}

.modal-body {
    max-height: calc(90vh - 120px); /* Subtract header and footer height */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.modal-header, .modal-footer {
    flex-shrink: 0; /* Prevent header/footer from shrinking */
}

/* Mobile responsive styles */
@media (max-width: 767.98px) {
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Form elements */
    .form-select, .form-control {
        max-width: 100%;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Improve touch targets */
    .btn, .form-check-input, .nav-link, .list-group-item, select, input[type="checkbox"], input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-sm, .btn-group-sm > .btn {
        min-height: 38px;
    }
    
    /* Filter forms */
    .d-flex.flex-wrap.gap-2 > div {
        flex: 1 0 100%;
        margin-bottom: 10px;
    }
    
    /* Cards */
    .col-md-2 {
        width: 50% !important;
        min-width: auto !important;
        max-width: none !important;
    }
    
    .card {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 0.75rem;
    }
    
    /* Calendar */
    .fc-header-toolbar {
        flex-direction: column;
        align-items: start !important;
    }
    
    .fc-toolbar-chunk {
        margin-bottom: 0.5rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.375rem 0.5rem;
    }
    
    /* Headings */
    h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    h4 {
        font-size: 1.1rem;
    }
    
    /* View toggle */
    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: start !important;
    }
    
    .d-flex.justify-content-between > div {
        margin-top: 10px;
    }
    
    /* Spacing */
    .container-fluid, .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .col, [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Input groups */
    .input-group {
        flex-wrap: wrap;
    }
    
    .input-group > .form-control {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .input-group > .input-group-text {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
    
    .input-group > .btn {
        border-radius: 0.25rem !important;
    }
}

/* Small mobile devices */
@media (max-width: 575.98px) {
    .col-md-2 {
        width: 100% !important;
    }
    
    .table-responsive table {
        font-size: 0.8rem;
    }
    
    .badge {
        font-size: 0.7rem;
    }
    
    .action-buttons .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
    
    /* Stacked forms */
    .form-row, .form-group {
        margin-bottom: 0.75rem;
    }
    
    /* Modal footer buttons */
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        margin: 0.25rem 0;
        width: 100%;
    }
    
    /* Improved table display */
    .table td, .table th {
        padding: 0.5rem;
    }
    
    /* Smaller padding */
    .card-body {
        padding: 0.75rem;
    }
    
    .list-group-item {
        padding: 0.5rem 0.75rem;
    }
    
    /* Font sizes */
    body {
        font-size: 0.875rem;
    }
    
    .small {
        font-size: 0.75rem;
    }
}

/* Ensure proper display on very small devices */
@media (max-width: 359.98px) {
    .container-fluid, .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.8rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
}