/* Unified Mobile CSS - Mobile-first responsive design */

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

/* Mobile navigation */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  z-index: 1001;
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
}

.mobile-menu-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-nav-icon {
  display: flex;
  flex-direction: column;
  width: 24px;
  height: 18px;
  justify-content: space-between;
}

.mobile-nav-icon span {
  display: block;
  height: 2px;
  background: #374151;
  border-radius: 1px;
  transition: all 0.3s ease;
}

.mobile-nav-icon.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-nav-icon.active span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-icon.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1002;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-sidebar.active {
  opacity: 1;
  pointer-events: all;
}

.mobile-sidebar-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.mobile-sidebar-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: white;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.mobile-sidebar.active .mobile-sidebar-content {
  transform: translateX(0);
}

.mobile-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.mobile-sidebar-logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
}

.mobile-sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-sidebar-item {
  border-bottom: 1px solid #f3f4f6;
}

.mobile-sidebar-link {
  display: block;
  padding: 1rem;
  color: #374151;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.mobile-sidebar-link:hover,
.mobile-sidebar-link.active {
  background-color: #f3f4f6;
  color: #3b82f6;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }
  
  .main-content {
    margin-top: 60px;
  }
  
  .sidebar {
    display: none;
  }
  
  .content-area {
    margin-left: 0;
    padding: 1rem;
  }
  
  .container {
    padding: 0 0.5rem;
  }
  
  /* Hide desktop navigation */
  #app-navigation {
    display: none;
  }
  
  /* Mobile-friendly buttons */
  .btn {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  /* Mobile table styling */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  /* Mobile form improvements */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.75rem;
  }
  
  /* Mobile-friendly modals */
  .modal {
    padding: 1rem;
  }
  
  .modal-content {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
  }
  
  /* Touch-friendly interactions */
  .card {
    margin-bottom: 1rem;
    padding: 1rem;
  }
  
  /* Hide less important elements on mobile */
  .hide-on-mobile {
    display: none !important;
  }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }
  
  .content-area {
    margin-left: 200px;
  }
}

/* Desktop styles */
@media (min-width: 1025px) {
  .mobile-header,
  .mobile-sidebar {
    display: none;
  }
  
  .sidebar {
    display: block;
  }
}

/* Accessibility improvements */
.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;
}

/* Focus states for keyboard navigation */
.keyboard-navigation *:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .nav-link,
  .sidebar-link,
  .mobile-sidebar-link {
    border: 1px solid transparent;
  }
  
  .nav-link:focus,
  .sidebar-link:focus,
  .mobile-sidebar-link:focus {
    border-color: currentColor;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}