/* Mobile-Specific Styles for FabCommand */
/* This file contains mobile-only styles that don't affect desktop layout */
/* All styles are wrapped in mobile media queries to preserve desktop appearance */

/* ============================= */
/* Base Mobile Styles */
/* ============================= */

/* Mobile viewport optimization */
@media only screen and (max-width: 768px) {
  /* Prevent horizontal scroll and optimize touch */
  html {
    overflow-x: hidden;
  }
  
  body {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
  }
  
  /* Remove tap highlight */
  * {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Ensure touch targets are large enough */
  button, 
  .btn, 
  a, 
  input[type="submit"], 
  input[type="button"],
  .clickable {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Make images responsive */
  img {
    max-width: 100%;
    height: auto;
  }
}

/* ============================= */
/* Login Page Mobile Styles */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Login container adjustments */
  .login-container {
    min-height: 100vh;
    padding: 20px 15px !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  
  /* Login box mobile optimization */
  .login-box {
    width: 100% !important;
    max-width: 400px !important;
    margin: 0 auto !important;
    padding: 30px 20px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
  }
  
  /* Logo adjustments */
  .login-logo img {
    max-width: 180px !important;
    height: auto !important;
  }
  
  /* Form group spacing */
  .form-group {
    margin-bottom: 20px !important;
  }
  
  /* Input fields mobile optimization */
  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="password"] {
    height: 50px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 12px 15px !important;
    border-radius: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Labels */
  .form-label,
  label {
    font-size: 14px !important;
    margin-bottom: 8px !important;
    font-weight: 600 !important;
  }
  
  /* Remember me checkbox area */
  .form-check {
    margin: 20px 0 !important;
  }
  
  .form-check-input {
    width: 20px !important;
    height: 20px !important;
    margin-right: 10px !important;
  }
  
  .form-check-label {
    font-size: 14px !important;
    line-height: 20px !important;
  }
  
  /* Login button */
  .btn-primary,
  button[type="submit"] {
    width: 100% !important;
    height: 50px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    margin-top: 10px !important;
  }
  
  /* Links */
  .login-box a {
    font-size: 14px !important;
    padding: 10px 0 !important;
    display: inline-block !important;
  }
  
  /* Login footer */
  .login-footer {
    margin-top: 20px !important;
    text-align: center !important;
  }
  
  /* Error messages */
  .alert {
    padding: 12px 15px !important;
    font-size: 14px !important;
    margin-bottom: 20px !important;
    border-radius: 8px !important;
  }
}

/* Small mobile devices (max-width: 480px) */
@media only screen and (max-width: 480px) {
  .login-box {
    padding: 25px 15px !important;
  }
  
  .login-logo img {
    max-width: 150px !important;
  }
}

/* ============================= */
/* Dashboard Mobile Styles */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Hide desktop sidebar on mobile */
  .dashboard-sidebar,
  .sidebar {
    position: fixed !important;
    left: -100% !important;
    top: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    background: #fff !important;
    z-index: 9999 !important;
    transition: left 0.3s ease !important;
    overflow-y: auto !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1) !important;
  }
  
  /* Show sidebar when active */
  .dashboard-sidebar.active,
  .sidebar.active {
    left: 0 !important;
  }
  
  /* Mobile header */
  .dashboard-header,
  .navbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    background: #fff !important;
    padding: 10px 15px !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 60px !important;
  }
  
  /* Mobile hamburger menu - ALWAYS HIDDEN */
  .mobile-menu-toggle {
    display: none !important;
  }
  
  /* Visual swipe hint on mobile */
  .main-content::before {
    content: '';
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 80px;
    background: linear-gradient(to right, rgba(14, 165, 233, 0.1), transparent);
    border-radius: 0 10px 10px 0;
    pointer-events: none;
    z-index: 100;
    animation: swipeHint 3s ease-in-out infinite;
  }
  
  @keyframes swipeHint {
    0%, 100% {
      opacity: 0;
      transform: translateY(-50%) translateX(-10px);
    }
    50% {
      opacity: 0.5;
      transform: translateY(-50%) translateX(0);
    }
  }
  
  @keyframes fadeInOut {
    0% {
      opacity: 0;
      transform: translateY(-50%) translateX(-20px);
    }
    20%, 80% {
      opacity: 1;
      transform: translateY(-50%) translateX(0);
    }
    100% {
      opacity: 0;
      transform: translateY(-50%) translateX(-20px);
    }
  }
  
  /* Main content adjustment */
  .dashboard-main,
  .main-content {
    margin-left: 0 !important;
    padding: 15px !important;
    width: 100% !important;
    min-height: calc(100vh - 60px) !important;
  }
  
  /* Dashboard cards grid */
  .dashboard-stats,
  .stats-grid,
  .card-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    margin-bottom: 20px !important;
  }
  
  /* Individual stat cards */
  .stat-card,
  .dashboard-card,
  .card {
    padding: 20px !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    min-height: auto !important;
  }
  
  /* Stat card content */
  .stat-value,
  .card-value {
    font-size: 28px !important;
    font-weight: 700 !important;
    margin: 10px 0 !important;
  }
  
  .stat-label,
  .card-label {
    font-size: 14px !important;
    color: #666 !important;
    font-weight: 500 !important;
  }
  
  /* Charts container */
  .charts-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }
  
  .chart-card {
    width: 100% !important;
    padding: 20px !important;
    background: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  }
  
  /* Make charts scrollable horizontally if needed */
  .chart-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Quick actions */
  .quick-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-top: 20px !important;
  }
  
  .quick-action-btn {
    padding: 15px 10px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
    text-align: center !important;
    min-height: 60px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .quick-action-btn i {
    font-size: 20px !important;
    margin-bottom: 5px !important;
  }
  
  /* Table responsive wrapper */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 -15px !important;
    padding: 0 15px !important;
  }
  
  /* Overlay for sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
  }
  
  .sidebar-overlay.active {
    display: block;
  }
  
  /* User info in sidebar */
  .sidebar-user-info {
    padding: 20px !important;
    border-bottom: 1px solid #eee !important;
  }
  
  /* Navigation menu items */
  .nav-menu {
    padding: 20px 0 !important;
  }
  
  .nav-item {
    margin-bottom: 5px !important;
  }
  
  .nav-link {
    padding: 12px 20px !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
  }
  
  .nav-link i {
    font-size: 20px !important;
    margin-right: 15px !important;
    width: 24px !important;
    text-align: center !important;
  }
  
  /* Welcome section */
  .welcome-section {
    margin-bottom: 20px !important;
  }
  
  .welcome-section h1 {
    font-size: 24px !important;
    margin-bottom: 5px !important;
  }
  
  .welcome-section p {
    font-size: 14px !important;
    color: #666 !important;
  }
}

