/* Mobile Loading States - Optimized for touch devices */

/* Mobile loading overlay */
@media (max-width: 768px) {
  .mobile-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
  }
  
  .mobile-loading-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    min-width: 280px;
    max-width: 90vw;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
  
  .mobile-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f1f5f9;
    border-top: 4px solid #f97316;
    border-radius: 50%;
    animation: mobile-spin 1s linear infinite !important;
    margin: 0 auto 16px;
    display: block;
    transform-origin: center;
  }
  
  .mobile-loading-text {
    color: #374151;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
  }
  
  .mobile-loading-subtext {
    color: #6b7280;
    font-size: 14px;
    margin: 8px 0 0 0;
  }
  
  @keyframes mobile-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* Dashboard loading states */
  .dashboard-loading-mobile {
    padding: 40px 20px;
    text-align: center;
    background: white;
    border-radius: 12px;
    margin: 10px;
  }
  
  .dashboard-loading-mobile .loading-icon {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #f97316;
    border-radius: 50%;
    animation: mobile-spin 1s linear infinite !important;
    margin: 0 auto 16px;
    display: block;
    transform-origin: center;
  }
  
  .dashboard-loading-mobile .loading-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px 0;
  }
  
  .dashboard-loading-mobile .loading-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
  }
  
  /* Mini dashboard loading */
  .dashboard-mini-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: white;
    border-radius: 12px;
    margin: 10px;
  }
  
  .dashboard-mini-loading .mini-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #f97316;
    border-radius: 50%;
    animation: mobile-spin 1s linear infinite;
    margin-right: 12px;
  }
  
  .dashboard-mini-loading .mini-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
  }
  
  /* Analysis loading states */
  .analysis-loading-mobile {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    border: 2px solid #fb923c;
    border-radius: 12px;
    padding: 20px;
    margin: 10px 0;
    text-align: center;
  }
  
  .analysis-loading-mobile .analysis-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(249, 115, 22, 0.2);
    border-top: 3px solid #f97316;
    border-radius: 50%;
    animation: mobile-spin 1s linear infinite;
    margin: 0 auto 12px;
  }
  
  .analysis-loading-mobile .analysis-text {
    font-size: 14px;
    font-weight: 600;
    color: #ea580c;
    margin: 0 0 4px 0;
  }
  
  .analysis-loading-mobile .analysis-subtext {
    font-size: 12px;
    color: #9a3412;
    margin: 0;
  }
  
  /* Pulse loading animation for skeleton states */
  .mobile-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: mobile-pulse 1.5s infinite;
    border-radius: 8px;
  }
  
  @keyframes mobile-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
  
  .mobile-skeleton-card {
    height: 80px;
    margin-bottom: 12px;
  }
  
  .mobile-skeleton-text {
    height: 16px;
    margin-bottom: 8px;
  }
  
  .mobile-skeleton-text.short {
    width: 60%;
  }
  
  .mobile-skeleton-text.medium {
    width: 80%;
  }
  
  /* Error states mobile */
  .mobile-error-state {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    margin: 10px;
    text-align: center;
  }
  
  .mobile-error-icon {
    width: 40px;
    height: 40px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 18px;
  }
  
  .mobile-error-title {
    font-size: 16px;
    font-weight: 600;
    color: #dc2626;
    margin: 0 0 8px 0;
  }
  
  .mobile-error-message {
    font-size: 14px;
    color: #991b1b;
    margin: 0 0 16px 0;
    line-height: 1.4;
  }
  
  .mobile-retry-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
  }
  
  .mobile-retry-btn:active {
    background: #dc2626;
    transform: scale(0.98);
  }
}

/* Extra small mobile (phones in portrait) */
@media (max-width: 480px) {
  .mobile-loading-card {
    min-width: 260px;
    padding: 20px;
  }
  
  .mobile-loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }
  
  .mobile-loading-text {
    font-size: 15px;
  }
  
  .mobile-loading-subtext {
    font-size: 13px;
  }
  
  .dashboard-loading-mobile {
    padding: 30px 15px;
    margin: 8px;
  }
  
  .dashboard-loading-mobile .loading-icon {
    width: 32px;
    height: 32px;
    border-width: 2px;
  }
  
  .analysis-loading-mobile {
    padding: 16px;
    margin: 8px 0;
  }
  
  .analysis-loading-mobile .analysis-spinner {
    width: 28px;
    height: 28px;
    border-width: 2px;
  }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-loading-overlay {
    align-items: flex-start;
    padding-top: 10vh;
  }
  
  .mobile-loading-card {
    min-width: 320px;
  }
  
  .dashboard-loading-mobile {
    padding: 30px 20px;
  }
}

/* High DPI mobile displays */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
  .mobile-loading-spinner,
  .dashboard-loading-mobile .loading-icon,
  .analysis-loading-mobile .analysis-spinner {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
  }
}

/* Reduce motion preference */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .mobile-loading-spinner,
  .dashboard-loading-mobile .loading-icon,
  .analysis-loading-mobile .analysis-spinner,
  .mobile-skeleton {
    animation: none;
  }
  
  .mobile-loading-spinner,
  .dashboard-loading-mobile .loading-icon,
  .analysis-loading-mobile .analysis-spinner {
    border-top-color: transparent;
    opacity: 0.6;
  }
  
  .mobile-skeleton {
    background: #e2e8f0;
  }
}