/* Mobile-Enhanced Styles for Movie Covers */

/* ===== MOBILE MENU ENHANCEMENTS ===== */

.mobile-menu-overlay {
    position: fixed;
    top: 100%;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    max-height: calc(100vh - 70px);
}

.mobile-menu-overlay:not(.hidden) {
    transform: translateY(-100%);
}

.mobile-menu-overlay.show {
    transform: translateY(-100%);
}

@media (max-width: 768px) {
    /* Mobile menu improvements */
    .mobile-menu-overlay {
        background: rgba(255, 255, 255, 0.95);
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-menu-overlay nav a {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        font-weight: 500;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        display: flex;
        align-items: center;
        gap: 0.75rem;
        transition: all 0.2s ease;
    }
    
    .mobile-menu-overlay nav a:hover,
    .mobile-menu-overlay nav a.active {
        background: rgba(59, 130, 246, 0.1);
        color: #3b82f6;
        transform: translateX(8px);
    }
    
    .mobile-menu-overlay nav a i {
        width: 20px;
        text-align: center;
        font-size: 1.1rem;
    }
    
    /* Mobile search in menu */
    .mobile-menu-overlay .pt-2 {
        padding: 1.5rem;
        background: rgba(0, 0, 0, 0.02);
        margin: 1rem 0;
    }
    
    .mobile-menu-overlay input {
        height: 48px;
        font-size: 16px; /* Prevents iOS zoom */
        padding: 0.75rem 1rem 0.75rem 3rem;
        border-radius: 12px;
        border: 2px solid #e5e7eb;
        transition: all 0.2s ease;
    }
    
    .mobile-menu-overlay input:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }
}

/* ===== TOUCH-FRIENDLY ENHANCEMENTS ===== */

@media (any-pointer: coarse) {
    /* Larger touch targets for all interactive elements */
    .movie-card,
    .btn,
    .nav-link,
    .dropdown-toggle,
    .search-btn {
        min-height: 48px;
        min-width: 48px;
    }
    
    /* Enhanced button states for touch */
    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .movie-card:active {
        transform: scale(0.99);
        transition: transform 0.1s ease;
    }
    
    /* Better spacing for form elements */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-group label {
        margin-bottom: 0.75rem;
        font-weight: 600;
        display: block;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 16px;
        border-radius: 8px;
        border: 2px solid #e5e7eb;
        transition: all 0.2s ease;
    }
    
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        outline: none;
    }
}

/* ===== IMPROVED MOVIE/TV DETAIL PAGES ===== */

@media (max-width: 768px) {
    /* Hero section optimizations */
    .tmdb-hero-container {
        background-attachment: scroll !important; /* Better performance on mobile */
        min-height: 60vh;
    }
    
    .tmdb-hero-content {
        padding: 2rem 0;
        text-align: center;
    }
    
    .tmdb-hero-poster {
        margin: 0 auto 2rem;
        max-width: 240px;
        border-radius: 16px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    }
    
    .tmdb-hero-main {
        text-align: left;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .tmdb-hero-title {
        font-size: 1.875rem;
        line-height: 1.2;
        margin-bottom: 1rem;
        font-weight: 700;
    }
    
    .tmdb-hero-meta {
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .tmdb-hero-meta span {
        background: rgba(255, 255, 255, 0.2);
        padding: 0.5rem 0.75rem;
        border-radius: 20px;
        font-size: 0.875rem;
        font-weight: 500;
    }
    
    /* Action buttons mobile layout */
    .tmdb-hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-top: 2rem;
    }
    
    .tmdb-action-btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        transition: all 0.2s ease;
    }
    
    .tmdb-action-btn:active {
        transform: scale(0.98);
    }
    
    /* Score chart mobile improvements */
    .tmdb-user-score {
        margin: 2rem auto;
    }
    
    .tmdb-score-chart {
        width: 80px;
        height: 80px;
    }
    
    .score-text {
        font-size: 1.25rem;
        font-weight: 700;
    }
    
    .user-score-text {
        font-size: 0.75rem;
        margin-top: 0.5rem;
        text-align: center;
    }
}

