:root {
    --bg-deep: #121212;
    --bg-card: #1e1e1e;
    --bg-card-hover: #262626;
    --accent-red: #E50914;
    --accent-blue: #4A90E2;
    --accent-amber: #F5C518;
    --status-watched: #4CAF50;
    --status-watching: #2196F3;
    --status-planned: #9E9E9E;
    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --text-muted: #757575;
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 10px 40px rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, .logo {
    font-family: 'Montserrat', sans-serif;
    letter-spacing: -0.5px;
}

/* Navbar */
nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--accent-red);
    padding: 0.75rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--accent-red);
    text-decoration: none;
    text-transform: uppercase;
}

.logo span {
    color: var(--text-primary);
}

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

.search-container {
    position: relative;
}

#searchBox {
    background: #2a2a2a;
    border: 1px solid transparent;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    color: #fff;
    width: 280px;
    transition: var(--transition);
    font-size: 0.9rem;
}

#searchBox:focus {
    outline: none;
    border-color: var(--accent-red);
    background: #333;
}

.btn-clear-search {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    display: none; /* Hidden by default, shown via JS */
}

.btn-clear-search:hover {
    color: var(--accent-red);
}

.btn-add {
    background: var(--accent-red);
    color: #fff;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.btn-add:hover {
    background: #ff0c1a;
    transform: scale(1.05);
}

/* Controls Section */
.controls {
    padding: 2rem 5% 0;
    max-width: 1600px;
    margin: 0 auto;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 2rem;
}

.btn-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.alph-btn, .genre-btn, .type-btn {
    background: transparent;
    border: 1px solid #333;
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 600;
}

.alph-btn:hover, .alph-btn.active,
.genre-btn:hover, .genre-btn.active,
.type-btn:hover, .type-btn.active {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
}

.btn-clear-filters {
    background: transparent;
    border: 1px dashed var(--text-muted);
    color: var(--text-muted);
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 1rem;
}

.btn-clear-filters:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Movie Grid */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2.5rem;
    padding: 2rem 5%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Movie Card */
.movie-card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow);
}

.movie-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.card-img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
}

.movie-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.movie-card:hover img {
    transform: scale(1.1);
    filter: brightness(0.7);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
}

.movie-card:hover .card-overlay {
    opacity: 1;
}

.rating-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: var(--accent-amber);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.9rem;
    border: 1px solid var(--accent-amber);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.status-watched { background: var(--status-watched); }
.status-watching { background: var(--status-watching); }
.status-planned { background: var(--status-planned); }

.movie-info {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.movie-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

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

.genre-pill {
    background: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 2rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Detail Page */
.detail-container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 5%;
}

.detail-hero {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
}

.detail-poster {
    width: 400px;
    flex-shrink: 0;
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
}

.detail-body {
    flex-grow: 1;
}

.detail-title {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.detail-badges {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.badge {
    padding: 4px 16px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.badge-type { background: var(--accent-blue); color: #fff; }

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.info-item label {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.info-item p {
    font-size: 1.2rem;
    font-weight: 600;
}

.detail-moral {
    font-size: 1.5rem;
    line-height: 1.5;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
    background: #1a1a1a;
    border-radius: 8px;
    border-left: 6px solid var(--accent-red);
}

/* Forms */
.form-container {
    max-width: 700px;
    margin: 4rem auto;
    background: var(--bg-card);
    padding: 3.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
}

.form-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2.5rem;
    text-align: center;
    color: var(--accent-red);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    background: #2a2a2a;
    border: 2px solid transparent;
    padding: 0.85rem 1rem;
    border-radius: 4px;
    color: #fff;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-red);
}

.btn-submit {
    width: 100%;
    background: var(--accent-red);
    color: #fff;
    border: none;
    padding: 1rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    margin-top: 1.5rem;
    transition: var(--transition);
}

.btn-submit:hover { background: #ff0c1a; }

@media (max-width: 900px) {
    .detail-hero { flex-direction: column; align-items: center; text-align: center; }
    .detail-poster { width: 100%; max-width: 350px; }
    .detail-title { font-size: 2.5rem; }
    .detail-badges { justify-content: center; }
    .detail-info-grid { grid-template-columns: 1fr; }
}