/* Extra small devices */
@media only screen and (max-width: 480px) {
  /* Even more compact stats */
  .stat-value,
  .card-value {
    font-size: 24px !important;
  }
  
  /* Single column for quick actions */
  .quick-actions {
    grid-template-columns: 1fr !important;
  }
  
  /* Smaller padding on mobile */
  .dashboard-main,
  .main-content {
    padding: 10px !important;
  }
  
  .stat-card,
  .dashboard-card {
    padding: 15px !important;
  }
}

/* ============================= */
/* Touch Feedback Styles */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Touch active state */
  .touch-active {
    opacity: 0.7 !important;
    transform: scale(0.98) !important;
    transition: all 0.1s ease !important;
  }
  
  /* Improve button touch states */
  button:active,
  .btn:active,
  a:active {
    opacity: 0.8;
  }
  
  /* Remove hover effects on touch devices */
  .touch-device *:hover {
    opacity: 1 !important;
  }
}

/* ============================= */
/* Mobile Navigation Helpers */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Add this class to body when sidebar is open */
  body.sidebar-open {
    overflow: hidden !important;
  }
  
  /* Ensure z-index hierarchy */
  .mobile-menu-toggle {
    z-index: 1001 !important;
  }
  
  .sidebar-overlay {
    z-index: 9998 !important;
  }
  
  .dashboard-sidebar,
  .sidebar {
    z-index: 9999 !important;
  }
}

