/* Custom CSS for enhanced mobile experience and performance */

/* Enhanced responsive typography */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .card-title {
        font-size: 1rem;
        line-height: 1.25;
    }
    
    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Loading states and animations */
.loading-shimmer {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Enhanced card hover effects */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Improved button states */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Enhanced focus states for accessibility */
.focus-enhanced:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Larger touch targets */
    .mobile-touch {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing for mobile */
    .mobile-padding {
        padding: 1rem;
    }
    
    /* Optimized grid for mobile */
    .mobile-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Mobile navigation improvements */
    .mobile-nav {
        padding: 0.5rem 1rem;
    }
    
    /* Improved search form for mobile */
    .mobile-search {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Image optimization */
.lazy-image {
    background-color: #f3f4f6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23d1d5db' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'%3E%3C/circle%3E%3Cpolyline points='21,15 16,10 5,21'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    background-image: none;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-break-before {
        break-before: page;
    }
    
    .print-break-after {
        break-after: page;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1f2937;
        --text-primary: #f9fafb;
        --border-primary: #374151;
    }
}

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

/* High contrast support */
@media (prefers-contrast: high) {
    .card-hover {
        border: 2px solid;
    }
    
    .btn-primary {
        border: 2px solid;
    }
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Text selection styling */
::selection {
    background: rgba(59, 130, 246, 0.2);
    color: inherit;
}

/* Skip to main content for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #3b82f6;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Enhanced table responsiveness */
@media (max-width: 640px) {
    .responsive-table {
        font-size: 0.875rem;
    }
    
    .responsive-table th,
    .responsive-table td {
        padding: 0.5rem 0.25rem;
    }
}

/* Enhanced form styling */
.form-input {
    transition: all 0.2s ease;
}

.form-input:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Loading skeleton components */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    margin-bottom: 0;
    width: 60%;
}

.skeleton-image {
    height: 12rem;
    width: 100%;
}

/* Enhanced accessibility indicators */
.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 visible polyfill */
.js-focus-visible .focus-enhanced:focus:not(.focus-visible) {
    box-shadow: none;
}

/* Performance optimization classes */
.will-change-transform {
    will-change: transform;
}

.contain-layout {
    contain: layout;
}

.contain-paint {
    contain: paint;
}