/* ========================================
   MOBILE RESPONSIVENESS ENHANCEMENTS
   ======================================== */

/* Fix for mobile menu z-index issues */
.offcanvas {
  z-index: 9999 !important;
}

.offcanvas-backdrop {
  z-index: 9998 !important;
}

.navbar-toggler {
  z-index: 10000 !important;
  position: relative !important;
}

/* Mobile-first responsive breakpoints */
@media (max-width: 768px) {
  
  /* ========================================
     NAVIGATION & LAYOUT IMPROVEMENTS
     ======================================== */
  
  /* Enhanced sidebar for mobile */
  .left-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    z-index: 1050;
    transition: left 0.3s ease-in-out;
    overflow-y: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }
  
  .left-sidebar.show {
    left: 0;
  }
  
  /* Mobile sidebar header */
  .brand-logo {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
  }
  
  /* Mobile navigation items */
  .sidebar-nav .nav-item {
    margin: 0;
  }
  
  .sidebar-nav .nav-link {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1.1rem;
    transition: all 0.3s ease;
  }
  
  .sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
  }
  
  /* Mobile submenu improvements */
  .sidebar-nav .collapse {
    background: rgba(0, 0, 0, 0.1);
  }
  
  .sidebar-nav .collapse .nav-link {
    padding-left: 3rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  }
  
  /* Mobile overlay */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }
  
  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }
  
  /* Mobile header improvements */
  .top-navbar {
    padding: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  .top-navbar .navbar-brand {
    font-size: 1.2rem;
  }
  
  /* Mobile menu toggle button */
  .navbar-toggler {
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
  }
  
  .navbar-toggler:hover {
    background: rgba(102, 126, 234, 0.2);
  }
  
  .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
  }
  
  /* ========================================
     CARD & CONTENT IMPROVEMENTS
     ======================================== */
  
  /* Mobile card improvements */
  .card {
    margin-bottom: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
  
  .card-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: #ffffff !important;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  /* Mobile statistics cards */
  .border-left-primary,
  .border-left-success,
  .border-left-warning,
  .border-left-danger {
    border-left: none !important;
    border-bottom: 4px solid;
  }
  
  .border-left-primary {
    border-bottom-color: #4e73df !important;
  }
  
  .border-left-success {
    border-bottom-color: #1cc88a !important;
  }
  
  .border-left-warning {
    border-bottom-color: #f6c23e !important;
  }
  
  .border-left-danger {
    border-bottom-color: #e74a3b !important;
  }
  
  /* ========================================
     TABLE IMPROVEMENTS
     ======================================== */
  
  /* Mobile table improvements */
  .table-responsive {
    border-radius: 8px;
    overflow: hidden;
  }
  
  .table {
    font-size: 0.9rem;
  }
  
  .table th {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
  }
  
  /* Mobile table actions */
  .table .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    margin: 0.1rem;
  }
  
  /* ========================================
     FORM IMPROVEMENTS
     ======================================== */
  
  /* Mobile form improvements */
  .form-control,
  .form-select {
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
  }
  
  .form-control:focus,
  .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
  }
  
  /* Mobile form groups */
  .form-group {
    margin-bottom: 1.5rem;
  }
  
  .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
  }
  
  /* Mobile buttons */
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-height: 44px; /* Touch-friendly minimum height */
  }
  
  .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-height: 36px;
  }
  
  .btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    min-height: 52px;
  }
  
  /* ========================================
     MODAL IMPROVEMENTS
     ======================================== */
  
  /* Mobile modal improvements */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
  
  .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }
  
  .modal-body {
    padding: 1.5rem;
  }
  
  .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
  }
  
  /* ========================================
     DASHBOARD IMPROVEMENTS
     ======================================== */
  
  /* Mobile dashboard layout */
  .container-fluid {
    padding: 1rem;
  }
  
  /* Mobile page headers */
  .page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
  }
  
  .page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  /* Mobile breadcrumbs */
  .breadcrumb {
    padding: 0.5rem 0;
    background: transparent;
    font-size: 0.9rem;
  }
  
  /* ========================================
     UTILITY IMPROVEMENTS
     ======================================== */
  
  /* Mobile spacing utilities */
  .mb-4 {
    margin-bottom: 1.5rem !important;
  }
  
  .mt-4 {
    margin-top: 1.5rem !important;
  }
  
  .py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
  
  /* Mobile text utilities */
  .text-xs {
    font-size: 0.75rem !important;
  }
  
  .h5 {
    font-size: 1.1rem !important;
  }
  
  /* ========================================
     TOUCH IMPROVEMENTS
     ======================================== */
  
  /* Touch-friendly elements */
  .nav-link,
  .btn,
  .form-control,
  .form-select {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  /* Touch feedback */
  .btn:active,
  .nav-link:active {
    transform: scale(0.98);
  }
  
  /* ========================================
     ANIMATION IMPROVEMENTS
     ======================================== */
  
  /* Smooth transitions */
  * {
    transition: all 0.3s ease;
  }
  
  /* Loading animations */
  .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
  }
  
  /* ========================================
     ACCESSIBILITY IMPROVEMENTS
     ======================================== */
  
  /* Focus indicators */
  .btn:focus,
  .nav-link:focus,
  .form-control:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
  }
  
  /* High contrast mode support */
  @media (prefers-contrast: high) {
    .card {
      border: 2px solid #000;
    }
    
    .btn {
      border: 2px solid currentColor;
    }
  }
  
  /* Reduced motion support */
  @media (prefers-reduced-motion: reduce) {
    * {
      transition: none !important;
      animation: none !important;
    }
  }
}