/* ============================= */
/* Mobile Table Styles */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Responsive table wrapper */
  .table-container,
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 -15px !important;
    padding: 0 15px !important;
    position: relative !important;
  }
  
  /* Visual scroll indicators */
  .table-container::before,
  .table-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30px;
    pointer-events: none;
    z-index: 10;
    display: none;
  }
  
  .table-container::before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
  }
  
  .table-container::after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
  }
  
  /* Table adjustments */
  table {
    min-width: auto !important;
    font-size: 14px !important;
  }
  
  th, td {
    padding: 10px 8px !important;
    white-space: nowrap !important;
  }
  
  /* Sticky first column for important data */
  .sticky-column table td:first-child,
  .sticky-column table th:first-child {
    position: sticky !important;
    left: 0 !important;
    background: #fff !important;
    z-index: 5 !important;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1) !important;
  }
  
  /* Card view for data-heavy tables */
  .mobile-card-view table {
    display: block !important;
  }
  
  .mobile-card-view tbody {
    display: block !important;
  }
  
  .mobile-card-view tr {
    display: block !important;
    margin-bottom: 15px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 15px !important;
    background: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
  }
  
  .mobile-card-view td {
    display: block !important;
    text-align: left !important;
    padding: 8px 0 !important;
    border: none !important;
    position: relative !important;
    padding-left: 35% !important;
  }
  
  .mobile-card-view td::before {
    content: attr(data-label);
    position: absolute !important;
    left: 0 !important;
    width: 30% !important;
    font-weight: 600 !important;
    color: #666 !important;
  }
  
  .mobile-card-view thead {
    display: none !important;
  }
}

/* ============================= */
/* Mobile Form Styles */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Form container */
  .form-container,
  .modal-body form {
    padding: 15px !important;
  }
  
  /* Stack form columns */
  .form-row,
  .form-grid {
    display: block !important;
  }
  
  .form-col,
  .col-md-6,
  .col-lg-4,
  .col-sm-6 {
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 15px !important;
  }
  
  /* Form groups */
  .form-group {
    margin-bottom: 20px !important;
  }
  
  /* Labels */
  label,
  .form-label {
    font-size: 14px !important;
    margin-bottom: 8px !important;
    display: block !important;
    font-weight: 600 !important;
  }
  
  /* All form inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  textarea,
  select,
  .form-control {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 12px 15px !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    background: #fff !important;
  }
  
  /* Textarea specific */
  textarea {
    min-height: 100px !important;
    resize: vertical !important;
  }
  
  /* Select dropdown */
  select {
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    padding-right: 45px !important;
  }
  
  /* Buttons in forms */
  .form-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin-top: 20px !important;
  }
  
  .form-actions button,
  .form-actions .btn {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 16px !important;
  }
  
  /* Primary action button */
  .form-actions .btn-primary {
    order: -1 !important; /* Move primary action to top */
  }
}

/* ============================= */
/* Mobile Modal Styles */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Modal backdrop */
  .modal-backdrop,
  .modal-overlay {
    background: rgba(0, 0, 0, 0.6) !important;
  }
  
  /* Modal container */
  .modal {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  
  /* Modal content */
  .modal-dialog,
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Modal header */
  .modal-header {
    position: sticky !important;
    top: 0 !important;
    background: #fff !important;
    z-index: 10 !important;
    padding: 20px !important;
    border-radius: 20px 20px 0 0 !important;
    flex-shrink: 0 !important;
  }
  
  /* Drag handle indicator */
  .modal-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
  }
  
  /* Modal body */
  .modal-body {
    padding: 20px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex: 1 !important;
  }
  
  /* Modal footer */
  .modal-footer {
    position: sticky !important;
    bottom: 0 !important;
    background: #fff !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 15px 20px !important;
    flex-shrink: 0 !important;
  }
  
  /* Modal actions */
  .modal-footer .btn {
    min-height: 44px !important;
  }
  
  /* Close button */
  .modal-close,
  .close-modal {
    position: absolute !important;
    right: 15px !important;
    top: 15px !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: #f1f5f9 !important;
  }
}

