/* =========================================
   RESET & VARIABLES
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --accent: #e50914;
    --accent-hover: #ff0a16;
    --border: #2a2a2a;
    --success: #46d369;
    --warning: #f5c518;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 4px 20px rgba(0,0,0,0.5);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   HEADER & NAV
========================================= */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 20px;
}

.site-logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
}

.site-logo span {
    color: var(--accent);
}

.search-form {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-form input {
    width: 100%;
    padding: 10px 45px 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 14px;
}

.search-form input:focus {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.search-form button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-actions a {
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
}

.btn-login {
    border: 1px solid var(--border);
}

.btn-register {
    background: var(--accent);
    color: #fff;
}

.main-nav {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.main-nav ul {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
}

.main-nav ul li a {
    display: block;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
}

.main-nav ul li a:hover,
.main-nav ul li.current-menu-item a {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

/* =========================================
   SECTIONS & GRID
========================================= */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 30px 0 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 22px;
    background: var(--accent);
    border-radius: 2px;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.movie-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.movie-card-poster {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: var(--bg-hover);
}

.movie-card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.movie-card-quality {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

.movie-card-rating {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.8);
    color: var(--warning);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

.movie-card-info {
    padding: 12px;
}

.movie-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.movie-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* =========================================
   FOOTER
========================================= */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
}

.footer-col ul li a {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 768px) {
    .header-top {
        flex-wrap: wrap;
    }
    .search-form {
        order: 3;
        max-width: 100%;
        flex-basis: 100%;
    }
    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   SINGLE MOVIE PAGE
========================================= */
.movie-hero {
    position: relative;
    padding: 40px 0;
    background-size: cover;
    background-position: center;
    margin-bottom: 30px;
}

.movie-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(13,13,13,0.95) 0%, rgba(13,13,13,0.7) 50%, rgba(13,13,13,0.95) 100%);
    z-index: 1;
}

.movie-hero-content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

.movie-hero-poster {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.movie-hero-poster img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
}

.movie-hero-details h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
}

.movie-hero-tagline {
    font-size: 15px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 15px;
}

.movie-meta-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.movie-meta-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
}

.movie-meta-item.rating {
    color: var(--warning);
    border-color: var(--warning);
}

.movie-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.movie-genres a {
    background: var(--accent);
    color: #fff;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.movie-plot {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.sidebar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title::before {
    content: '';
    width: 3px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
}

.sidebar-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

.sidebar-list li:last-child {
    border-bottom: none;
}

.download-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
}

.download-table th {
    background: var(--bg-secondary);
    padding: 14px 18px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.download-table td {
    padding: 14px 18px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.btn-download {
    background: var(--accent);
    color: #fff;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.btn-download:hover {
    background: var(--accent-hover);
    color: #fff;
}

/* =========================================
   AJAX SEARCH
========================================= */
.ajax-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: var(--shadow);
    display: none;
}

.ajax-result-item {
    display: flex;
    gap: 12px;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.ajax-result-item:hover {
    background: var(--bg-hover);
}

.ajax-result-item img {
    width: 50px;
    height: 75px;
    object-fit: cover;
    border-radius: 4px;
}

.ajax-result-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.ajax-result-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.ajax-loading,
.ajax-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}