/* ========================================
   TABLET OPTIMIZATIONS
   ======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
  
  /* Tablet sidebar */
  .left-sidebar {
    width: 280px;
  }
  
  /* Tablet content */
  .body-wrapper {
    margin-left: 280px;
  }
  
  /* Tablet cards */
  .col-xl-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  /* Tablet tables */
  .table {
    font-size: 0.95rem;
  }
  
  /* Tablet forms */
  .form-control,
  .form-select {
    padding: 0.625rem;
  }
}

/* ========================================
   LARGE MOBILE OPTIMIZATIONS
   ======================================== */

@media (min-width: 481px) and (max-width: 768px) {
  
  /* Large mobile cards */
  .col-xl-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  /* Large mobile tables */
  .table-responsive {
    font-size: 0.85rem;
  }
  
  /* Large mobile buttons */
  .btn {
    padding: 0.625rem 1.25rem;
  }
}

/* ========================================
   SMALL MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 480px) {
  
  /* Small mobile layout */
  .container-fluid {
    padding: 0.75rem;
  }
  
  /* Small mobile cards */
  .col-xl-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  /* Small mobile tables */
  .table {
    font-size: 0.8rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
  }
  
  /* Small mobile buttons */
  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Small mobile forms */
  .form-control,
  .form-select {
    padding: 0.75rem;
    font-size: 1rem;
  }
  
  /* Small mobile modals */
  .modal-dialog {
    margin: 0.25rem;
    max-width: calc(100% - 0.5rem);
  }
  
  .modal-body {
    padding: 1rem;
  }
}

/* ========================================
   LANDSCAPE MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
  
  /* Landscape mobile sidebar */
  .left-sidebar {
    width: 300px;
  }
  
  /* Landscape mobile content */
  .container-fluid {
    padding: 0.5rem;
  }
  
  /* Landscape mobile cards */
  .col-xl-3 {
    flex: 0 0 25%;
    max-width: 25%;
  }
  
  /* Landscape mobile tables */
  .table-responsive {
    max-height: 60vh;
  }
}

/* ========================================
   DARK MODE SUPPORT (DISABLED)
   ======================================== */

/* Dark mode is disabled to maintain consistent light theme */
/* Uncomment the following section if dark mode is needed */

/*
@media (prefers-color-scheme: dark) {
  
  /* Dark mode overrides for mobile */
  .card {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }
  
  .card-header {
    background: #4a5568;
    border-bottom-color: #718096;
  }
  
  .form-control,
  .form-select {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
  }
  
  .form-control:focus,
  .form-select:focus {
    background: #4a5568;
    border-color: #667eea;
    color: #e2e8f0;
  }
  
  .table {
    color: #e2e8f0;
  }
  
  .table th {
    background: #4a5568;
    border-color: #718096;
  }
  
  .table td {
    border-color: #718096;
  }
}
*/

/* ========================================
   PRINT OPTIMIZATIONS
   ======================================== */

@media print {
  
  /* Hide mobile-specific elements */
  .left-sidebar,
  .top-navbar,
  .sidebar-overlay {
    display: none !important;
  }
  
  /* Full width content for print */
  .body-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  /* Print-friendly cards */
  .card {
    border: 1px solid #000;
    box-shadow: none;
    break-inside: avoid;
  }
  
  /* Print-friendly tables */
  .table {
    border: 1px solid #000;
  }
  
  .table th,
  .table td {
    border: 1px solid #000;
  }
}