/* ============================= */
/* Mobile Card Styles */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Card grid */
  .card-grid,
  .project-grid,
  .team-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  
  /* Individual cards */
  .card,
  .project-card,
  .team-card,
  .task-card {
    padding: 15px !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
  }
  
  /* Card actions */
  .card-actions {
    display: flex !important;
    gap: 10px !important;
    margin-top: 15px !important;
  }
  
  .card-actions .btn {
    flex: 1 !important;
    min-height: 40px !important;
    font-size: 14px !important;
  }
}

/* ============================= */
/* Mobile Tab Navigation */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Tab navigation container */
  .tab-navigation,
  .nav-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
    margin: 0 -15px !important;
    padding: 0 15px !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }
  
  /* Hide scrollbar but keep functionality */
  .tab-navigation::-webkit-scrollbar,
  .nav-tabs::-webkit-scrollbar {
    display: none !important;
  }
  
  /* Tab items */
  .tab-nav-item,
  .nav-tab {
    display: inline-block !important;
    padding: 12px 20px !important;
    white-space: nowrap !important;
    min-width: auto !important;
    font-size: 14px !important;
  }
  
  /* Active tab */
  .tab-nav-item.active,
  .nav-tab.active {
    border-bottom: 3px solid var(--accent-primary) !important;
    font-weight: 600 !important;
  }
  
  /* Tab content */
  .tab-content {
    padding: 15px !important;
  }
}

/* ============================= */
/* Mobile Menu Toggle - Hide on Desktop */
/* ============================= */

/* Hide mobile menu toggle on desktop */
.mobile-menu-toggle {
  display: none !important;
}

/* Only show on mobile */
@media only screen and (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #333;
    padding: 10px;
    cursor: pointer;
  }
}

/* ============================= */
/* Mobile Specific Components */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Floating Action Button */
  .fab-button {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background: var(--accent-primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100 !important;
  }
  
  /* Bottom navigation bar */
  .bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #fff !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    justify-content: space-around !important;
    padding: 8px 0 !important;
    z-index: 100 !important;
  }
  
  .bottom-nav-item {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 8px !important;
    color: #666 !important;
    text-decoration: none !important;
    font-size: 12px !important;
  }
  
  .bottom-nav-item i {
    font-size: 20px !important;
    margin-bottom: 4px !important;
  }
  
  .bottom-nav-item.active {
    color: var(--accent-primary) !important;
  }
  
  /* Adjust main content for bottom nav */
  .has-bottom-nav .main-content {
    padding-bottom: 80px !important;
  }
}

/* ============================= */
/* Mobile Search */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Search bar */
  .search-container {
    width: 100% !important;
    margin-bottom: 15px !important;
  }
  
  .search-input,
  input[type="search"] {
    width: 100% !important;
    height: 44px !important;
    padding: 12px 45px 12px 15px !important;
    font-size: 16px !important;
    border-radius: 22px !important;
    border: 1px solid #e2e8f0 !important;
  }
  
  .search-icon {
    position: absolute !important;
    right: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
  }
}

/* ============================= */
/* Mobile File Upload */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Upload area */
  .upload-area,
  .drop-zone {
    padding: 30px 20px !important;
    border: 2px dashed #cbd5e1 !important;
    border-radius: 12px !important;
    text-align: center !important;
    background: #f8fafc !important;
  }
  
  .upload-area.active,
  .drop-zone.active {
    border-color: var(--accent-primary) !important;
    background: rgba(14, 165, 233, 0.05) !important;
  }
  
  /* Upload button */
  .upload-btn {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 16px !important;
    margin-top: 15px !important;
  }
  
  /* File list */
  .file-list-item {
    display: flex !important;
    align-items: center !important;
    padding: 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    margin-bottom: 8px !important;
  }
  
  .file-list-item .file-name {
    flex: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}

