/* =====================================================================
   MOBILE RESPONSIVE CSS - MSE Dashboard V2
   Chuyên biệt cho tối ưu hóa điện thoại và tablet
   ===================================================================== */

/* =====================================================================
   MOBILE NAVIGATION ENHANCEMENTS
   ===================================================================== */

/* Mobile menu improvements */
@media (max-width: 768px) {
  /* Mobile hamburger menu */
  .navbar-toggler {
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
  }
  
  .navbar-toggler:hover {
    background-color: rgba(255, 255, 255, 0.15);
  }
  
  .navbar-toggler:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    outline: none;
  }
  
  /* Mobile navbar container */
  .navbar-modern .container-fluid {
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    width: 100%;
  }
  
  /* Mobile navbar brand */
  .navbar-modern .navbar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
  }
  
  .navbar-brand-text {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .navbar-brand-subtitle {
    font-size: 0.65rem;
    opacity: 0.8;
    margin: 0;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Mobile navbar collapse - vertical layout */
  .navbar-modern .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(157, 0, 0, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-top: 0.5rem;
    padding: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
  }
  
  /* Mobile navbar nav - vertical layout */
  .navbar-modern .navbar-nav {
    flex-direction: column !important;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
  }
  
  .navbar-modern .nav-item {
    width: 100%;
    margin: 0;
  }
  
  .navbar-modern .nav-link {
    width: 100%;
    padding: 0.75rem 1rem !important;
    margin: 0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
    min-height: 44px;
  }
  
  .navbar-modern .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
    transform: translateX(5px);
  }
  
  .navbar-modern .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white !important;
    font-weight: 600;
  }
  
  /* Mobile dropdown menu - vertical */
  .navbar-modern .dropdown-menu {
    position: static !important;
    float: none !important;
    width: 100% !important;
    margin: 0.5rem 0 0 0 !important;
    padding: 0.5rem 0 !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    border: none !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    display: none !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
  }
  
  .navbar-modern .dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
  }
  
  .navbar-modern .dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--mse-gray-800);
    transition: all 0.2s ease;
    border-radius: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .navbar-modern .dropdown-item:hover {
    background-color: rgba(157, 0, 0, 0.1);
    color: #9D0000;
    transform: translateX(5px);
  }
  
  /* Mobile navbar icons */
  .navbar-modern .nav-link .fas,
  .navbar-modern .nav-link .fa {
    font-size: 1rem;
    width: 20px;
    text-align: center;
  }
  
  /* Mobile dropdown arrow */
  .navbar-modern .dropdown-toggle::after {
    margin-left: auto;
    transition: transform 0.2s ease;
  }
  
  .navbar-modern .dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
  }
  
  /* FORCE OVERRIDE BOOTSTRAP NAVBAR LAYOUT - MOBILE */
  .navbar-modern .navbar-collapse .navbar-nav {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .navbar-modern .navbar-collapse .nav-item {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: none !important;
  }
  
  .navbar-modern .navbar-collapse .nav-link {
    width: 100% !important;
    margin: 0 !important;
    padding: 0.75rem 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }
  
  /* Override any Bootstrap grid classes */
  .navbar-modern .row,
  .navbar-modern .col,
  .navbar-modern .col-auto {
    width: 100% !important;
    flex: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Force single column layout */
  .navbar-modern .navbar-collapse * {
    max-width: 100% !important;
  }
  
  .navbar-modern .navbar-collapse .d-flex {
    flex-direction: column !important;
  }
  
  .navbar-modern .navbar-collapse .justify-content-between {
    justify-content: flex-start !important;
  }
  
  /* LAYOUT FOR ACTION ITEMS - Search, +, Bell on one row, User on separate row */
  .navbar-modern .navbar-collapse .ms-auto {
    margin-left: 0 !important;
    margin-top: 0.5rem !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0 !important;
  }
  
  /* LAYOUT: + bell user on single row for mobile */
  .navbar-modern .navbar-collapse .ms-auto .nav {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }
  
  /* All nav items on same row */
  .navbar-modern .navbar-collapse .nav-item {
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
  }
  
  /* User dropdown should take full width */
  .navbar-modern .navbar-collapse .nav-item:last-child {
    flex: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  
  .navbar-modern .navbar-collapse .nav-item:last-child .dropdown {
    width: 100% !important;
  }
  
  .navbar-modern .navbar-collapse .nav-item:last-child .dropdown-toggle {
    width: 100% !important;
    justify-content: space-between !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  
  /* User button content */
  .navbar-modern .navbar-collapse .nav-item:last-child .btn {
    width: 100% !important;
    justify-content: space-between !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  
  /* User button text */
  .navbar-modern .navbar-collapse .nav-item:last-child .btn span,
  .navbar-modern .navbar-collapse .nav-item:last-child .btn div {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex: 1 !important;
    min-width: 0 !important;
  }
  .navbar-modern .navbar-collapse .nav-item:last-child .btn-primary {
    width: 100% !important;
  }
  /* Mobile button sizing */
  .navbar-modern .navbar-collapse .nav-item .btn {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .navbar-modern .navbar-collapse .nav-item .dropdown-toggle {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  
  /* User button specific styling */
  .navbar-modern .navbar-collapse .nav-item:last-child .btn {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
  }
  
  /* User button icon */
  .navbar-modern .navbar-collapse .nav-item:last-child .btn i {
    flex-shrink: 0 !important;
    width: auto !important;
  }
  
  /* User button text container */
  .navbar-modern .navbar-collapse .nav-item:last-child .btn > *:not(i) {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  
  /* User dropdown label - ensure name is visible on mobile */
  .navbar-modern .navbar-collapse .nav-item:last-child .dropdown-toggle span {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* User avatar and name in dropdown toggle */
  .navbar-modern .navbar-collapse .nav-item:last-child .dropdown-toggle img,
  .navbar-modern .navbar-collapse .nav-item:last-child .user-avatar {
    max-width: 24px !important;
    max-height: 24px !important;
    margin-right: 0.5rem !important;
  }
  
  .navbar-modern .navbar-collapse .nav-item:last-child .dropdown-toggle span {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
  }
  
  /* Search input styling */
  .navbar-modern .navbar-collapse .ms-auto .search-input {
    flex: 1 !important;
    min-width: 0 !important;
  }
  
  /* Action buttons styling */
  .navbar-modern .navbar-collapse .ms-auto .action-buttons {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem !important;
    flex: 0 0 auto !important;
    width: auto !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .action-buttons .btn {
    flex: 0 0 auto !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Second row: User dropdown (separate, like Projects) */
  .navbar-modern .navbar-collapse .ms-auto .user-row {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Action items styling (+, bell) */
  .navbar-modern .navbar-collapse .ms-auto .action-row .btn,
  .navbar-modern .navbar-collapse .ms-auto .action-row .nav-link {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.5rem !important;
    border-radius: 6px !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    border: none !important;
  }
  
  /* User dropdown styling (like Projects) */
  .navbar-modern .navbar-collapse .ms-auto .user-row .dropdown {
    width: 100% !important;
    display: block !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .user-row .dropdown-toggle {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.75rem 1rem !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .action-row .btn:hover,
  .navbar-modern .navbar-collapse .ms-auto .action-row .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    transform: translateY(-1px) !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .user-row .dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
  }
  
  /* Icons in action items */
  .navbar-modern .navbar-collapse .ms-auto .action-row .fas,
  .navbar-modern .navbar-collapse .ms-auto .action-row .fa {
    font-size: 1rem !important;
    margin: 0 !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .user-row .fas,
  .navbar-modern .navbar-collapse .ms-auto .user-row .fa {
    font-size: 1rem !important;
    margin: 0 !important;
  }
  
  /* Hide search input on mobile */
  .navbar-modern .search-input-group {
    display: none !important;
  }
  
  /* Mobile search input styling - full width on first row */
  .navbar-modern .navbar-collapse .search-input-group {
    width: 100% !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* Force + and bell buttons to be inline */
  .navbar-modern .navbar-collapse .nav-item:nth-child(2),
  .navbar-modern .navbar-collapse .nav-item:nth-child(3) {
    flex: 0 0 auto !important;
    width: auto !important;
  }
  
  /* Force user dropdown to be full width on next line */
  .navbar-modern .navbar-collapse .nav-item:last-child {
    width: 100% !important;
  }
  
  .navbar-modern .navbar-collapse .search-input-group .form-control {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: 6px 0 0 6px !important;
    height: 44px !important;
  }
  
  .navbar-modern .navbar-collapse .search-input-group .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
  }
  
  .navbar-modern .navbar-collapse .search-input-group .btn {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 0 6px 6px 0 !important;
    height: 44px !important;
  }
  
  /* User dropdown positioning for mobile */
  .navbar-modern .navbar-collapse .ms-auto .user-row .dropdown {
    position: relative !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .user-row .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    width: 100% !important;
    max-width: none !important;
    margin-top: 0.25rem !important;
    z-index: 1050 !important;
  }
}

/* =====================================================================
   SMALL MOBILE OPTIMIZATION (≤ 576px)
   ===================================================================== */
@media (max-width: 576px) {
  /* Compact navbar for very small screens */
  .navbar-modern .container-fluid {
    padding: 0 0.75rem;
  }
  
  /* Smaller brand text */
  .navbar-brand-text {
    font-size: 0.9rem;
  }
  
  .navbar-brand-subtitle {
    font-size: 0.6rem;
  }
  
  /* Compact nav links */
  .navbar-modern .nav-link {
    padding: 0.6rem 0.8rem !important;
    font-size: 0.85rem;
    gap: 0.4rem;
  }
  
  /* Compact hamburger */
  .navbar-toggler {
    padding: 0.4rem;
  }
  
  /* Compact dropdown */
  .navbar-modern .navbar-collapse {
    margin-top: 0.4rem;
    padding: 0.75rem;
  }
  
  .navbar-modern .dropdown-item {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }
  
  /* Compact icons */
  .navbar-modern .nav-link .fas,
  .navbar-modern .nav-link .fa {
    font-size: 0.9rem;
    width: 18px;
  }
  
  /* Responsive action items layout */
  .navbar-modern .navbar-collapse .ms-auto {
    gap: 0.25rem !important;
    padding: 0.25rem 0 !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .action-row {
    gap: 0.25rem !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .action-buttons {
    gap: 0.25rem !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .action-buttons .btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 0.8rem !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .user-row .dropdown-toggle {
    min-height: 40px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .action-buttons .fas,
  .navbar-modern .navbar-collapse .ms-auto .action-buttons .fa {
    font-size: 0.9rem !important;
  }
  
  .navbar-modern .navbar-collapse .ms-auto .user-row .fas,
  .navbar-modern .navbar-collapse .ms-auto .user-row .fa {
    font-size: 0.9rem !important;
  }
  
  /* Small mobile button adjustments */
  .navbar-modern .navbar-collapse .nav-item .btn {
    width: 40px !important;
    height: 40px !important;
  }
  
  .navbar-modern .navbar-collapse .nav-item .dropdown-toggle {
    min-height: 40px !important;
    padding: 0.5rem 0.75rem !important;
  }
  
  .navbar-modern .navbar-collapse .search-input-group .form-control {
    height: 40px !important;
    font-size: 0.8rem !important;
  }
  
  .navbar-modern .navbar-collapse .search-input-group .btn {
    height: 40px !important;
    font-size: 0.8rem !important;
  }
}

/* =====================================================================
   LANDSCAPE MOBILE OPTIMIZATION
   ===================================================================== */
@media (max-width: 768px) and (orientation: landscape) {
  /* Optimize for landscape mobile */
  .navbar-modern {
    min-height: 50px;
  }
  
  .navbar-modern .container-fluid {
    padding: 0 1rem;
  }
  
  /* Smaller brand for landscape */
  .navbar-brand-text {
    font-size: 0.85rem;
  }
  
  .navbar-brand-subtitle {
    font-size: 0.55rem;
  }
  
  /* Compact nav links for landscape */
  .navbar-modern .nav-link {
    padding: 0.5rem 0.8rem !important;
    font-size: 0.8rem;
    gap: 0.3rem;
  }
  
  /* Compact hamburger for landscape */
  .navbar-toggler {
    padding: 0.3rem;
  }
  
  /* Compact dropdown for landscape */
  .navbar-modern .navbar-collapse {
    margin-top: 0.4rem;
    padding: 0.6rem;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  .navbar-modern .dropdown-item {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
  }
  
  /* Compact icons for landscape */
  .navbar-modern .nav-link .fas,
  .navbar-modern .nav-link .fa {
    font-size: 0.9rem;
    width: 16px;
  }
}

/* Mobile search bar */
  .search-container {
    margin: 0.5rem 0;
  }
  
  .search-container .form-control {
    border-radius: 20px;
    padding-left: 1rem;
    padding-right: 1rem;
  }

/* =====================================================================
   MOBILE DASHBOARD LAYOUT
   ===================================================================== */

@media (max-width: 576px) {
  /* Dashboard grid adjustments */
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* KPI cards container on mobile */
  .kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .kpi-col {
    flex: 1;
    min-width: 100%;
    width: 100% !important;
  }
  
  /* Default: make KPI cols full-width unless overridden below */
  .kpi-col[class*="col-"] {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  /* Override Bootstrap grid classes for KPI cards - ULTRA AGGRESSIVE */
  .kpi-col.col-6,
  .kpi-col.col-md-6,
  .kpi-col.col-lg-2,
  .kpi-col.col-xl-2,
  .kpi-col.col-lg-3,
  .kpi-col.col-xl-3,
  .kpi-col.col-lg-4,
  .kpi-col.col-xl-4,
  .kpi-col.col-lg-6,
  .kpi-col.col-xl-6 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    float: none !important;
    display: block !important;
  }
  
  /* Force KPI cards to stack vertically */
  .kpi-card {
    width: 100% !important;
    margin-bottom: 1rem !important;
  }

  /* Hide KPI icon on mobile to save space */
  .kpi-card .kpi-icon,
  .kpi-card .ms-3 .fas,
  .kpi-card .ms-3 .fa {
    display: none !important;
  }

  /* Compact spacing when icon is hidden */
  .kpi-card .ms-3 {
    margin-left: 0 !important;
  }
  
  /* Ensure KPI card containers are full width */
  .kpi-card-container {
    width: 100% !important;
    margin-bottom: 1rem !important;
  }
  
  /* NUCLEAR OPTION: Override ALL Bootstrap grid classes on mobile - but allow KPI grid override */
  [class*="col-"] {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    float: none !important;
    display: block !important;
    margin-bottom: 1rem !important;
  }
  
  /* Stronger override specifically for KPI grid */
  .kpi-row.row > [class*="col-"] {
    width: calc(50% - 0.375rem) !important;
    flex: 0 0 calc(50% - 0.375rem) !important;
    max-width: calc(50% - 0.375rem) !important;
    display: block !important;
  }

  /* KPI row: two cards per row on small mobile screens */
  .kpi-row.row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  
  .kpi-row.row > .kpi-col,
  .kpi-row.row > .kpi-col[class*="col-"],
  .kpi-row.row > [class*="col-"] {
    width: calc(50% - 0.375rem) !important;
    max-width: calc(50% - 0.375rem) !important;
    flex: 0 0 calc(50% - 0.375rem) !important;
    min-width: 0 !important;
  }
  
  /* Force all rows to stack vertically on mobile */
  [class*="row"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  
  /* KPI grid override: force two columns even though generic rows stack vertically */
  .kpi-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  
  .kpi-row > .kpi-col,
  .kpi-row > [class*="col-"] {
    width: calc(50% - 0.375rem) !important;
    max-width: calc(50% - 0.375rem) !important;
    flex: 0 0 calc(50% - 0.375rem) !important;
  }
  
  /* Remove margin from last child */
  [class*="col-"]:last-child {
    margin-bottom: 0 !important;
  }
  
  /* Chart containers mobile */
  .chart-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  .chart-col {
    flex: 1;
    min-width: 100%;
  }
  
  /* Force all dashboard columns to full width on mobile - ULTRA AGGRESSIVE */
  .row > div,
  .row > .col,
  .row > .col-6,
  .row > .col-md-6,
  .row > .col-lg-2,
  .row > .col-xl-2,
  .row > .col-lg-3,
  .row > .col-xl-3,
  .row > .col-lg-4,
  .row > .col-xl-4,
  .row > .col-lg-6,
  .row > .col-xl-6 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-bottom: 1rem !important;
    float: none !important;
    display: block !important;
  }
  
  /* Force row to be column layout */
  .row {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }
  
  /* Ensure proper spacing between cards */
  .row > div:last-child,
  .row > .col:last-child,
  .row > .col-6:last-child,
  .row > .col-md-6:last-child,
  .row > .col-lg-2:last-child,
  .row > .col-xl-2:last-child,
  .row > .col-lg-3:last-child,
  .row > .col-xl-3:last-child,
  .row > .col-lg-4:last-child,
  .row > .col-xl-4:last-child,
  .row > .col-lg-6:last-child,
  .row > .col-xl-6:last-child {
    margin-bottom: 0 !important;
  }
  
  /* Mobile chart heights - INCREASED HEIGHT */
  .chart-container {
    height: 500px !important;
    min-height: 450px !important;
  }
  
  /* Bar chart containers - OPTIMIZED FOR WIDTH AND MARGIN */
  .chart-container.bar-chart-container {
    height: 600px !important;
    min-height: 550px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Project Status Distribution chart mobile optimization */
  .chart-container .js-plotly-plot {
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Chart title mobile optimization - SMALLER FONT */
  .chart-container .card-header h5 {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.25rem !important;
  }
  
  .chart-container .card-header i {
    font-size: 0.65rem !important;
  }
  
  /* Chart legend mobile optimization - SMALLER FONT */
  .chart-container .legend {
    font-size: 0.6rem !important;
    margin-top: 0.25rem !important;
  }
  
  /* Chart text elements mobile optimization - SMALLER FONT */
  .chart-container .gtitle,
  .chart-container .g-gtitle {
    font-size: 0.65rem !important;
  }
  
  .chart-container .gtext,
  .chart-container .g-gtext {
    font-size: 0.55rem !important;
  }
  
  /* Donut chart center text mobile optimization - SMALLER FONT */
  .chart-container .annotation-text {
    font-size: 0.6rem !important;
  }
  
  /* Donut chart specific mobile optimization - INCREASED HEIGHT */
  .donut-chart-container {
    height: 450px !important;
    min-height: 400px !important;
  }
  
  /* Donut chart legend mobile optimization - SMALLER FONT */
  .donut-chart-container .legend {
    font-size: 0.55rem !important;
    margin-top: 0.2rem !important;
  }
  
  /* Donut chart labels mobile optimization - SMALLER FONT */
  .donut-chart-container .pie-label {
    font-size: 0.6rem !important;
  }
  
  /* Donut chart percentages mobile optimization - SMALLER FONT */
  .donut-chart-container .pie-percentage {
    font-size: 0.55rem !important;
  }
  
  /* Chart card mobile optimization - ENHANCED */
  .chart-card {
    margin-bottom: 1rem !important;
    border-radius: 8px !important;
    overflow: hidden !important;
  }
  
  .chart-card .card-header {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
  }
  
  .chart-card .card-body {
    padding: 0.25rem !important;
  }
  
  /* Bar chart specific mobile optimizations */
  .chart-container .js-plotly-plot .plotly .main-svg .bglayer {
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Optimize bar chart text labels */
  .chart-container .js-plotly-plot .plotly .main-svg .bartext {
    font-size: 0.7rem !important;
  }
  
  /* Optimize scatter plot markers on mobile */
  .chart-container .js-plotly-plot .plotly .main-svg .scattergl {
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Optimize line chart text */
  .chart-container .js-plotly-plot .plotly .main-svg .scattertext {
    font-size: 0.7rem !important;
  }
  
  /* Optimize axis tick labels for bar charts */
  .chart-container .js-plotly-plot .plotly .main-svg .xtick text,
  .chart-container .js-plotly-plot .plotly .main-svg .ytick text {
    font-size: 0.7rem !important;
  }
  
  /* Optimize axis titles for bar charts */
  .chart-container .js-plotly-plot .plotly .main-svg .xaxis-title,
  .chart-container .js-plotly-plot .plotly .main-svg .yaxis-title {
    font-size: 0.8rem !important;
  }
  
  /* Additional bar chart optimizations for mobile */
  .chart-container .js-plotly-plot .plotly .main-svg .bglayer rect {
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Ensure bar chart text doesn't overflow */
  .chart-container .js-plotly-plot .plotly .main-svg .bartext {
    font-size: 0.65rem !important;
    font-weight: 500 !important;
  }
  
  /* Optimize bar chart legend positioning */
  .chart-container .js-plotly-plot .plotly .main-svg .legend {
    font-size: 0.7rem !important;
  }
  
  /* Ensure proper spacing for bar chart elements */
  .chart-container .js-plotly-plot .plotly .main-svg .xaxis .tick text {
    font-size: 0.65rem !important;
    transform: rotate(-45deg) !important;
  }
  
  .chart-container .js-plotly-plot .plotly .main-svg .yaxis .tick text {
    font-size: 0.65rem !important;
  }
  
  /* Ensure bar charts display fully on mobile */
  .chart-container .js-plotly-plot .plotly .main-svg {
    overflow: visible !important;
  }
  
  .chart-container .js-plotly-plot .plotly .main-svg .bglayer {
    overflow: visible !important;
  }
  
  /* Optimize bar chart container for mobile */
  .chart-container .js-plotly-plot {
    width: 100% !important;
    height: 100% !important;
    overflow: visible !important;
  }
  
  /* Ensure proper scaling for bar charts */
  .chart-container .js-plotly-plot .plotly .main-svg .bglayer .bg {
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Optimize bar chart width and responsive behavior */
  .chart-container .js-plotly-plot {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
  }
  
  .chart-container .js-plotly-plot .plotly {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .chart-container .js-plotly-plot .plotly .main-svg {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
  }
  
  /* Force horizontal scrolling for bar charts if needed */
  .chart-container .js-plotly-plot .plotly .main-svg .bglayer {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
  }
  
  /* Optimize bar chart text positioning */
  .chart-container .js-plotly-plot .plotly .main-svg .bartext {
    font-size: 0.6rem !important;
    font-weight: 500 !important;
  }
  
  /* Ensure x-axis labels are visible */
  .chart-container .js-plotly-plot .plotly .main-svg .xaxis .tick text {
    font-size: 0.6rem !important;
    transform: rotate(-45deg) !important;
    text-anchor: end !important;
  }
  
  /* Enable horizontal scrolling for bar charts */
  .chart-container {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Ensure chart container takes full width */
  .chart-container .js-plotly-plot {
    min-width: max-content !important;
  }
  
  /* Optimize for mobile landscape */
  @media (orientation: landscape) and (max-width: 768px) {
    .chart-container {
      height: 400px !important;
      min-height: 350px !important;
    }
    
    .chart-container .js-plotly-plot .plotly .main-svg .xaxis .tick text {
      font-size: 0.5rem !important;
    }
  }
  
  /* Hide cumulative legend on mobile for bar charts */
  @media (max-width: 768px) {
    .chart-container .js-plotly-plot .plotly .main-svg .bg{
      display: none !important;
    }
  }
  
  /* Project Overview table mobile optimization */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
  }
  
  /* Custom scrollbar for mobile */
  .table-responsive::-webkit-scrollbar {
    height: 6px;
  }
  
  .table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
  }
  
  .table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
  }
  
  .table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }
  
  /* Ensure table has minimum width for scrolling */
  .table-modern {
    min-width: 2200px !important;
    width: 100% !important;
    table-layout: fixed !important;
  }
  
  /* Fix table cell layout to prevent content overflow */
  .table-modern th,
  .table-modern td {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  /* Ensure each column displays only its own content */
  .table-modern tbody tr {
    display: table-row !important;
  }
  
  .table-modern tbody td {
    display: table-cell !important;
    vertical-align: middle !important;
  }
  
  /* Pagination controls mobile centering */
  .pagination-controls {
    justify-content: center !important;
    margin-top: 1rem;
    padding: 0.5rem;
  }
  
  /* Pagination buttons mobile optimization */
  .pagination-controls .btn {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
    margin: 0 0.125rem;
  }
  
  /* Page info mobile optimization */
  .pagination-controls .page-info {
    font-size: 0.8rem;
    margin: 0 0.5rem;
  }
  
  /* Mobile landscape optimization for tables */
  @media (orientation: landscape) and (max-width: 768px) {
    .table-modern {
      min-width: 1000px !important;
    }
    
    .table-modern th,
    .table-modern td {
      padding: 0.375rem 0.2rem;
      font-size: 0.7rem;
    }
    
    .pagination-controls .btn {
      font-size: 0.75rem;
      padding: 0.25rem 0.5rem;
    }
  }
  
  /* Tablet optimization for tables */
  @media (min-width: 577px) and (max-width: 768px) {
    .table-modern {
      min-width: 1100px !important;
    }
    
    .table-modern th,
    .table-modern td {
      padding: 0.5rem 0.3rem;
      font-size: 0.75rem;
    }
  }
  
  /* Scroll indicator for mobile tables */
  .table-responsive::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.8));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .table-responsive:hover::after {
    opacity: 1;
  }
  
  /* Touch-friendly table interactions */
  .table-modern tbody tr {
    transition: background-color 0.2s ease;
  }
  
  .table-modern tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05) !important;
  }
  
  /* Mobile table header sticky */
  .table-modern thead th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  /* Force specific column widths to prevent overlap */
  .projects-table-mobile th:nth-child(1),
  .projects-table-mobile td:nth-child(1) {
    width: 70px !important;
    min-width: 70px !important;
  }
  
  .projects-table-mobile th:nth-child(2),
  .projects-table-mobile td:nth-child(2) {
    width: 70px !important;
    min-width: 70px !important;
  }
  
  .projects-table-mobile th:nth-child(3),
  .projects-table-mobile td:nth-child(3) {
    width: 150px !important;
    min-width: 150px !important;
  }
  
  .projects-table-mobile th:nth-child(4),
  .projects-table-mobile td:nth-child(4) {
    width: 150px !important;
    min-width: 150px !important;
  }
  
  .projects-table-mobile th:nth-child(5),
  .projects-table-mobile td:nth-child(5) {
    width: 70px !important;
    min-width: 70px !important;
  }
  
  .projects-table-mobile th:nth-child(6),
  .projects-table-mobile td:nth-child(6) {
    width: 100px !important;
    min-width: 100px !important;
  }
  
  .projects-table-mobile th:nth-child(7),
  .projects-table-mobile td:nth-child(7) {
    width: 150px !important;
    min-width: 150px !important;
    white-space: normal !important; /* Cho phép xuống dòng */
    word-break: break-word !important; /* Tự động xuống dòng khi quá dài */
  }
  
  .projects-table-mobile th:nth-child(8),
  .projects-table-mobile td:nth-child(8) {
    width: 70px !important;
    min-width: 70px !important;
  }
  .projects-table-mobile th:nth-child(9),
  .projects-table-mobile td:nth-child(9) {
    width: 150px !important;
    min-width: 150px !important;
  }
  
  .projects-table-mobile th:nth-child(10),
  .projects-table-mobile td:nth-child(10) {
    width: 100px !important;
    min-width: 100px !important;
  }
  .projects-table-mobile th:nth-child(11),
  .projects-table-mobile td:nth-child(11) {
    width: 150px !important;
    min-width: 150px !important;
  }
  .projects-table-mobile th:nth-child(12),
  .projects-table-mobile td:nth-child(12) {
    width: 140px !important;
    min-width: 140px !important;
  }
  .projects-table-mobile th:nth-child(13),
  .projects-table-mobile td:nth-child(13) {
    width: 80px !important;
    min-width: 80px !important;
  }
  .projects-table-mobile th:nth-child(14),
  .projects-table-mobile td:nth-child(14) {
    width: 80px !important;
    min-width: 80px !important;
  }
  .projects-table-mobile th:nth-child(15),
  .projects-table-mobile td:nth-child(15) {
    width: 80px !important;
    min-width: 80px !important;
  }
  .projects-table-mobile th:nth-child(16),
  .projects-table-mobile td:nth-child(16) {
    width: 130px !important;
    min-width: 130px !important;
  }
  .projects-table-mobile th:nth-child(17),
  .projects-table-mobile td:nth-child(17) {
    width: 130px !important;
    min-width: 130px !important;
  }
  .projects-table-mobile th:nth-child(18),
  .projects-table-mobile td:nth-child(18) {
    width: 130px !important;
    min-width: 130px !important;
  }
  .projects-table-mobile th:nth-child(19),
  .projects-table-mobile td:nth-child(19) {
    width: 130px !important;
    min-width: 130px !important;
  }
  .projects-table-mobile th:nth-child(20),
  .projects-table-mobile td:nth-child(20) {
    width: 130px !important;
    min-width: 130px !important;
  }
  .projects-table-mobile th:nth-child(21),
  .projects-table-mobile td:nth-child(21) {
    width: 130px !important;
    min-width: 130px !important;
  }
  .projects-table-mobile th:nth-child(22),
  .projects-table-mobile td:nth-child(22) {
    width: 130px !important;
    min-width: 130px !important;
  }
  /* Prevent flex layout interference */
  .table-modern {
    display: table !important;
  }
  
  .table-modern thead {
    display: table-header-group !important;
  }
  
  .table-modern tbody {
    display: table-row-group !important;
  }
  
  /* Mobile table improvements */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  
  /* Mobile table cell optimization */
  .table-modern td {
    white-space: nowrap;
    min-width: 80px;
  }
  
  .table-modern th {
    white-space: nowrap;
    min-width: 80px;
  }
  
  /* Mobile status badges */
  .status-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
  }
}

/* =====================================================================
   MOBILE PROJECT DETAILS
   ===================================================================== */

@media (max-width: 768px) {
  /* Project header mobile */
  .project-header {
    padding: 1rem 0.5rem;
  }
  
  .project-title {
    font-size: 1.25rem;
    line-height: 1.3;
  }
  
  .project-subtitle {
    font-size: 0.9rem;
  }
  
  /* Project tabs mobile */
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid #dee2e6;
  }
  
  .nav-tabs .nav-link {
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border: none;
    border-bottom: 2px solid transparent;
  }
  
  .nav-tabs .nav-link.active {
    border-bottom-color: #007bff;
    background-color: transparent;
  }
  
  /* Project filters mobile */
  .filters-panel {
    margin-bottom: 1rem;
  }
  
  .filter-group {
    margin-bottom: 0.75rem;
  }
  
  .filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
  }
  
  /* Mobile filter buttons */
  .filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .filter-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
  }
}

/* =====================================================================
   MOBILE FORMS AND INPUTS
   ===================================================================== */

@media (max-width: 576px) {
  /* Form groups mobile */
  .form-group {
    margin-bottom: 1rem;
  }
  
  /* Input fields mobile */
  .form-control,
  .form-select {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.75rem 1rem;
    border-radius: 8px;
  }
  
  /* Mobile date inputs */
  input[type="date"],
  input[type="datetime-local"] {
    font-size: 16px;
    padding: 0.75rem 1rem;
  }
  
  /* Mobile file inputs */
  .file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
  }
  
  .file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
  }
  
  .file-input-label {
    display: block;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .file-input-label:hover {
    border-color: #007bff;
    background-color: #e7f3ff;
  }
  
  /* Mobile textarea */
  textarea.form-control {
    min-height: 100px;
    resize: vertical;
  }
}

/* =====================================================================
   MOBILE STATUS SELECTION - HIDE BADGES, SHOW DROPDOWNS
   ===================================================================== */

@media (max-width: 768px) {
  /* Hide status badge selection on mobile */
  .create_status_selection {
    display: none !important;
  }
  
  /* Show mobile status dropdown instead */
  .mobile-status-dropdown {
    display: block !important;
  }
  
  /* Hide desktop badge selection on mobile */
  .d-flex.flex-wrap.justify-content-center.create_status_selection {
    display: none !important;
  }
  
  /* Hide mobile dropdown on desktop */
  .d-block.d-md-none {
    display: block !important;
  }
}

/* =====================================================================
   DESKTOP - HIDE MOBILE DROPDOWN
   ===================================================================== */

@media (min-width: 769px) {
  /* Hide mobile status dropdown on desktop */
  .d-block.d-md-none {
    display: none !important;
  }
  
  /* Show desktop badge selection on desktop */
  .create_status_selection {
    display: flex !important;
  }
}
  
  /* Mobile status dropdown styling */
  .mobile-status-dropdown .Select-control {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    background-color: #fff !important;
  }
  
  .mobile-status-dropdown .Select-value {
    font-size: 0.875rem !important;
    color: #333 !important;
  }
  
  .mobile-status-dropdown .Select-placeholder {
    color: #6c757d !important;
    font-size: 0.875rem !important;
  }
  
  /* Ensure proper spacing for mobile dropdowns */
  .mobile-status-dropdown {
    margin-bottom: 1rem !important;
  }

/* =====================================================================
   MOBILE DROPDOWN ICONS FIXES
   ===================================================================== */

@media (max-width: 768px) {
  /* Ensure dropdown icons (x and arrow) are positioned correctly on mobile */
  .Select-control {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    background-color: #fff !important;
  }
  
  /* Clear button (x icon) positioning */
  .Select-clear-zone {
    position: absolute !important;
    right: 30px !important; /* Position before the dropdown arrow */
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
    color: #999 !important;
    font-size: 14px !important;
    z-index: 10 !important;
  }
  
  .Select-clear-zone:hover {
    color: #333 !important;
  }
  
  /* Dropdown arrow positioning */
  .Select-arrow-zone {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
    color: #999 !important;
    z-index: 10 !important;
  }
  
  .Select-arrow {
    border-color: #999 transparent transparent !important;
    border-style: solid !important;
    border-width: 5px 4px 0 4px !important;
    height: 0 !important;
    width: 0 !important;
    transition: transform 0.2s ease !important;
  }
  
  .Select.is-open .Select-arrow {
    transform: rotate(180deg) !important;
  }
  
  /* Value container to prevent overlap with icons */
  .Select-value {
    flex: 1 !important;
    padding-right: 50px !important; /* Space for both icons */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  
  .Select-value-label {
    font-size: 0.875rem !important;
    color: #333 !important;
  }
  
  /* Placeholder styling */
  .Select-placeholder {
    color: #6c757d !important;
    font-size: 0.875rem !important;
    padding-right: 50px !important; /* Space for both icons */
  }
  
  /* Ensure proper touch targets */
  .Select-clear-zone,
  .Select-arrow-zone {
    min-width: 44px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Fix for Dash dropdown components */
  .dash-dropdown .Select-control {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    background-color: #fff !important;
  }
  
  /* Ensure dropdown menu appears correctly */
  .Select-menu-outer {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    background: white !important;
    border: 1px solid #ced4da !important;
    border-top: none !important;
    border-radius: 0 0 6px 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    max-height: 200px !important;
    overflow-y: auto !important;
  }
  
  .Select-option {
    padding: 0.75rem 1rem !important;
    cursor: pointer !important;
    font-size: 0.875rem !important;
    border-bottom: 1px solid #f8f9fa !important;
    transition: background-color 0.2s ease !important;
  }
  
  .Select-option:hover {
    background-color: #f8f9fa !important;
  }
  
  .Select-option.is-selected {
    background-color: #e3f2fd !important;
    color: #1976d2 !important;
  }
  
  .Select-option.is-focused {
    background-color: #f5f5f5 !important;
  }
}

/* =====================================================================
   SMALL MOBILE DROPDOWN OPTIMIZATION
   ===================================================================== */

@media (max-width: 576px) {
  /* Smaller touch targets for very small screens */
  .Select-clear-zone,
  .Select-arrow-zone {
    min-width: 40px !important;
    min-height: 40px !important;
  }
  
  .Select-clear-zone {
    right: 28px !important;
  }
  
  .Select-arrow-zone {
    right: 6px !important;
  }
  
  /* Adjust padding for smaller screens */
  .Select-control {
    padding: 0.6rem 0.8rem !important;
    min-height: 40px !important;
  }
  
  .Select-value,
  .Select-placeholder {
    padding-right: 45px !important;
    font-size: 0.8rem !important;
  }
  
  .Select-option {
    padding: 0.6rem 0.8rem !important;
    font-size: 0.8rem !important;
  }
}

/* =====================================================================
   MOBILE MODALS AND POPUPS
   ===================================================================== */

@media (max-width: 768px) {
  /* Modal mobile optimization */
  .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 {
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
  }
  
  .modal-title {
    font-size: 1.1rem;
    font-weight: 600;
  }
  
  .modal-body {
    padding: 1.25rem;
    max-height: 70vh;
    overflow-y: auto;
  }
  
  .modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
  }
  
  /* Mobile modal buttons */
  .modal-footer .btn {
    flex: 1;
    margin: 0 0.25rem;
  }
  
  /* Mobile tooltips */
  .tooltip {
    font-size: 0.75rem;
  }
  
  /* Mobile popovers */
  .popover {
    max-width: 280px;
    font-size: 0.8rem;
  }
}

/* =====================================================================
   MOBILE NOTIFICATIONS AND ALERTS
   ===================================================================== */

@media (max-width: 576px) {
  /* Alert mobile styling */
  .alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
  }
  
  .alert-dismissible {
    padding-right: 3rem;
  }
  
  .alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
  }
  
  /* Toast notifications mobile */
  .toast {
    max-width: 100%;
    margin: 0.5rem;
  }
  
  .toast-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
  
  .toast-body {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
  
  /* Progress indicators mobile */
  .progress-indicator {
    height: 4px;
    border-radius: 2px;
  }
  
  .progress-indicator .progress-bar {
    border-radius: 2px;
  }
}

/* =====================================================================
   MOBILE LOADING STATES
   ===================================================================== */

@media (max-width: 768px) {
  /* Loading spinner mobile */
  .loading-spinner {
    width: 40px;
    height: 40px;
  }
  
  .loading-text {
    font-size: 0.85rem;
    margin-top: 0.5rem;
  }
  
  /* Skeleton loading mobile */
  .skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
  }
  
  @keyframes loading {
    0% {
      background-position: 200% 0;
    }
    100% {
      background-position: -200% 0;
    }
  }
  
  /* Mobile skeleton sizes */
  .skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .skeleton-title {
    height: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .skeleton-button {
    height: 2.5rem;
    border-radius: 6px;
  }
}

/* =====================================================================
   MOBILE GESTURE SUPPORT
   ===================================================================== */

@media (max-width: 768px) {
  /* Swipe gestures for mobile */
  .swipeable {
    touch-action: pan-y pinch-zoom;
  }
  
  /* Pull to refresh indicator */
  .pull-refresh {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.8rem;
  }
  
  /* Mobile scroll indicators */
  .scroll-indicator {
    position: fixed;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    z-index: 1000;
    opacity: 0.7;
    transition: opacity 0.3s ease;
  }
  
  .scroll-indicator:hover {
    opacity: 1;
  }
  
  /* Mobile back to top button */
  .back-to-top {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background-color: #007bff !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3) !important;
    z-index: 1000 !important;
    transition: opacity 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .back-to-top i {
    font-size: 1.2rem;
  }
  
  .back-to-top.visible {
    opacity: 1;
  }
  
  /* Mobile specific back-to-top adjustments */
  @media (max-width: 768px) {
    .back-to-top {
      width: 56px;
      height: 56px;
      bottom: 16px;
      right: 16px;
    }
    
    .back-to-top i {
      font-size: 1.4rem;
    }
  }
  
  /* Small mobile adjustments */
  @media (max-width: 576px) {
    .back-to-top {
      width: 52px;
      height: 52px;
      bottom: 12px;
      right: 12px;
    }
    
    .back-to-top i {
      font-size: 1.3rem;
    }
  }
}

/* =====================================================================
   PROJECT MANAGEMENT FILTERS MOBILE TOGGLE
   ===================================================================== */

@media (max-width: 768px) {
  /* Hide filters by default on mobile */
  #filters-row {
    display: none !important;
  }
  
  /* Show filters when active */
  #filters-row.show-filters {
    display: flex !important;
    animation: slideDown 0.3s ease-out;
  }
  
  /* Slide down animation */
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
      max-height: 0;
    }
    to {
      opacity: 1;
      transform: translateY(0);
      max-height: 500px;
    }
  }
  
  /* Toggle button styling */
  #btn-toggle-filters {
    border-radius: 8px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    width: auto !important;
    min-width: 200px !important;
    max-width: 300px !important;
    padding: 0.75rem 1.5rem !important;
    margin: 0 auto 20px auto !important;
    display: inline-block !important;
  }
  
  #btn-toggle-filters:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  }
  
  #btn-toggle-filters.active {
    background-color: #6c757d !important;
    color: white !important;
    border-color: #6c757d !important;
  }
  
  /* Filters card mobile optimization */
  #filters-card .card-body {
    padding: 1rem !important;
  }
  
  /* Make filter rows stack vertically on mobile */
  #filters-card .row {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }
  
  #filters-card .col {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
  }
  
  /* Filter labels mobile */
  #filters-card .form-label {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
    color: #495057 !important;
  }
  
  /* Filter inputs mobile */
  #filters-card .Select-control,
  #filters-card .form-control {
    height: 44px !important;
    font-size: 0.875rem !important;
    border-radius: 6px !important;
  }
  
  /* Filter buttons mobile */
  #filters-card .btn {
    height: 44px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    border-radius: 6px !important;
  }
}

/* =====================================================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ===================================================================== */

@media (max-width: 768px) {
  /* Reduce motion for better performance */
  * {
    animation-duration: 0.1s !important;
    animation-delay: 0s !important;
    transition-duration: 0.1s !important;
  }
  
  /* Optimize images for mobile */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* Reduce box shadows for performance */
  .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  
  /* Optimize gradients for mobile */
  .gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }
  
  /* Reduce border radius for performance */
  .card,
  .btn,
  .form-control {
    border-radius: 6px;
  }
  
  /* Optimize font rendering */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
}

/* =====================================================================
   MOBILE ACCESSIBILITY ENHANCEMENTS
   ===================================================================== */

@media (max-width: 768px) {
  /* Larger touch targets */
  .btn,
  .nav-link,
  .dropdown-item,
  .list-group-item {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
  }
  
  /* Better focus indicators */
  .btn:focus,
  .nav-link:focus,
  .form-control:focus,
  .form-select:focus {
    outline: 2px solid #007bff;
    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) {
    * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
  
  /* Screen reader optimizations */
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

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

@media print and (max-width: 768px) {
  /* Hide non-essential elements */
  .navbar,
  .sidebar,
  .filters-section,
  .pagination-controls,
  .quick-actions,
  .modal,
  .tooltip,
  .popover {
    display: none !important;
  }
  
  /* Optimize content for print */
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
    margin-bottom: 1rem;
  }
  
  .table-modern {
    font-size: 10px;
    border: 1px solid #000;
  }
  
  .table-modern th,
  .table-modern td {
    border: 1px solid #000;
    padding: 4px 6px;
  }
  
  /* Ensure charts are visible */
  .chart-container {
    height: 200px;
    page-break-inside: avoid;
    border: 1px solid #000;
  }
  
  /* Optimize typography for print */
  body {
    font-size: 12px;
    line-height: 1.3;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
  
  /* Remove backgrounds for better print */
  .card,
  .table-modern,
  .btn {
    background-color: white !important;
    color: black !important;
  }
}

/* =====================================================================
   LOGIN MODAL MOBILE FIXES (override aggressive row rules)
   ===================================================================== */
@media (max-width: 768px) {
	/* Khôi phục flex cho input group trong form đăng nhập */
	.login-modal-custom .input-group {
		display: flex !important;
		flex-wrap: nowrap !important;
		align-items: stretch !important;
		width: 100% !important;
	}

	.login-modal-custom .input-group-text {
		display: flex !important;
		align-items: center !important;
	}

	.login-modal-custom .input-group .form-control {
		flex: 1 1 auto !important;
		min-width: 0 !important;
		width: 1% !important; /* giữ đúng behavior của bootstrap */
		color: #212529 !important;
		background-color: #fff !important;
	}

	/* Không ép display:block cho các phần tử hàng trong modal đăng nhập */
	.login-modal-custom .row { 
		display: flex !important; 
		flex-direction: column !important; 
		gap: .5rem !important; 
	}

	.login-modal-custom .row > div,
	.login-modal-custom .row > .col,
	.login-modal-custom .row > [class*="col-"] {
		width: 100% !important;
		max-width: 100% !important;
		flex: 0 0 auto !important;
		display: flex !important; /* vẫn xếp dọc các field */
	}

	/* Nút và checkbox hiển thị đúng */
	.login-modal-custom .form-check {
		display: flex !important;
		align-items: center !important;
	}

	/* Bảo đảm modal có đủ chiều rộng hợp lý trên mobile */
	.login-modal-custom .modal-dialog { 
		margin: .75rem auto !important; 
	}
}

/* =====================================================================
   EXCEL BUTTONS MOBILE CENTERING
   ===================================================================== */
@media (max-width: 768px) {
	/* Center the button group container - keep horizontal layout */
	.btn-group {
		display: flex !important;
		flex-direction: row !important;
		justify-content: center !important;
		align-items: center !important;
		width: 100% !important;
		margin: 0 auto !important;
		gap: 0.5rem !important;
		flex-wrap: wrap !important;
	}
	
	/* Keep buttons in horizontal row, just center them */
	.btn-group .btn {
		flex: 0 0 auto !important;
		margin: 0 !important;
		white-space: nowrap !important;
	}
	
	/* On very small screens, allow wrapping to 2 rows if needed */
	@media (max-width: 480px) {
		.btn-group {
			gap: 0.25rem !important;
		}
		
		.btn-group .btn {
			font-size: 0.875rem !important;
			padding: 0.375rem 0.375rem !important;
		}
	}
}
