/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0f0f0f;
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Variables */
:root {
    --primary-color: #e50914;
    --primary-hover: #f40612;
    --secondary-color: #564d4d;
    --background-dark: #0f0f0f;
    --background-darker: #000000;
    --background-light: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border-color: #333333;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: var(--transition);
    padding: 1rem 0;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.95);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.nav-brand h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-container {
    position: relative;
}

.search-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 250px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.15);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.login-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mobile-menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-primary);
}

/* Hero Section */
.hero-section {
    position: relative;
    height: 80vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 500px;
    padding: 0 2rem;
    margin-left: 4rem;
}

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

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.5;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        transparent 100%
    );
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    margin-top: -100px;
    position: relative;
    z-index: 2;
}

.movie-section {
    margin-bottom: 3rem;
    padding: 0 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.movie-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.movie-row::-webkit-scrollbar {
    display: none;
}

.movie-card {
    flex-shrink: 0;
    width: 200px;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 8px;
    overflow: hidden;
    background: var(--background-light);
}

.movie-card:hover {
    transform: scale(1.05) translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.movie-poster {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

.movie-info {
    padding: 1rem;
}

.movie-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.movie-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.movie-rating {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.movie-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Search Results */
.search-results {
    margin-top: 2rem;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--background-dark);
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    display: flex;
    flex-direction: column;
}

.modal-image {
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-details {
    padding: 2rem;
}

.modal-details h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.modal-meta .rating {
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
}

.modal-meta .year,
.modal-meta .duration {
    color: var(--text-secondary);
}

.modal-description {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.modal-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.genre-tag {
    background: var(--background-light);
    color: var(--text-secondary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: var(--background-dark);
    z-index: 1500;
    transition: var(--transition);
    border-left: 1px solid var(--border-color);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-content {
    padding: 2rem;
    padding-top: 4rem;
}

.mobile-nav-link {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    transition: var(--transition);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--text-primary);
    border-bottom-color: var(--primary-color);
}

.mobile-login-btn {
    width: 100%;
    margin-top: 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu,
    .nav-actions {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .hero-content {
        margin-left: 2rem;
        max-width: calc(100% - 4rem);
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .movie-section {
        padding: 0 1rem;
    }

    .movie-card {
        width: 150px;
    }

    .movie-poster {
        height: 225px;
    }

    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .modal-container {
        width: 95%;
        margin: 1rem;
    }

    .modal-content {
        flex-direction: column;
    }

    .modal-image {
        height: 250px;
    }

    .modal-details {
        padding: 1.5rem;
    }

    .modal-details h2 {
        font-size: 1.5rem;
    }

    .modal-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 1rem;
    }

    .hero-content {
        margin-left: 1rem;
        max-width: calc(100% - 2rem);
    }

    .hero-title {
        font-size: 2rem;
    }

    .movie-card {
        width: 120px;
    }

    .movie-poster {
        height: 180px;
    }

    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-light);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Focus States for Accessibility */
.btn:focus,
.nav-link:focus,
.search-input:focus,
.movie-card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Hover Effects */
.movie-card:hover .movie-info {
    background: var(--background-darker);
}

.nav-link:hover::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}