/* ============================= */
/* Mobile Kanban Board */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Kanban container */
  .kanban-board {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 -15px !important;
    padding: 0 15px !important;
  }
  
  .kanban-columns {
    display: flex !important;
    gap: 15px !important;
    min-width: max-content !important;
  }
  
  .kanban-column {
    min-width: 280px !important;
    flex-shrink: 0 !important;
  }
  
  .kanban-card {
    padding: 12px !important;
    margin-bottom: 10px !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08) !important;
  }
}

/* ============================= */
/* Page-Specific Mobile Styles */
/* ============================= */

/* Project Page Mobile Styles */
@media only screen and (max-width: 768px) {
  /* Project tabs horizontal scroll */
  .project-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
    margin: 0 -15px !important;
    padding: 0 15px !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }
  
  .project-tabs::-webkit-scrollbar {
    display: none !important;
  }
  
  .project-tab {
    display: inline-block !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
  }
  
  /* Project header */
  .project-header {
    padding: 15px !important;
  }
  
  .project-header h1 {
    font-size: 24px !important;
  }
  
  /* BOM table card view on mobile */
  @media (max-width: 480px) {
    .bom-table-container .mobile-card-view {
      display: block !important;
    }
  }
}

/* Time Tracking Page Mobile Styles */
@media only screen and (max-width: 768px) {
  /* Time tracking stats */
  .time-tracking-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
  }
  
  .time-tracking-stats .stat-card {
    padding: 15px !important;
  }
  
  .stat-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
  }
  
  .stat-info h3 {
    font-size: 1.5rem !important;
  }
  
  .stat-info p {
    font-size: 12px !important;
  }
  
  /* Time grid navigation */
  .time-grid-navigation {
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 10px !important;
  }
  
  .nav-btn {
    font-size: 12px !important;
    padding: 8px 12px !important;
  }
  
  /* Time grid */
  .time-grid-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .time-grid {
    min-width: 600px !important;
  }
}

