/**
 * SEO Enhancements CSS
 * Styles specifically designed to improve SEO and user experience
 */

/* SEO Breadcrumbs */
.seo-breadcrumbs {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.seo-breadcrumbs .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.seo-breadcrumbs .breadcrumb-item {
    color: #999;
}

.seo-breadcrumbs .breadcrumb-item a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.seo-breadcrumbs .breadcrumb-item a:hover {
    color: var(--primary-color, #e50914);
    text-decoration: underline;
}

.seo-breadcrumbs .breadcrumb-item.active {
    color: var(--primary-color, #e50914);
    font-weight: 500;
}

.seo-breadcrumbs .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #666;
    margin: 0 0.5rem;
}

/* Skip to content link for accessibility and SEO */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color, #e50914);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 9999;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

.skip-to-content:focus {
    top: 6px;
}

/* Enhanced headings for SEO hierarchy */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: 0.5em;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    font-weight: 700;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 600;
}

h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 500;
}

/* Article and section structure for SEO */
article, section {
    margin-bottom: 2rem;
}

article header {
    margin-bottom: 1rem;
}

article .meta {
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 1rem;
}

/* Enhanced movie/TV card SEO elements */
.movie-card-enhanced {
    position: relative;
    background: var(--secondary-color, #221f1f);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.movie-card-enhanced:hover,
.movie-card-enhanced:focus {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(229, 9, 20, 0.3);
    border-color: var(--primary-color, #e50914);
}

.movie-card-enhanced .movie-card-image {
    position: relative;
    overflow: hidden;
}

.movie-card-enhanced .movie-card-poster {
    width: 100%;
    height: auto;
    aspect-ratio: 2/3;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.movie-card-enhanced:hover .movie-card-poster {
    transform: scale(1.05);
}

.movie-card-enhanced .movie-card-content {
    padding: 1rem;
}

.movie-card-enhanced .movie-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.movie-card-enhanced .movie-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #999;
}

.movie-card-enhanced .movie-card-rating {
    color: #ffd700;
    font-weight: 500;
}

/* SEO-friendly image loading */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

.lazy-image.error {
    opacity: 0.5;
    background: linear-gradient(45deg, #333, #555);
}

/* Schema.org microdata visual indicators (for development) */
[itemscope] {
    position: relative;
}

/* Enhanced search form for SEO */
.search-form {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid transparent;
    border-radius: 50px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #e50914);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.1);
    background: white;
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.8rem 1.5rem;
    background: var(--primary-color, #e50914);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: #b8070f;
    transform: translateY(-50%) scale(1.05);
}

/* Enhanced navigation for SEO and accessibility */
.navbar-custom {
    background: rgba(34, 31, 31, 0.95) !important;
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--primary-color, #e50914);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color, #e50914) !important;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color, #e50914);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Footer SEO enhancements */
.footer {
    background: #1a1a1a;
    border-top: 3px solid var(--primary-color, #e50914);
    margin-top: 4rem;
    padding: 3rem 0 2rem;
}

.footer h5 {
    color: var(--primary-color, #e50914);
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: var(--primary-color, #e50914);
}

/* Mobile navigation enhancements */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(34, 31, 31, 0.95);
    backdrop-filter: blur(10px);
    border-top: 2px solid var(--primary-color, #e50914);
    z-index: 1000;
    padding: 0.5rem 0;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: #999;
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    min-width: 60px;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: var(--primary-color, #e50914);
    transform: translateY(-2px);
}

.mobile-nav-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.mobile-nav-label {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Performance optimizations */
.movie-card-enhanced,
.search-input,
.nav-link {
    will-change: transform;
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus indicators for keyboard navigation */
*:focus {
    outline: 2px solid var(--primary-color, #e50914);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--primary-color, #e50914);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .movie-card-enhanced {
        border: 2px solid #fff;
    }
    
    .search-input {
        border: 2px solid #fff;
    }
    
    .nav-link {
        text-shadow: 1px 1px 1px #000;
    }
}

/* Print styles for SEO content */
@media print {
    .navbar-custom,
    .mobile-bottom-nav,
    .search-form {
        display: none !important;
    }
    
    .movie-card-enhanced {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .seo-breadcrumbs {
        font-size: 12px;
        margin-bottom: 1rem;
    }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
    .search-input {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .search-input::placeholder {
        color: rgba(255, 255, 255, 0.6);
    }
}

/* Critical CSS for above-the-fold content */
.hero-section {
    background: linear-gradient(135deg, rgba(229, 9, 20, 0.9), rgba(20, 20, 20, 0.95)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><polygon fill="%23221f1f" points="0,1000 1000,0 1000,1000"/></svg>');
    background-size: cover;
    background-position: center;
    padding: 6rem 0;
    text-align: center;
    min-height: 70vh;
    display: flex;
    align-items: center;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    line-height: 1.1;
}

.hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2.5rem;
    line-height: 1.4;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Section titles */
.section-title {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 600;
    margin-bottom: 2rem;
    color: #fff;
    position: relative;
}

.section-title small {
    display: block;
    font-size: 0.7em;
    font-weight: 400;
    color: #999;
    margin-top: 0.5rem;
    line-height: 1.3;
}

/* Responsive grid improvements */
@media (max-width: 576px) {
    .movie-card-enhanced .movie-card-content {
        padding: 0.75rem;
    }
    
    .movie-card-enhanced .movie-card-title {
        font-size: 1rem;
        -webkit-line-clamp: 1;
    }
    
    .seo-breadcrumbs {
        font-size: 0.8rem;
    }
    
    .hero-section {
        padding: 4rem 0;
        min-height: 60vh;
    }
}

@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-btn {
        position: static;
        transform: none;
        border-radius: 50px;
        width: 100%;
    }
    
    body {
        padding-bottom: 80px; /* Account for mobile nav */
    }
}

/* Loading states for better perceived performance */
.loading-placeholder {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* Enhanced hover states for better UX */
.movie-card-enhanced .movie-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.movie-card-enhanced:hover .movie-card-overlay {
    opacity: 1;
}

.quick-rating {
    display: flex;
    gap: 0.5rem;
}

.rating-btn {
    background: var(--primary-color, #e50914);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rating-btn:hover {
    transform: scale(1.1);
    background: #b8070f;
}

/* Watchlist button styles */
.watchlist-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.movie-card-enhanced:hover .watchlist-btn {
    opacity: 1;
}

.watchlist-btn:hover,
.watchlist-btn.active {
    background: var(--primary-color, #e50914);
    transform: scale(1.1);
}