/* Responsive Design for Movie Trailer Website */
/* Mobile-first approach with progressive enhancement */

/* Base styles are mobile-first in main.css */

/* Small devices (landscape phones, 576px and up) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 15px;
    }
    
    /* Header adjustments for very small screens */
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem 0;
    }
    
    .logo h1 a {
        font-size: 1.5rem;
    }
    
    .main-nav ul {
        gap: 1rem;
    }
    
    .main-nav .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .search-container {
        max-width: 100%;
        order: 3;
    }
    
    /* Hero section for mobile */
    .hero {
        padding: 2rem 0;
        margin-bottom: 2rem;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-description {
        font-size: 1.1rem;
        padding: 0 1rem;
    }
    
    /* Movies grid for mobile */
    .movies-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .movie-card {
        max-width: 350px;
        margin: 0 auto;
    }
    
    .movie-poster {
        height: 380px;
    }
    
    /* Genres grid for mobile */
    .genres-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .genre-card {
        padding: 1.5rem 1rem;
    }
    
    .genre-card h3 {
        font-size: 1.1rem;
    }
    
    /* Footer adjustments */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    /* Pagination for mobile */
    .pagination-list {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination-link,
    .pagination-current {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    /* Section titles */
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    /* Autocomplete for mobile */
    .autocomplete-results {
        left: -15px;
        right: -15px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Header for tablets */
    .header-content {
        flex-wrap: wrap;
        gap: 1.5rem;
    }
    
    .logo {
        flex: 1;
        min-width: 200px;
    }
    
    .main-nav {
        flex: 2;
        display: flex;
        justify-content: center;
    }
    
    .search-container {
        flex: 1;
        min-width: 280px;
    }
    
    /* Movies grid for tablets */
    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .movie-poster {
        height: 400px;
    }
    
    /* Genres for tablets */
    .genres-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Hero section */
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-description {
        font-size: 1.2rem;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        padding: 0 25px;
    }
    
    /* Header for smaller desktops */
    .header-content {
        gap: 1.5rem;
    }
    
    .search-container {
        max-width: 350px;
    }
    
    /* Movies grid for smaller desktops */
    .movies-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    .movie-poster {
        height: 420px;
    }
    
    /* Genres grid */
    .genres-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .movies-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .genres-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* XXL devices (larger desktops, 1400px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1320px;
        padding: 0 30px;
    }
    
    .movies-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-description {
        font-size: 1.4rem;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .hero {
        padding: 1.5rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .header-content {
        padding: 0.5rem 0;
    }
    
    .main-content {
        padding: 1rem 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo h1 a {
        text-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
    }
    
    .movie-card {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    }
    
    .search-input:focus {
        box-shadow: 0 0 10px rgba(255, 107, 53, 0.4);
    }
}

/* Print styles */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .header,
    .footer,
    .search-container,
    .ad-container,
    .play-overlay {
        display: none !important;
    }
    
    .movie-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
    }
    
    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    a::after {
        content: " (" attr(href) ")";
    }
}

/* Reduced motion preferences */
@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;
    }
    
    .hero::before {
        animation: none;
    }
    
    .loading {
        animation: none;
        border: 3px solid #ff6b35;
    }
}

/* Dark mode support (if system preference changes) */
@media (prefers-color-scheme: light) {
    /* Website is already dark-themed, but we can add light mode overrides here if needed */
    /* For now, maintaining dark theme regardless of system preference */
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .movie-card:hover {
        transform: none;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    }
    
    .play-overlay {
        opacity: 1;
        background: rgba(255, 107, 53, 0.8);
    }
    
    .genre-card:hover {
        transform: none;
    }
    
    .watch-btn:hover {
        transform: none;
    }
    
    /* Increase touch target sizes */
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
    }
    
    .search-btn {
        width: 44px;
        height: 44px;
    }
    
    .pagination-link,
    .pagination-current {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Keyboard navigation improvements */
@media (hover: hover) and (pointer: fine) {
    /* Enhanced hover effects for mouse users */
    .movie-card:hover .movie-poster {
        transform: scale(1.05);
    }
    
    .genre-card:hover {
        transform: translateY(-8px);
    }
}

/* Specific mobile adjustments for very small screens */
@media (max-width: 360px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    .movie-info {
        padding: 1rem;
    }
    
    .movie-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .watch-btn {
        text-align: center;
        justify-content: center;
    }
    
    .genres-grid {
        grid-template-columns: 1fr;
    }
    
    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Tablet landscape specific */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .header-content {
        padding: 0.75rem 0;
    }
    
    .hero {
        padding: 2.5rem 0;
    }
    
    .movies-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
    }
    
    .movie-poster {
        height: 360px;
    }
}

/* iPad Pro and large tablets */
@media (min-width: 1024px) and (max-width: 1199px) {
    .movies-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .container {
        max-width: 1140px;
    }
}

/* Accessibility improvements */
@media (prefers-contrast: high) {
    .movie-card {
        border: 2px solid #fff;
    }
    
    .search-input {
        border: 2px solid #fff;
    }
    
    .nav-link {
        border: 1px solid transparent;
    }
    
    .nav-link:focus {
        border-color: #fff;
    }
}

/* Loading state responsive adjustments */
.loading-container {
    padding: 2rem;
    text-align: center;
}

@media (max-width: 575.98px) {
    .loading-container {
        padding: 1rem;
    }
}

/* Error states responsive */
.error-message {
    padding: 2rem;
    text-align: center;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid #dc3545;
    border-radius: 8px;
    margin: 2rem 0;
    color: #dc3545;
}

@media (max-width: 575.98px) {
    .error-message {
        padding: 1rem;
        margin: 1rem 0;
        font-size: 0.9rem;
    }
}