/* Inventory Page Mobile Styles */
@media only screen and (max-width: 768px) {
  /* Inventory filters */
  .inventory-controls {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .filter-controls {
    width: 100% !important;
  }
  
  .filter-controls select,
  .filter-controls input {
    width: 100% !important;
  }
  
  /* Inventory table as cards */
  .inventory-table-container {
    overflow-x: visible !important;
  }
  
  @media (max-width: 480px) {
    .inventory-table {
      display: none !important;
    }
    
    /* Show mobile card view */
    .inventory-mobile-cards {
      display: block !important;
    }
  }
}

/* Tasks/Kanban Page Mobile Styles */
@media only screen and (max-width: 768px) {
  /* Kanban filters */
  .kanban-filters {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .filter-group {
    width: 100% !important;
  }
  
  .filter-group select,
  .filter-group input {
    width: 100% !important;
  }
  
  /* Board sections tabs */
  .board-sections-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
  }
  
  .section-tab {
    display: inline-block !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
  }
}

/* Team Page Mobile Styles */
@media only screen and (max-width: 768px) {
  /* Team member cards */
  .team-members-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  
  .team-member-card {
    padding: 15px !important;
  }
  
  /* Team member info layout */
  .member-info {
    flex-direction: column !important;
    text-align: center !important;
  }
  
  .member-avatar {
    margin-bottom: 10px !important;
  }
}

/* Shipping Page Mobile Styles */
@media only screen and (max-width: 768px) {
  /* Shipping controls */
  .shipping-controls {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  /* Order cards */
  .order-card {
    padding: 15px !important;
  }
  
  .order-details {
    font-size: 14px !important;
  }
  
  /* Shipping status badges */
  .status-badge {
    font-size: 12px !important;
    padding: 4px 8px !important;
  }
}

/* Build/Analysis Page Mobile Styles */
@media only screen and (max-width: 768px) {
  /* Build analysis controls */
  .build-controls {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  /* Analysis results */
  .analysis-card {
    padding: 15px !important;
  }
  
  /* Charts container */
  .chart-container {
    height: 250px !important;
  }
}

/* ============================= */
/* Mobile Utility Classes */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Hide on mobile */
  .hide-mobile {
    display: none !important;
  }
  
  /* Show only on mobile */
  .show-mobile {
    display: block !important;
  }
  
  /* Text utilities */
  .mobile-text-center {
    text-align: center !important;
  }
  
  .mobile-text-small {
    font-size: 14px !important;
  }
  
  /* Spacing utilities */
  .mobile-p-0 {
    padding: 0 !important;
  }
  
  .mobile-m-0 {
    margin: 0 !important;
  }
  
  /* Flex utilities */
  .mobile-flex-column {
    flex-direction: column !important;
  }
  
  .mobile-flex-wrap {
    flex-wrap: wrap !important;
  }
}

/* ============================= */
/* iOS Specific Fixes */
/* ============================= */

@supports (-webkit-touch-callout: none) {
  /* iOS Safari specific styles */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  textarea,
  select {
    -webkit-appearance: none !important;
    font-size: 16px !important; /* Prevent zoom on iOS */
  }
  
  /* Fix for iOS Safari bottom bar */
  .main-content {
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
  
  /* Fix for notch on newer iPhones */
  .dashboard-header,
  .main-header {
    padding-top: env(safe-area-inset-top) !important;
  }
  
  /* Smooth scrolling */
  * {
    -webkit-overflow-scrolling: touch !important;
  }
}

/* ============================= */
/* Android Specific Fixes */
/* ============================= */

@media screen and (-webkit-min-device-pixel-ratio: 0) {
  /* Android Chrome specific styles */
  select {
    background-position: right 10px center !important;
  }
}

/* ============================= */
/* Landscape Mode Adjustments */
/* ============================= */

@media only screen and (max-width: 768px) and (orientation: landscape) {
  /* Reduce header height in landscape */
  .dashboard-header,
  .main-header {
    height: 50px !important;
    padding: 5px 15px !important;
  }
  
  /* Adjust sidebar for landscape */
  .sidebar {
    width: 240px !important;
  }
  
  /* Reduce padding in landscape */
  .main-content {
    padding: 10px !important;
  }
  
  /* Stats in single row */
  .dashboard-stats,
  .time-tracking-stats {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* ============================= */
/* Print Styles for Mobile */
/* ============================= */

@media print {
  /* Hide mobile-only elements */
  .mobile-menu-toggle,
  .sidebar-overlay,
  .bottom-nav,
  .fab-button {
    display: none !important;
  }
  
  /* Show sidebar content inline */
  .sidebar {
    position: static !important;
    width: 100% !important;
    page-break-after: always !important;
  }
  
  /* Full width content */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* ============================= */
/* Kanban/Tasks Mobile Styles */
/* ============================= */

@media only screen and (max-width: 768px) {
  /* Kanban board container */
  .kanban-board {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    padding: 10px !important;
    overflow-x: visible !important;
  }
  
  /* Kanban columns - stack vertically on mobile */
  .kanban-column {
    min-width: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    flex: none !important;
  }
  
  /* Column header */
  .kanban-header {
    padding: 15px !important;
    font-size: 16px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: #f8f9fa !important;
    border-radius: 8px 8px 0 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  
  /* Column body */
  .kanban-body {
    padding: 10px !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  /* Task cards */
  .kanban-task,
  .task-card {
    padding: 15px !important;
    margin-bottom: 12px !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    position: relative !important;
  }
  
  /* Task card hover/active states for mobile */
  .kanban-task:active,
  .task-card:active {
    opacity: 0.8 !important;
    transform: scale(0.98) !important;
  }
  
  /* Task priority and labels */
  .task-priority,
  .task-labels {
    margin-top: 10px !important;
    display: flex !important;
    gap: 5px !important;
    flex-wrap: wrap !important;
  }
  
  /* Task meta information */
  .task-meta {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 10px !important;
    font-size: 12px !important;
  }
  
  /* Board sections/tabs */
  .board-sections {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 -10px 15px -10px !important;
    padding: 0 10px !important;
    white-space: nowrap !important;
    scrollbar-width: none !important;
  }
  
  .board-sections::-webkit-scrollbar {
    display: none !important;
  }
  
  /* Section buttons */
  .section-btn {
    flex: 0 0 auto !important;
    padding: 10px 16px !important;
    margin-right: 8px !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
    min-height: 40px !important;
    touch-action: manipulation !important;
  }
  
  /* Active section */
  .section-btn.active {
    background: var(--accent-primary, #007bff) !important;
    color: white !important;
  }
  
  /* Add task button */
  .add-task-btn,
  .kanban-add-task {
    width: 100% !important;
    padding: 15px !important;
    margin-top: 10px !important;
    font-size: 14px !important;
    touch-action: manipulation !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
  }
  
  /* Filter and search section */
  .kanban-filters,
  .task-filters {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 15px !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    margin-bottom: 15px !important;
  }
  
  .filter-item {
    width: 100% !important;
  }
  
  .filter-select,
  .search-input {
    width: 100% !important;
    padding: 12px !important;
    font-size: 16px !important;
    min-height: 44px !important;
  }
  
  /* Task modal adjustments */
  .task-modal,
  .kanban-modal {
    width: 95% !important;
    max-width: 100% !important;
    margin: 10px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }
  
  .modal-content {
    padding: 20px 15px !important;
  }
  
  /* Form adjustments in modals */
  .task-form .form-row {
    flex-direction: column !important;
    gap: 15px !important;
  }
  
  .task-form .form-group {
    width: 100% !important;
  }
  
  /* Drag handle for mobile */
  .task-drag-handle {
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 4px !important;
    height: 30px !important;
    background: #e2e8f0 !important;
    border-radius: 2px !important;
    opacity: 0.6 !important;
  }
  
  /* Empty state */
  .kanban-empty,
  .tasks-empty-state {
    padding: 40px 20px !important;
    text-align: center !important;
    font-size: 14px !important;
  }
  
  /* Dropdown menus in tasks */
  .task-dropdown,
  .task-actions {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    border-radius: 12px 12px 0 0 !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1) !important;
    z-index: 1000 !important;
  }
  
  /* Task stats/counts */
  .column-count,
  .task-count {
    font-size: 12px !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
  }
  
  /* Collapsed column state */
  .kanban-column.collapsed {
    min-height: 60px !important;
  }
  
  .kanban-column.collapsed .kanban-body {
    display: none !important;
  }
  
  /* Touch-friendly spacing between elements */
  .kanban-column + .kanban-column {
    margin-top: 20px !important;
  }
  
  /* Project tabs specific to tasks section */
  #tasks-section .nav-tabs,
  #kanban-section .nav-tabs {
    margin-bottom: 15px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    position: relative !important;
  }
  
  /* Scroll indicator for tabs */
  #tasks-section .nav-tabs::after,
  #kanban-section .nav-tabs::after {
    content: '→' !important;
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #999 !important;
    font-size: 18px !important;
    pointer-events: none !important;
    opacity: 0.6 !important;
  }
}

/* Small mobile devices (max-width: 480px) */
@media only screen and (max-width: 480px) {
  /* Even more compact layout for small screens */
  .kanban-task,
  .task-card {
    padding: 12px !important;
    font-size: 13px !important;
  }
  
  .kanban-header {
    padding: 12px !important;
    font-size: 15px !important;
  }
  
  .task-modal {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  
  /* Full screen modal on very small devices */
  .modal-overlay {
    padding: 0 !important;
  }
  
  /* Reduce button sizes slightly */
  .section-btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
    min-height: 36px !important;
  }
}