/* ===== ENHANCED GRID LAYOUTS ===== */

@media (max-width: 768px) {
    .tmdb-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 1rem;
        padding: 0 0.5rem;
    }
    
    .movie-card {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
    }
    
    .movie-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }
    
    .movie-poster {
        position: relative;
        overflow: hidden;
    }
    
    .movie-poster img {
        width: 100%;
        height: auto;
        aspect-ratio: 2/3;
        object-fit: cover;
        transition: transform 0.3s ease;
    }
    
    .movie-info {
        padding: 0.75rem;
        background: white;
    }
    
    .movie-title {
        font-size: 0.875rem;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 0.25rem;
        color: #1f2937;
    }
    
    .movie-date {
        font-size: 0.75rem;
        color: #6b7280;
    }
    
    .movie-rating {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 0.25rem 0.5rem;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 600;
    }
}

@media (max-width: 480px) {
    .tmdb-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
    }
    
    .movie-card {
        border-radius: 10px;
    }
    
    .movie-info {
        padding: 0.5rem;
    }
    
    .movie-title {
        font-size: 0.8rem;
    }
    
    .movie-date {
        font-size: 0.7rem;
    }
}

/* ===== ENHANCED FORMS ===== */

@media (max-width: 768px) {
    .hero-search-form {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 16px;
        margin: 0 1rem;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    }
    
    .hero-search-input {
        width: 100%;
        height: 52px;
        padding: 0 1.25rem;
        font-size: 16px;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        transition: all 0.2s ease;
    }
    
    .hero-search-input:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        outline: none;
    }
    
    .hero-search-button {
        width: 100%;
        height: 52px;
        background: linear-gradient(135deg, #3b82f6, #1d4ed8);
        color: white;
        border: none;
        border-radius: 12px;
        font-size: 1rem;
        font-weight: 600;
        transition: all 0.2s ease;
    }
    
    .hero-search-button:active {
        transform: scale(0.98);
    }
}

/* ===== LOADING STATES ===== */

.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

.movie-card.loading .movie-poster {
    height: 180px;
    background: #f0f0f0;
}

.movie-card.loading .movie-info {
    padding: 0.75rem;
}

.movie-card.loading .movie-title,
.movie-card.loading .movie-date {
    height: 1rem;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .movie-card {
        will-change: transform;
    }
    
    .movie-poster img {
        will-change: transform;
    }
    
    /* Optimize images */
    img {
        image-rendering: optimizeQuality;
        image-rendering: -webkit-optimize-contrast;
    }
    
    /* Reduce motion for users who prefer it */
    @media (prefers-reduced-motion: reduce) {
        .movie-card,
        .btn,
        .tmdb-action-btn {
            transition: none !important;
            animation: none !important;
        }
        
        .movie-card:hover {
            transform: none !important;
        }
    }
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .mobile-menu-overlay {
        background: rgba(17, 24, 39, 0.95);
        color: white;
    }
    
    .mobile-menu-overlay nav a {
        color: #e5e7eb;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-menu-overlay nav a:hover,
    .mobile-menu-overlay nav a.active {
        background: rgba(59, 130, 246, 0.2);
        color: #60a5fa;
    }
    
    .hero-search-form {
        background: rgba(17, 24, 39, 0.95);
    }
    
    .hero-search-input {
        background: rgba(31, 41, 55, 0.8);
        border-color: rgba(75, 85, 99, 0.6);
        color: white;
    }
    
    .hero-search-input::placeholder {
        color: rgba(156, 163, 175, 0.8);
    }
    
    .movie-card {
        background: rgba(31, 41, 55, 0.8);
    }
    
    .movie-info {
        background: rgba(31, 41, 55, 0.9);
    }
    
    .movie-title {
        color: #f9fafb;
    }
    
    .movie-date {
        color: #d1d5db;
    }
}