/* Mobile Responsive Enhancements for NFT Marketplace */

/* Additional mobile-specific styles for better UX */

/* Mobile Navigation Improvements */
@media (max-width: 991.98px) {
  .navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
  }
  
  .navbar-collapse {
    background: rgba(26, 26, 36, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    margin-top: 1rem;
    padding: 1rem;
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.25rem;
  }
  
  .navbar-nav .nav-link:hover {
    background: rgba(247, 147, 26, 0.1);
  }
}

/* Mobile Dashboard Sidebar */
@media (max-width: 768px) {
  .dashboard-sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: #F7931A;
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  }
  
  .dashboard-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }
  
  .dashboard-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }
}

/* Mobile Analytics Modal Enhancements */
@media (max-width: 768px) {
  .analytics-charts-container {
    display: block !important;
  }
  
  .chart-container {
    margin-bottom: 1.5rem !important;
  }
  
  .chart-full-width {
    grid-column: span 1 !important;
  }
  
  /* Chart.js responsive adjustments */
  .chart-container canvas {
    width: 100% !important;
    height: auto !important;
    min-height: 200px;
  }
}

/* Mobile Form Improvements */
@media (max-width: 575.98px) {
  .form-group {
    margin-bottom: 1.5rem;
  }
  
  .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
  }
  
  .form-control {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 2px solid #333;
    background: #1a1a24;
    color: white;
    transition: border-color 0.3s ease;
  }
  
  .form-control:focus {
    border-color: #F7931A;
    box-shadow: 0 0 0 0.2rem rgba(247, 147, 26, 0.25);
  }
  
  .btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
  }
  
  .btn-primary {
    background: linear-gradient(135deg, #F7931A, #FF6B35);
    border: none;
  }
  
  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(247, 147, 26, 0.4);
  }
}

/* Mobile Grid Improvements */
@media (max-width: 480px) {
  .collections-grid,
  .nft-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
    padding: 1rem;
  }
  
  .collection-card,
  .nft-card {
    border-radius: 12px;
    overflow: hidden;
    background: #1a1a24;
    border: 1px solid #333;
    transition: all 0.3s ease;
  }
  
  .collection-card:hover,
  .nft-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-color: #F7931A;
  }
}

/* Mobile Search Improvements */
@media (max-width: 575.98px) {
  .search-form {
    position: relative;
    width: 100% !important;
    max-width: none !important;
  }
  
  .search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    background: rgba(26, 26, 36, 0.8);
    border: 2px solid #333;
    border-radius: 25px;
    color: white;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  .search-input:focus {
    border-color: #F7931A;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(247, 147, 26, 0.25);
  }
  
  .search-form button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: #F7931A;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Mobile Toast Notifications */
@media (max-width: 575.98px) {
  .toast {
    margin: 0.5rem;
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  }
  
  .toast-header {
    background: #1a1a24;
    color: white;
    border-bottom: 1px solid #333;
  }
  
  .toast-body {
    background: #1a1a24;
    color: white;
    padding: 1rem;
  }
  
  .toast.success {
    border-left: 4px solid #28a745;
  }
  
  .toast.error {
    border-left: 4px solid #dc3545;
  }
  
  .toast.warning {
    border-left: 4px solid #ffc107;
  }
  
  .toast.info {
    border-left: 4px solid #17a2b8;
  }
}

/* Mobile Loading States */
@media (max-width: 575.98px) {
  .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
  }
  
  .loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #333;
    border-top: 4px solid #F7931A;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  .loading-text {
    color: white;
    margin-top: 1rem;
    font-size: 1.1rem;
    text-align: center;
  }
}

/* Mobile Accessibility Improvements */
@media (max-width: 575.98px) {
  /* Focus indicators */
  button:focus,
  .btn:focus,
  .form-control:focus,
  a:focus {
    outline: 2px solid #F7931A;
    outline-offset: 2px;
  }
  
  /* Skip to content link */
  .skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #F7931A;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    transition: top 0.3s;
  }
  
  .skip-to-content:focus {
    top: 6px;
  }
  
  /* High contrast mode support */
  @media (prefers-contrast: high) {
    .card,
    .collection-card,
    .nft-card {
      border: 2px solid white;
    }
    
    .btn-primary {
      background: #F7931A;
      border: 2px solid white;
    }
  }
  
  /* 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;
    }
  }
}

/* Mobile Performance Optimizations */
@media (max-width: 575.98px) {
  /* Optimize images for mobile */
  img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
  }
  
  /* Lazy loading placeholder */
  .lazy-image {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
  }

  @keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  /* Lazy loading image states */
  .lazy-loading {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    opacity: 0.7;
  }

  .lazy-loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
  }

  .lazy-error {
    opacity: 0.5;
    filter: grayscale(100%);
  }

  @keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  /* NFT image containers */
  .nft-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #1a1a24;
  }

  .nft-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .nft-image-container:hover img {
    transform: scale(1.05);
  }

  /* Collection thumbnail optimization */
  .collection-thumbnail {
    aspect-ratio: 1;
    background: #1a1a24;
    border-radius: 8px;
    overflow: hidden;
  }

  .collection-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Avatar image optimization */
  .avatar-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #333;
  }

  /* Loading skeleton for images */
  .image-skeleton {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
  }
  
  /* Optimize fonts for mobile */
  body {
    font-display: swap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}