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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #5B7FDB 0%, #7B5FB8 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Brand Logo Styling */
.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.logo-image {
    width: 300px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tagline {
    font-size: 1.2em;
    opacity: 0.9;
}

.search-section {
    margin-bottom: 30px;
}

.search-bar {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

#movieSearch {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    outline: none;
}

#searchBtn {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    background-color: #00A8E8;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#searchBtn:hover {
    background-color: #0088C7;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

#searchBtn:active {
    transform: translateY(0);
}

.error-message {
    background-color: #E63946;
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Genre Sections Styles */
.genre-sections {
    margin: 40px 0;
}

/* Time Period Filter Styles */
.time-filter-container {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0 auto 30px;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 6px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.time-filter-btn {
    flex: 1;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.time-filter-btn:hover {
    color: #333;
}

.time-filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.time-filter-btn:active {
    transform: translateY(0);
}

@media (max-width: 600px) {
    .time-filter-container {
        max-width: 90%;
        flex-direction: row;
    }
    
    .time-filter-btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }
}

.section-header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 2.2em;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.section-subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.section-divider {
    text-align: center;
    margin: 50px 0 30px 0;
    color: white;
}

.section-divider h2 {
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
}

.section-divider h2:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
    z-index: -1;
}

.genre-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.genre-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.genre-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
}

.genre-header {
    display: flex;
    align-items: center;
    padding: 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.genre-header:hover {
    background-color: rgba(0, 168, 232, 0.1);
}

.genre-icon {
    display: none;
}

.genre-header h3 {
    flex-shrink: 0;
    margin: 0 0 4px 0;
    font-size: 1.4em;
    color: #2C3E50;
    font-weight: 600;
}

.genre-subtext {
    flex: 1;
    margin-left: 10px;
    font-size: 0.85em;
    color: #666;
    font-style: italic;
    line-height: 1.3;
}

.genre-toggle {
    font-size: 1.2em;
    color: #00A8E8;
    transition: transform 0.3s ease;
    font-weight: bold;
}

.genre-card.expanded .genre-toggle {
    transform: rotate(180deg);
}

.movie-grid {
    padding: 0 20px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.movie-grid.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
}

.loading-movies {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.movie-item {
    background: white;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.movie-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.movie-poster {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.movie-title {
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.movie-year {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 4px;
}

.movie-rating {
    font-size: 0.75em;
    color: #00A8E8;
    font-weight: 600;
}

.movie-item.selected {
    border: 2px solid #00A8E8;
    background: rgba(0, 168, 232, 0.1);
}

/* Responsive Design */
@media (max-width: 800px) {
    .genre-card {
        margin: 0 10px;
    }
    
    .genre-header {
        flex-wrap: wrap;
    }
    
    .genre-subtext {
        flex-basis: 100%;
        margin-left: 0;
        margin-top: 5px;
        font-size: 0.8em;
    }
    
    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .movie-poster {
        height: 140px;
    }
}

@media (max-width: 480px) {
    .section-header h2 {
        font-size: 1.8em;
    }
    
    .genre-header {
        padding: 15px;
        flex-direction: column;
        text-align: center;
    }
    
    .genre-header h3 {
        font-size: 1.2em;
        margin-bottom: 4px;
    }
    
    .genre-subtext {
        margin: 0;
        font-size: 0.75em;
    }
    
    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        padding: 0 15px 15px;
    }
}

/* Animation for expanding/collapsing */
.movie-grid {
    transition: max-height 0.4s ease, opacity 0.3s ease;
    overflow: hidden;
}

.movie-grid.hidden {
    max-height: 0;
    opacity: 0;
    padding: 0 20px;
}

.movie-grid:not(.hidden) {
    max-height: 500px;
    opacity: 1;
}

.loading {
    text-align: center;
    color: white;
    padding: 40px;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid white;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.hidden {
    display: none;
}

.results {
    animation: fadeIn 0.5s ease-in;
}

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

.movie-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.movie-header {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

#moviePoster {
    width: 200px;
    height: 300px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.movie-info {
    flex: 1;
}

.movie-info h2 {
    color: #333;
    font-size: 2em;
    margin-bottom: 10px;
}

.movie-meta {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.movie-plot {
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
}

.movie-details {
    color: #666;
    line-height: 1.8;
}

.ratings-section {
    border-top: 2px solid #f0f0f0;
    padding-top: 30px;
}

.ratings-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.rating-item {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.rating-label {
    width: 150px;
    font-weight: bold;
    color: #333;
}

.rating-logo {
    height: 30px;
    width: auto;
}

.rt-logo {
    font-size: 1.2em;
}

.rating-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.rating-bar {
    flex: 1;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
}

.rating-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 15px;
}

.imdb-fill {
    background: linear-gradient(90deg, #f5c518 0%, #e6b800 100%);
}

.rt-fill {
    background: linear-gradient(90deg, #fa320a 0%, #d42a08 100%);
}

.rating-score {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    min-width: 60px;
    text-align: right;
}

.weighted-average {
    margin-top: 40px;
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #5B7FDB 0%, #7B5FB8 100%);
    border-radius: 15px;
    color: white;
}

.weighted-average h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.score-number {
    font-size: 3em;
    font-weight: bold;
    background: linear-gradient(135deg, #5B7FDB 0%, #7B5FB8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-description {
    font-size: 0.95em;
    opacity: 0.9;
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    padding: 20px;
    opacity: 0.8;
}

footer a {
    color: white;
    text-decoration: underline;
}

.note {
    font-size: 0.85em;
    margin-top: 10px;
}

.last-updated {
    font-size: 0.8em;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .movie-header {
        flex-direction: column;
        align-items: center;
    }
    
    #moviePoster {
        width: 150px;
        height: 225px;
    }
    
    .movie-info h2 {
        font-size: 1.5em;
    }
    
    .rating-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .rating-label {
        width: 100%;
    }
    
    .rating-value {
        width: 100%;
    }
}
