/* Mobile Responsive Styles for PEADS */
/* ===================================== */

/* Mobile Navigation */
@media (max-width: 768px) {
  /* Hide desktop navigation items */
  .desktop-only {
    display: none !important;
  }
  
  /* Mobile navigation styles */
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
    color: #6b7280;
    font-size: 11px;
    text-decoration: none;
    transition: color 0.2s;
  }
  
  .mobile-nav-item.active {
    color: #3b82f6;
  }
  
  .mobile-nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
  }
  
  /* Adjust main content for bottom nav */
  #app {
    padding-bottom: 70px !important;
  }
  
  /* Header adjustments */
  .top-header {
    padding: 10px 15px;
    flex-wrap: wrap;
  }
  
  .top-header img {
    height: 30px !important;
  }
  
  /* Card and grid adjustments */
  .grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  /* Button adjustments */
  .btn-group {
    flex-direction: column;
    gap: 10px;
  }
  
  .btn-group button {
    width: 100%;
  }
  
  /* Form adjustments */
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Modal adjustments */
  .modal-content {
    width: 95% !important;
    margin: 10px !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* Table responsive */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  /* Card spacing */
  .card {
    margin-bottom: 15px;
    padding: 15px !important;
  }
  
  /* Chart container adjustments */
  canvas {
    max-height: 200px !important;
  }
  
  .chart-container {
    position: relative;
    height: 180px !important;
    width: 100%;
  }
  
  /* Typography adjustments */
  h1 {
    font-size: 1.75rem !important;
  }
  
  h2 {
    font-size: 1.5rem !important;
  }
  
  h3 {
    font-size: 1.25rem !important;
  }
  
  /* Sidebar to bottom sheet */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    max-height: 70vh;
    border-radius: 20px 20px 0 0;
    padding-bottom: 20px;
  }
  
  /* Floating action button */
  .fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 999;
  }
  
  /* Touch-friendly sizing */
  button, a, .clickable {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Input fields */
  input, select, textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 12px !important;
  }
  
  /* Swipeable cards */
  .swipeable {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  
  .swipeable > * {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
  
  /* Loading states */
  .skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
  }
  
  @keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
  
  /* Pull to refresh indicator */
  .pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: top 0.3s;
    z-index: 1001;
  }
  
  .pull-to-refresh.active {
    top: 20px;
  }
  
  /* Toast notifications */
  .toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 1002;
    animation: slideUp 0.3s ease-out;
  }
  
  @keyframes slideUp {
    from {
      opacity: 0;
      transform: translateX(-50%) translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .mobile-nav {
    display: none;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-nav {
    padding: 5px 0;
  }
  
  .mobile-nav-item {
    font-size: 10px;
  }
  
  .mobile-nav-item i {
    font-size: 18px;
  }
  
  #app {
    padding-bottom: 60px !important;
  }
}

/* Touch interactions */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  button:hover, a:hover {
    opacity: 1 !important;
  }
  
  /* Add active states */
  button:active, a:active {
    opacity: 0.8;
    transform: scale(0.98);
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    background: #1f2937;
    color: #f3f4f6;
  }
  
  .dark-mode-auto .card {
    background: #374151;
    color: #f3f4f6;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari specific styles */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    -webkit-appearance: none;
    border-radius: 8px;
  }
  
  /* Safe area insets for iPhone X+ */
  .mobile-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Android specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  /* Android Chrome specific styles */
  select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2714%27%20height%3D%278%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%3Cpath%20d%3D%27M1%201l6%206%206-6%27%20stroke%3D%27%23000%27%20stroke-width%3D%272%27%20fill%3D%27none%27%20fill-rule%3D%27evenodd%27%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
  }
}