/**
 * Movie Database CSS - Clean and Modern
 * Following books.md design principles
 */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #000000;
    color: #ffffff;
    line-height: 1.6;
}

/* Header */
header {
    background: linear-gradient(135deg, #1a1a1a, #333);
    padding: 2rem 0;
    border-bottom: 3px solid #f26822;
}

header h1 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 1rem;
    color: #f26822;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

#searchInput {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border: 2px solid #333;
    border-radius: 8px;
    background: #1a1a1a;
    color: #fff;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: #f26822;
}

#searchInput::placeholder {
    color: #888;
}

/* Main layout */
main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Sidebar filters */
.filters {
    background: #111;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #333;
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.filters h3 {
    color: #f26822;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #ccc;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.95rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #f26822;
}

.year-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.year-inputs input {
    width: auto;
}

#clearFilters {
    width: 100%;
    padding: 0.75rem;
    background: #f26822;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#clearFilters:hover {
    background: #d4571a;
}

/* Content area */
.content {
    min-height: 100vh;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #111;
    border-radius: 8px;
    border: 1px solid #333;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-controls,
.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-controls button {
    padding: 0.5rem 1rem;
    border: 1px solid #333;
    background: #1a1a1a;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-controls button.active,
.view-controls button:hover {
    background: #f26822;
    border-color: #f26822;
}

.sort-controls select {
    padding: 0.5rem;
    border: 1px solid #333;
    background: #1a1a1a;
    color: #fff;
    border-radius: 6px;
}

#sortOrder {
    padding: 0.5rem;
    border: 1px solid #333;
    background: #1a1a1a;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    min-width: 40px;
}

#sortOrder:hover {
    background: #333;
}

.results-info {
    color: #ccc;
    font-weight: 500;
}

/* Movies grid */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.movies-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Movie cards */
.movie-card {
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(242, 104, 34, 0.3);
    border-color: #f26822;
}

.movie-poster {
    position: relative;
    overflow: hidden;
}

.movie-poster img {
    width: 100%;
    height: 450px;
    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);
    padding: 0.5rem;
    border-radius: 6px;
    backdrop-filter: blur(10px);
}

.my-rating {
    color: #f26822;
    font-size: 1.1rem;
    display: block;
}

.tmdb-rating {
    color: #ccc;
    font-size: 0.9rem;
}

.movie-info {
    padding: 1.5rem;
}

.movie-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #fff;
    line-height: 1.3;
}

.movie-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    color: #ccc;
    font-size: 0.9rem;
}

.movie-meta span {
    padding: 0.25rem 0.5rem;
    background: #1a1a1a;
    border-radius: 4px;
    border: 1px solid #333;
}

.movie-genres {
    margin-bottom: 1rem;
}

.genre-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #f26822;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.genre-tag:hover {
    background: #d4571a;
}

.movie-people {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #ccc;
}

.movie-people div {
    margin-bottom: 0.5rem;
}

.movie-people strong {
    color: #f26822;
}

.movie-overview {
    margin-bottom: 1rem;
}

.overview-text {
    color: #ddd;
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.movie-details {
    border-top: 1px solid #333;
    padding-top: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #ccc;
}

.movie-details.hidden {
    display: none;
}

.movie-details div {
    margin-bottom: 0.5rem;
}

.movie-details strong {
    color: #f26822;
}

.show-more-btn {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.show-more-btn:hover {
    background: #f26822;
    border-color: #f26822;
}

/* List view styles */
.movies-list .movie-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.movies-list .movie-poster img {
    height: 300px;
}

.movies-list .overview-text {
    -webkit-line-clamp: 2;
}

/* Loading and no results */
.loading,
.no-results {
    text-align: center;
    padding: 3rem;
    color: #ccc;
    font-size: 1.1rem;
}

.loading {
    background: #111;
    border-radius: 12px;
    border: 1px solid #333;
}

/* Responsive design */
@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .filters {
        position: static;
        order: 2;
    }
    
    .content {
        order: 1;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-controls,
    .sort-controls {
        justify-content: center;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .movies-list .movie-card {
        grid-template-columns: 1fr;
    }
    
    .movies-list .movie-poster img {
        height: 200px;
    }
    
    .movie-info {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .movies-grid {
        grid-template-columns: 1fr;
    }
    
    .movie-poster img {
        height: 300px;
    }
    
    .filters {
        padding: 1rem;
    }
    
    .filter-group {
        margin-bottom: 1rem;
    }
}

/* Checkbox styling */
input[type="checkbox"] {
    width: auto !important;
    margin-right: 0.5rem;
    accent-color: #f26822;
}

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

.movie-card {
    animation: fadeIn 0.3s ease-out;
}

/* Focus styles for accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #f26822;
    outline-offset: 2px;
}