/* Mobile-First Responsive Design System */

/* Base mobile styles */
* {
    box-sizing: border-box;
}

/* Container responsive adjustments */
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Card responsive design */
.card {
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

@media (max-width: 575.98px) {
    .card {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .card:first-child {
        border-top: none;
    }
}

/* Navigation responsive */
.layout-menu {
    transition: all 0.3s ease;
}

@media (max-width: 1199.98px) {
    .layout-menu {
        transform: translateX(-100%);
    }
    
    .layout-menu.show {
        transform: translateX(0);
    }
}

/* Button responsive design */
.btn-group-responsive {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 575.98px) {
    .btn-group-responsive {
        flex-direction: column;
    }
    
    .btn-group-responsive .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group-responsive .btn:last-child {
        margin-bottom: 0;
    }
}

/* Form responsive design */
.form-row-responsive {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

.form-col-responsive {
    flex: 1;
    padding: 0 0.5rem;
    margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
    .form-col-responsive {
        flex: 100%;
    }
}

/* Modal responsive */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0;
        width: 100%;
        height: 100%;
        max-width: none;
    }
    
    .modal-content {
        height: 100%;
        border: none;
        border-radius: 0;
    }
    
    .modal-body {
        padding: 1rem;
        overflow-y: auto;
    }
}

/* Breadcrumb responsive */
.breadcrumb-responsive {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

@media (max-width: 575.98px) {
    .breadcrumb-responsive {
        font-size: 0.75rem;
    }
    
    .breadcrumb-responsive .breadcrumb-item {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Page header responsive */
.page-header-responsive {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
}

@media (max-width: 767.98px) {
    .page-header-responsive {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header-responsive .page-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .page-header-responsive .page-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Stats cards responsive */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 575.98px) {
    .stats-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.stats-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid #dee2e6;
}

@media (max-width: 575.98px) {
    .stats-card {
        padding: 1rem;
        margin: 0 -10px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Chart responsive */
.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 575.98px) {
    .chart-container {
        height: 250px;
    }
}

/* Sidebar responsive */
.sidebar-responsive {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    z-index: 1050;
    transition: left 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-responsive.show {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

@media (min-width: 992px) {
    .sidebar-responsive {
        position: static;
        left: 0;
        width: auto;
        height: auto;
        box-shadow: none;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

/* Dropdown responsive */
@media (max-width: 575.98px) {
    .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin-top: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #dee2e6;
        background: white;
        margin-bottom: 1px;
    }
}

/* Input group responsive */
.input-group-responsive {
    display: flex;
    width: 100%;
}

@media (max-width: 575.98px) {
    .input-group-responsive {
        flex-direction: column;
    }
    
    .input-group-responsive .form-control {
        border-radius: 0.375rem !important;
        margin-bottom: 0.5rem;
    }
    
    .input-group-responsive .btn {
        border-radius: 0.375rem !important;
        width: 100%;
    }
}

/* Alert responsive */
.alert-responsive {
    margin-bottom: 1rem;
    border-radius: 0.375rem;
}

@media (max-width: 575.98px) {
    .alert-responsive {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Tab responsive */
.nav-tabs-responsive {
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
    .nav-tabs-responsive {
        flex-direction: column;
        border-bottom: none;
    }
    
    .nav-tabs-responsive .nav-link {
        border: 1px solid #dee2e6;
        margin-bottom: 1px;
        border-radius: 0;
    }
    
    .nav-tabs-responsive .nav-link.active {
        background-color: #007bff;
        color: white;
        border-color: #007bff;
    }
}

/* Progress bar responsive */
.progress-responsive {
    height: 1rem;
    margin-bottom: 1rem;
    background-color: #e9ecef;
    border-radius: 0.375rem;
}

@media (max-width: 575.98px) {
    .progress-responsive {
        height: 0.75rem;
    }
}

/* List group responsive */
.list-group-responsive .list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

@media (max-width: 575.98px) {
    .list-group-responsive .list-group-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem;
    }
    
    .list-group-responsive .list-group-item > * {
        margin-bottom: 0.25rem;
    }
    
    .list-group-responsive .list-group-item > *:last-child {
        margin-bottom: 0;
    }
}

/* Utility classes for responsive design */
.text-truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .text-truncate-mobile {
        max-width: 150px;
    }
}

.hide-mobile {
    display: block;
}

@media (max-width: 575.98px) {
    .hide-mobile {
        display: none !important;
    }
}

.show-mobile {
    display: none;
}

@media (max-width: 575.98px) {
    .show-mobile {
        display: block !important;
    }
}

.hide-tablet {
    display: block;
}

@media (max-width: 767.98px) {
    .hide-tablet {
        display: none !important;
    }
}

.show-tablet {
    display: none;
}

@media (max-width: 767.98px) {
    .show-tablet {
        display: block !important;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
    
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-select {
        min-height: 44px;
        font-size: 16px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Spacing adjustments for mobile */
@media (max-width: 575.98px) {
    .mb-3 { margin-bottom: 1rem !important; }
    .mb-4 { margin-bottom: 1.5rem !important; }
    .mb-5 { margin-bottom: 2rem !important; }
    
    .mt-3 { margin-top: 1rem !important; }
    .mt-4 { margin-top: 1.5rem !important; }
    .mt-5 { margin-top: 2rem !important; }
    
    .py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
}
