/* ===============================================
   RESPONSIVE ENHANCEMENTS FOR ADMIN DASHBOARD
   All device sizes: mobile, tablet, desktop
   =============================================== */

/* ===== TABLET ADMIN OPTIMIZATIONS (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1024px) {
    
    /* Admin sidebar adjustments */
    .main-sidebar {
        width: 220px;
    }
    
    .content-wrapper,
    .main-footer {
        margin-left: 220px;
    }
    
    .sidebar-mini.sidebar-collapse .content-wrapper,
    .sidebar-mini.sidebar-collapse .main-footer {
        margin-left: 50px;
    }
    
    /* Admin boxes - 2 columns */
    .admin-info-boxes {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* DataTables pagination */
    .dataTables_wrapper .dataTables_paginate {
        margin-top: 15px;
    }
    
    /* Modal size for admin */
    .modal-dialog {
        width: 650px !important;
    }
    
    /* Form improvements */
    .box-body .form-group {
        margin-bottom: 15px;
    }
}

/* ===== DESKTOP ADMIN (1024px - 1366px) ===== */
@media (min-width: 1024px) and (max-width: 1366px) {
    
    /* Sidebar at full width */
    .main-sidebar {
        width: 230px;
    }
    
    .content-wrapper,
    .main-footer {
        margin-left: 230px;
    }
    
    /* Info boxes - 3 columns */
    .admin-info-boxes {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    /* Better spacing */
    .content-header {
        padding: 15px;
    }
    
    .content {
        padding: 15px;
    }
    
    /* DataTables improvements */
    .table {
        font-size: 13px;
    }
    
    /* Dashboard charts */
    .chart-container {
        height: 300px;
    }
}

/* ===== LARGE DESKTOP ADMIN (1366px+) ===== */
@media (min-width: 1366px) {
    
    /* Full sidebar */
    .main-sidebar {
        width: 250px;
    }
    
    .content-wrapper,
    .main-footer {
        margin-left: 250px;
    }
    
    /* Info boxes - 4 columns */
    .admin-info-boxes {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    /* Larger content area */
    .content-header {
        padding: 20px;
    }
    
    .content {
        padding: 20px;
    }
    
    /* Better table display */
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 12px !important;
    }
    
    /* Dashboard charts larger */
    .chart-container {
        height: 350px;
    }
    
    /* Modal full size */
    .modal-dialog {
        width: 900px !important;
    }
}

/* ===== ADMIN MOBILE OVERRIDES ===== */
@media (max-width: 767px) {
    
    /* Hide sidebar by default */
    .main-sidebar {
        transform: translateX(-230px);
        transition: transform 0.3s ease;
    }
    
    .sidebar-open .main-sidebar {
        transform: translateX(0);
    }
    
    /* Full width content */
    .content-wrapper {
        margin-left: 0 !important;
    }
    
    /* Stack info boxes */
    .info-box {
        margin-bottom: 15px;
    }
    
    .info-box-icon {
        width: 70px;
        height: 70px;
        line-height: 70px;
    }
    
    .info-box-content {
        padding: 10px;
    }
    
    /* Compact admin header */
    .main-header .navbar {
        margin: 0;
    }
    
    .main-header .logo {
        width: 180px;
    }
    
    /* DataTables mobile */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left;
        margin-bottom: 10px;
    }
    
    .dataTables_wrapper .dataTables_length select {
        width: 60px;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
    }
    
    /* Admin buttons */
    .box-header .box-tools .btn {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ===== RESPONSIVE ADMIN TABLES ===== */
@media (max-width: 991px) {
    
    /* Scrollable tables */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Compact table cells */
    .table > thead > tr > th,
    .table > tbody > tr > td {
        white-space: nowrap;
    }
}

@media (min-width: 992px) {
    
    /* Normal table display */
    .table > thead > tr > th,
    .table > tbody > tr > td {
        white-space: normal;
    }
}

/* ===== ADMIN FORM LAYOUTS ===== */
@media (min-width: 768px) {
    
    /* Two-column forms */
    .form-responsive .col-sm-6 {
        width: 50%;
        float: left;
    }
    
    /* Horizontal forms better aligned */
    .form-horizontal .control-label {
        padding-top: 7px;
        text-align: right;
    }
}

@media (min-width: 1024px) {
    
    /* Three-column admin forms */
    .form-responsive .col-md-4 {
        width: 33.333%;
        float: left;
    }
}

/* ===== ADMIN DASHBOARD WIDGETS ===== */
@media (min-width: 1024px) {
    
    /* Dashboard layout */
    .dashboard-row {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .dashboard-col-3 {
        flex: 0 0 calc(25% - 15px);
    }
    
    .dashboard-col-4 {
        flex: 0 0 calc(33.333% - 14px);
    }
    
    .dashboard-col-6 {
        flex: 0 0 calc(50% - 10px);
    }
    
    .dashboard-col-12 {
        flex: 0 0 100%;
    }
}

/* ===== PRINT STYLES FOR ADMIN ===== */
@media print {
    
    /* Hide admin navigation */
    .main-header,
    .main-sidebar,
    .content-header .breadcrumb,
    .box-tools,
    .btn,
    .no-print {
        display: none !important;
    }
    
    /* Full width for printing */
    .content-wrapper {
        margin: 0;
        padding: 0;
    }
    
    .box {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    /* Table borders */
    .table {
        border: 1px solid #000;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
    }
    
    /* Page info */
    @page {
        margin: 2cm;
    }
}

/* ===== ADMIN SIDEBAR RESPONSIVE ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    
    /* Collapsible sidebar for tablets */
    .sidebar-mini.sidebar-collapse .sidebar-menu > li > a > .pull-right-container {
        display: none;
    }
    
    .sidebar-mini.sidebar-collapse .sidebar-menu > li > a > span {
        display: none;
    }
}

/* ===== RESPONSIVE CHARTS AND GRAPHS ===== */
@media (max-width: 767px) {
    
    /* Stack charts vertically */
    .chart-responsive {
        height: 200px !important;
        width: 100% !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    
    .chart-responsive {
        height: 250px !important;
    }
}

@media (min-width: 1024px) {
    
    .chart-responsive {
        height: 300px !important;
    }
}

/* ===== ADMIN ALERT MESSAGES ===== */
@media (max-width: 767px) {
    
    .alert {
        padding: 10px;
        font-size: 13px;
    }
    
    .alert .icon {
        font-size: 18px;
    }
}

/* ===== ADMIN BREADCRUMBS ===== */
@media (max-width: 767px) {
    
    .breadcrumb {
        display: none;
    }
}

@media (min-width: 768px) {
    
    .breadcrumb {
        margin-bottom: 15px;
    }
}
