/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:         #000;
    --surface:    #141414;
    --surface2:   #1f1f1f;
    --border:     rgba(255,255,255,0.08);
    --text:       #e8e8e8;
    --muted:      #777;
    --accent:     #e50914;
    --accent-dk:  #c0070f;
    --radius:     4px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: #000;
    border-bottom: 1px solid var(--border);
    height: 60px;
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left  { display: flex; align-items: center; gap: 2.5rem; }
.nav-right { display: flex; align-items: center; }

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--accent);
    white-space: nowrap;
}

.nav-links { display: flex; gap: 1.5rem; }

.nav-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }

.profile-icon {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    cursor: pointer;
}

/* ===== PAGE WRAP ===== */
.page-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===== SEARCH SECTION ===== */
.search-section {
    margin-top: 60px;
    background: #000;
    padding: 2rem 0 1.5rem;
}

.yts-search-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.yts-search-bar-wrap {
    display: flex;
    margin-bottom: 1.25rem;
}

.yts-search-bar {
    flex: 1;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.yts-search-bar:focus { border-color: rgba(255,255,255,0.2); }

.yts-search-btn {
    padding: 0.7rem 1.75rem;
    background: var(--accent);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.yts-search-btn:hover { background: var(--accent-dk); }

/* ===== FILTERS ===== */
.yts-filters-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.yts-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.yts-filter-group label {
    font-size: 0.75rem;
    color: var(--muted);
}

.yts-select {
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    min-width: 110px;
    transition: border-color 0.2s;
    appearance: auto;
}

.yts-select:hover, .yts-select:focus { border-color: rgba(255,255,255,0.2); }

.yts-year-input { min-width: 80px; }
.yts-year-input::-webkit-inner-spin-button,
.yts-year-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ===== LOADING ===== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5rem 0;
}

.loading-spinner {
    width: 48px; height: 48px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 1rem; color: var(--muted); font-size: 0.9rem; }

/* ===== BROWSE SECTION ===== */
.browse-section { padding: 1.5rem 0 4rem; }

/* ===== PAGINATION ===== */
.yts-pagination {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 1rem 0 1.25rem;
}

.pg-btn {
    min-width: 36px; height: 36px;
    padding: 0 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}

.pg-btn:hover { background: var(--surface2); border-color: rgba(255,255,255,0.15); }
.pg-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ===== MOVIE GRID ===== */
.yts-movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.5rem 1rem;
}

/* ===== MOVIE CARDS ===== */
.yts-card { cursor: pointer; }

.yts-poster-wrap {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 2/3;
    background: var(--surface);
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.22s;
}

.yts-card:hover .yts-poster-wrap {
    border-color: rgba(255,255,255,0.22);
    transform: translateY(-4px);
}

.yts-poster {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.yts-quality-badge {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.82) 0%, transparent 100%);
    padding: 1.5rem 0.5rem 0.45rem;
    display: flex;
    align-items: flex-end;
}

.yts-quality-tag {
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 2px;
    letter-spacing: 0.4px;
}

.yts-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.76);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    opacity: 0;
    transition: opacity 0.2s;
}

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

.yts-overlay-btn {
    background: none;
    border: 1.5px solid #fff;
    color: #fff;
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.yts-overlay-btn:hover { background: rgba(255,255,255,0.15); }

.yts-fav-overlay-btn {
    background: none;
    border: 1.5px solid rgba(255,255,255,0.4);
    color: #fff;
    padding: 0.35rem 1rem;
    border-radius: var(--radius);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s;
}

.yts-fav-overlay-btn:hover { background: rgba(255,255,255,0.1); }

.yts-info { padding: 0.5rem 0.1rem 0.15rem; }

.yts-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.yts-year { font-size: 0.78rem; color: var(--muted); }

/* ===== NO RESULTS ===== */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5rem 0;
    text-align: center;
    gap: 0.75rem;
}

.no-results h3 { font-size: 1.4rem; }
.no-results p  { color: var(--muted); }

/* ===== FOOTER ===== */
.footer { background: #000; padding: 2rem 0; }

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--text); }

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .yts-movie-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .yts-filters-row { gap: 1rem; }
    .footer-content { flex-direction: column; gap: 0.75rem; text-align: center; }
}

@media (max-width: 480px) {
    .page-wrap { padding: 0 1rem; }
    .yts-movie-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .yts-movie-grid {
        gap: 1.5rem; 
    }

    .yts-movie-card {
        max-width: 280px; 
        margin: 0 auto;  
    }

    .yts-title {
        font-size: 1rem; 
        white-space: normal; 
    }
}