* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #e50914;
    --secondary: #141414;
    --text: #ffffff;
    --text-secondary: #b3b3b3;
    --card-bg: #1f1f1f;
    --hover-bg: #2a2a2a;
    --shadow: rgba(0, 0, 0, 0.5);
    --backdrop: rgba(20, 20, 20, 0.95);
}

[data-theme="light"] {
    --primary: #e50914;
    --secondary: #f8f9fa;
    --text: #212529;
    --text-secondary: #6c757d;
    --card-bg: #ffffff;
    --hover-bg: #f8f9fa;
    --shadow: rgba(0, 0, 0, 0.1);
    --backdrop: rgba(255, 255, 255, 0.95);
}

body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--secondary) 0%, #0c0c0c 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

[data-theme="light"] body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Header */
header {
    background: var(--backdrop);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(45deg, var(--primary), #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 10px rgba(229, 9, 20, 0.5)); }
    to { filter: drop-shadow(0 0 20px rgba(229, 9, 20, 0.8)); }
}

/* Search Bar */
.search-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

#searchInput {
    padding: 0.8rem 1.5rem;
    border: 2px solid var(--hover-bg);
    border-radius: 50px;
    background: var(--card-bg);
    color: var(--text);
    width: 300px;
    transition: all 0.3s ease;
    font-size: 1rem;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(229, 9, 20, 0.3);
    transform: translateY(-2px);
}

.search-btn {
    position: absolute;
    right: 5px;
    padding: 0.6rem 1.2rem;
    background: var(--primary);
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.search-btn:hover {
    background: #ff0a16;
    transform: scale(1.05);
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Theme Controls */
.theme-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.theme-btn, .about-btn {
    padding: 0.8rem;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover, .about-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px var(--shadow);
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 25px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--text);
    transform: translateY(-2px);
}

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

/* Main Container */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, rgba(229, 9, 20, 0.1), rgba(0, 0, 0, 0.5));
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(229, 9, 20, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    position: relative;
    z-index: 1;
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
    position: relative;
    z-index: 1;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Movies Grid */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    animation: fadeIn 0.8s ease;
}

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

/* Movie Card */
.movie-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    animation: slideUp 0.6s ease backwards;
}

.movie-card:nth-child(n) {
    animation-delay: calc(0.1s * var(--i));
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.movie-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(229, 9, 20, 0.3);
}

.movie-poster {
    width: 100%;
    height: 375px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.movie-info {
    padding: 1.5rem;
}

.movie-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-year {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.movie-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.rating-star {
    color: gold;
}

.rating-value {
    font-weight: bold;
}

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

/* Movie Details Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: block;
}

.modal-content {
    max-width: 900px;
    margin: 2rem auto;
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    position: relative;
    height: 400px;
    overflow: hidden;
}

.modal-backdrop {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.modal-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.modal-overview {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 3px solid var(--card-bg);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Error Message */
.error-message {
    background: rgba(229, 9, 20, 0.1);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    margin: 2rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    #searchInput {
        width: 250px;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

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

    .modal-content {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }
}

/* About Modal Styles */
.about-modal {
    max-width: 700px !important;
    margin: 1rem auto !important;
}

.about-header {
    background: linear-gradient(135deg, var(--primary), #ff6b6b);
    color: white;
    padding: 2rem;
    position: relative;
}

.about-hero {
    text-align: center;
}

.profile-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.profile-info h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.profile-info .title {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.location {
    font-size: 1rem;
    opacity: 0.8;
}

.about-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.about-section {
    margin-bottom: 2rem;
}

.about-section h3 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.skill-tag {
    background: var(--primary);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.tech-stack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.tech-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem;
    background: var(--hover-bg);
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.tech-item:hover {
    transform: translateY(-2px);
}

.tech-icon {
    font-size: 1.5rem;
}

.contact-section {
    background: var(--hover-bg);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
}

.contact-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.contact-btn {
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-btn:hover {
    background: #ff0a16;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(229, 9, 20, 0.3);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--hover-bg);
    color: var(--text-secondary);
}