/* Responsive Design Enhancements for PetZone Pro */
/* Mobile-First Approach with Progressive Enhancement */

/* Base Mobile Styles (320px and up) */
@media screen and (min-width: 320px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Hero Section Mobile */
    #home h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    #home p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    /* Product Cards Mobile */
    #products .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Navigation Mobile Enhancements */
    .nav-mobile-optimized {
        padding: 0.5rem 1rem;
    }
    
    /* Form Mobile */
    #contact .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Button Sizing Mobile */
    .btn-mobile {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Small Tablets (480px and up) */
@media screen and (min-width: 480px) {
    #home h1 {
        font-size: 2.5rem;
    }
    
    /* Product Cards - 2 columns for small tablets */
    #products .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    /* Quality Section - 2 columns */
    #quality .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    /* Buttons can be inline again */
    .btn-mobile {
        width: auto;
        display: inline-block;
        margin-right: 0.5rem;
        margin-bottom: 0;
    }
}

/* Tablets (640px and up) */
@media screen and (min-width: 640px) {
    /* Hero Section Tablet */
    #home h1 {
        font-size: 3rem;
    }
    
    #home p {
        font-size: 1.125rem;
    }
    
    /* Contact Form - 2 columns */
    #contact .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    #contact .grid div:nth-last-child(2),
    #contact .grid div:last-child {
        grid-column: span 2;
    }
}

/* Large Tablets (768px and up) */
@media screen and (min-width: 768px) {
    /* Hide mobile menu button */
    #mobile-menu-button {
        display: none;
    }
    
    /* Show desktop navigation */
    .desktop-nav {
        display: block !important;
    }
    
    /* Hero Section Large Tablet */
    #home {
        padding-top: 6rem;
        padding-bottom: 6rem;
    }
    
    #home h1 {
        font-size: 3.5rem;
    }
    
    /* Product Cards - Back to 3 columns */
    #products .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    /* Quality Section - 4 columns */
    #quality .grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* About Section - 2 columns */
    #about .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 3rem;
        align-items: center;
    }
    
    /* Contact Section - 3 columns for contact info */
    #contact .grid:first-of-type {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
        margin-bottom: 3rem;
    }
}

/* Desktop (1024px and up) */
@media screen and (min-width: 1024px) {
    /* Hero Section Desktop */
    #home h1 {
        font-size: 4rem;
    }
    
    #home {
        padding-top: 8rem;
        padding-bottom: 8rem;
    }
    
    /* Larger spacing for sections */
    section {
        padding-top: 5rem;
        padding-bottom: 5rem;
    }
    
    /* Product hover effects work better on desktop */
    #products .group:hover {
        transform: translateY(-10px) scale(1.02);
    }
    
    /* Footer - 4 columns */
    footer .grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

/* Large Desktop (1280px and up) */
@media screen and (min-width: 1280px) {
    /* Hero Section Large Desktop */
    #home h1 {
        font-size: 4.5rem;
    }
    
    /* Max container width */
    .container-xl {
        max-width: 1280px;
        margin: 0 auto;
    }
}

/* Extra Large Desktop (1536px and up) */
@media screen and (min-width: 1536px) {
    #home h1 {
        font-size: 5rem;
    }
    
    .container-2xl {
        max-width: 1536px;
        margin: 0 auto;
    }
}

/* Orientation-specific styles */
@media screen and (orientation: landscape) and (max-height: 500px) {
    /* Reduce hero section height on landscape mobile */
    #home {
        min-height: 70vh;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    #home h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    #home p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .group:hover {
        transform: none !important;
    }
    
    /* Larger touch targets */
    button,
    .btn,
    a[role="button"] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Navigation links larger for touch */
    nav a {
        padding: 0.75rem 1rem;
    }
    
    /* Form inputs larger for touch */
    input,
    textarea,
    select {
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* High DPI/Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Crisp text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Sharper borders */
    .border-thin {
        border-width: 0.5px;
    }
}

/* Print styles for better printing */
@media print {
    /* Hide interactive elements */
    nav,
    button,
    .no-print {
        display: none !important;
    }
    
    /* Optimize spacing for print */
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: black !important;
        background: white !important;
    }
    
    section {
        page-break-inside: avoid;
        margin-bottom: 2rem;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
        color: black !important;
    }
    
    /* Show URLs for links */
    a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
    
    /* Ensure product cards stack properly */
    #products .grid {
        grid-template-columns: 1fr !important;
    }
}

/* Dark mode support (for future implementation) */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .auto-dark .bg-white {
        background-color: #374151 !important;
    }
    
    .auto-dark .text-gray-900 {
        color: #f9fafb !important;
    }
    
    .auto-dark .text-gray-600 {
        color: #d1d5db !important;
    }
    
    .auto-dark .border-gray-300 {
        border-color: #4b5563 !important;
    }
}

/* Reduced motion 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;
    }
    
    /* Remove parallax effects */
    .parallax {
        transform: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    body {
        background: white !important;
        color: black !important;
    }
    
    .btn-primary {
        background: black !important;
        color: white !important;
        border: 2px solid black !important;
    }
    
    .btn-secondary {
        background: white !important;
        color: black !important;
        border: 2px solid black !important;
    }
    
    a {
        color: blue !important;
        text-decoration: underline !important;
    }
    
    .shadow-lg,
    .shadow-xl,
    .shadow-2xl {
        box-shadow: 0 0 0 2px black !important;
    }
}

/* Internet Explorer fallbacks (if needed) */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* IE specific styles */
    .grid {
        display: flex;
        flex-wrap: wrap;
    }
    
    .grid > * {
        flex: 1 1 300px;
        margin: 0.5rem;
    }
}

/* Container queries (for modern browsers) */
@supports (container-type: inline-size) {
    .product-card {
        container-type: inline-size;
    }
    
    @container (max-width: 300px) {
        .product-card h3 {
            font-size: 1.2rem;
        }
        
        .product-card p {
            font-size: 0.9rem;
        }
    }
}

/* Focus indicators for keyboard navigation */
@media (prefers-reduced-motion: no-preference) {
    :focus-visible {
        outline: 2px solid #4ade80;
        outline-offset: 2px;
        box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.2);
    }
}

/* Safe area insets for devices with notches */
@supports (padding: max(0px)) {
    body {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    nav {
        padding-top: max(0px, env(safe-area-inset-top));
    }
}