/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b6b;
}

.nav-brand i {
    font-size: 2rem;
}

.nav-search {
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-container {
    position: relative;
    display: flex;
}

#search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px 0 0 25px;
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#search-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ff6b6b;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#search-btn {
    padding: 0.75rem 1.25rem;
    background: #ff6b6b;
    border: none;
    border-radius: 0 25px 25px 0;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

#search-btn:hover {
    background: #ff5252;
}

.nav-menu {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.nav-btn:hover,
.nav-btn.active {
    background: #ff6b6b;
    border-color: #ff6b6b;
}

/* Main Content */
.main {
    margin-top: 100px;
    padding: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
    margin-bottom: 2rem;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
}

.hero-content p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 600px;
    margin: 0 auto;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

#section-title {
    font-size: 2rem;
    color: #ffffff;
}

.section-controls {
    display: flex;
    gap: 1rem;
}

.filter-select {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.filter-select option {
    background: #1a1a2e;
    color: #ffffff;
}

/* Movies Grid */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.movie-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.movie-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: #ff6b6b;
}

.movie-poster {
    position: relative;
    width: 100%;
    height: 350px;
    overflow: hidden;
}

.movie-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.movie-card:hover .movie-poster img {
    transform: scale(1.05);
}

.movie-rating {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.movie-rating i {
    color: #ffd700;
}

.movie-info {
    padding: 1.5rem;
}

.movie-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #ffffff;
    line-height: 1.4;
}

.movie-year {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.movie-overview {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.user-rating {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.star-rating {
    display: flex;
    gap: 0.25rem;
}

.star-rating i {
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s ease;
    font-size: 1.1rem;
}

.star-rating i.fas {
    color: #ffd700;
}

.star-rating i:hover,
.star-rating i.hover {
    color: #ffd700;
}

.rate-btn {
    padding: 0.5rem 1rem;
    background: #ff6b6b;
    border: none;
    color: #ffffff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.rate-btn:hover {
    background: #ff5252;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    overflow-y: auto;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    margin: 2rem auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    border-radius: 15px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 107, 107, 0.8);
}

.movie-detail {
    padding: 2rem;
}

.detail-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.detail-poster {
    flex-shrink: 0;
    width: 300px;
    height: 450px;
    border-radius: 10px;
    overflow: hidden;
}

.detail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info {
    flex: 1;
}

.detail-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.detail-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.rating-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
}

.detail-overview {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.9);
}

.detail-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #ff6b6b;
    color: #ffffff;
}

.btn-primary:hover {
    background: #ff5252;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.detail-cast {
    margin-top: 2rem;
}

.cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.cast-member {
    text-align: center;
}

.cast-member img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.5rem;
}

.cast-name {
    font-size: 0.9rem;
    color: #ffffff;
    font-weight: bold;
}

.cast-character {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Review Form */
.review-form {
    padding: 2rem;
}

.movie-info-mini {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.movie-info-mini img {
    width: 60px;
    height: 90px;
    border-radius: 5px;
    object-fit: cover;
}

.rating-section {
    margin-bottom: 2rem;
}

.rating-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

#review-text {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    outline: none;
    margin-bottom: 2rem;
}

#review-text:focus {
    border-color: #ff6b6b;
}

.review-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* User Reviews */
.user-reviews {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.review-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border-left: 4px solid #ff6b6b;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.review-rating {
    display: flex;
    gap: 0.25rem;
}

.review-date {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.review-text {
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

/* Loading and Empty States */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 4rem;
    color: rgba(255, 255, 255, 0.6);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #ff6b6b;
    color: #ffffff;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 3000;
}

.toast.show {
    transform: translateX(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-search {
        order: -1;
        width: 100%;
        margin: 0;
    }
    
    .main {
        margin-top: 140px;
        padding: 1rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .section-header {
        flex-direction: column;
        text-align: center;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .detail-header {
        flex-direction: column;
        text-align: center;
    }
    
    .detail-poster {
        width: 200px;
        height: 300px;
        margin: 0 auto;
    }
    
    .detail-title {
        font-size: 2rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem auto;
    }
    
    .detail-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .cast-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}

@media (max-width: 480px) {
    .movies-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .movie-poster {
        height: 250px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}

.movie-card:focus {
    outline: 2px solid #ff6b6b;
    outline-offset: 4px;
}