@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Vazirmatn', sans-serif; 
    background: #141414; 
    color: #fff; 
    line-height: 1.7; 
    direction: rtl;
}

/* ================ عمومی ================ */
a { color: #e50914; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select {
    font-family: inherit;
    border: none;
    border-radius: 6px;
}
button { cursor: pointer; transition: 0.3s; }

/* ================ هدر اصلی ================ */
.header { 
    background: rgba(20,20,20,0.95); 
    padding: 1rem 2rem; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.nav { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    max-width: 1200px; 
    margin: 0 auto; 
}
.logo { 
    font-size: 1.6rem; 
    font-weight: 700; 
    color: #e50914; 
    display: flex; 
    align-items: center; 
    gap: 0.5rem;
}
.logo img { height: 35px; }
.nav-links { 
    display: flex; 
    list-style: none; 
    gap: 1.5rem; 
    align-items: center;
}
.nav-links a { 
    color: #fff; 
    transition: color 0.3s; 
    font-weight: 500;
}
.nav-links a:hover { 
    color: #e50914; 
}

/* ================ جستجو ================ */
.search-section { 
    padding: 2rem; 
    text-align: center; 
    background: #1a1a1a;
}
.search-section input { 
    width: 100%; 
    max-width: 500px; 
    padding: 1rem; 
    border-radius: 8px; 
    border: none; 
    background: #333; 
    color: #fff; 
    font-size: 1rem;
}
.search-section button { 
    padding: 1rem 2rem; 
    background: #e50914; 
    color: white; 
    border: none; 
    border-radius: 8px; 
    margin-right: 1rem; 
    cursor: pointer;
}
.search-section button:hover { 
    background: #b20710; 
}

/* ================ دسته‌بندی‌ها ================ */
.categories { 
    padding: 2rem; 
    max-width: 1200px; 
    margin: 0 auto; 
}
.cat-grid { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 1rem; 
    justify-content: center; 
    margin-top: 1rem;
}
.cat-btn { 
    background: #333; 
    padding: 0.8rem 1.5rem; 
    border-radius: 30px; 
    transition: all 0.3s; 
    font-weight: 500;
}
.cat-btn:hover, .cat-btn.active { 
    background: #e50914; 
    transform: scale(1.05); 
}

/* ================ فیلم‌ها و سریال‌ها ================ */
.movies { 
    padding: 2rem; 
    max-width: 1200px; 
    margin: 0 auto; 
}
.movies-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 2rem; 
    margin-top: 1rem;
}
.movie-card { 
    background: #222; 
    border-radius: 12px; 
    overflow: hidden; 
    transition: transform 0.3s; 
    position: relative; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.movie-card:hover { 
    transform: translateY(-8px); 
}
.movie-card img { 
    width: 100%; 
    height: 320px; 
    object-fit: cover; 
}
.movie-card h3 { 
    padding: 1rem; 
    font-size: 1.1rem; 
    font-weight: 600;
}
.category-tag { 
    position: absolute; 
    top: 10px; 
    right: 10px; 
    background: rgba(0,0,0,0.7); 
    color: #fff; 
    padding: 4px 10px; 
    border-radius: 20px; 
    font-size: 0.8rem; 
}
.series-tag { 
    position: absolute; 
    top: 40px; 
    right: 10px; 
    background: #4CAF50; 
    color: white; 
    padding: 4px 10px; 
    border-radius: 20px; 
    font-size: 0.8rem; 
}
.premium-lock { 
    position: absolute; 
    top: 10px; 
    left: 10px; 
    background: gold; 
    color: black; 
    padding: 4px 10px; 
    border-radius: 20px; 
    font-size: 0.8rem; 
    font-weight: bold;
}
.play-btn { 
    position: absolute; 
    bottom: 1rem; 
    right: 1rem; 
    background: #e50914; 
    color: white; 
    padding: 0.5rem 1rem; 
    border-radius: 6px; 
    font-weight: 600;
}
.play-btn:hover { 
    background: #b20710; 
}

/* ================ صفحه فیلم (movie.php) ================ */
.movie-detail { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 2rem; 
    padding: 2rem; 
    max-width: 1200px; 
    margin: 0 auto; 
}
.movie-poster img { 
    width: 100%; 
    max-width: 350px; 
    border-radius: 12px; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.movie-info { flex: 1; min-width: 300px; }
.movie-info h1 { font-size: 2rem; margin-bottom: 1rem; }
.category { color: #e50914; font-weight: 600; }
.description { margin: 1.5rem 0; line-height: 1.8; }
.watch-btn-container { margin-top: 2rem; }
.btn-primary.large { 
    padding: 1rem 2.5rem; 
    font-size: 1.2rem; 
    background: #e50914; 
    color: white; 
    border-radius: 8px;
}
.btn-primary.large:hover { background: #b20710; }
.btn-locked { 
    background: #666; 
    color: #ccc; 
    padding: 1rem 2.5rem; 
    font-size: 1.2rem; 
    cursor: not-allowed; 
    border-radius: 8px;
}
.episodes-list { margin-top: 1.5rem; }
.episode-card { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: #222; 
    padding: 1rem; 
    margin-bottom: 0.5rem; 
    border-radius: 8px; 
}
.btn-play { 
    background: #e50914; 
    color: white; 
    padding: 0.5rem 1rem; 
    border-radius: 6px; 
    font-size: 0.9rem;
}
.btn-play:hover { background: #b20710; }

/* ================ صفحه پخش (play.php) ================ */
.player-body { background: #000; overflow: hidden; }
.player-container { 
    position: relative; 
    width: 100vw; 
    height: 100vh; 
}
.video-wrapper { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100%; 
}
video { 
    max-width: 100%; 
    max-height: 100%; 
    background: #000; 
}
.back-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
}
.locked-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0,0,0,0.8);
    padding: 2rem;
    border-radius: 12px;
}

/* ================ فرم‌های ورود/ثبت‌نام ================ */
.auth-body {
    background: #0f0f0f; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh;
}
.auth-form {
    width: 100%; 
    max-width: 400px; 
    background: #1a1a1a; 
    padding: 2rem; 
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(229, 9, 20, 0.3); 
    text-align: center;
}
.auth-form input {
    width: 100%; 
    padding: 1rem; 
    margin: 0.8rem 0; 
    background: #2a2a2a; 
    color: #fff; 
    border-radius: 8px;
}
.auth-form button {
    width: 100%; 
    padding: 1rem; 
    background: #e50914; 
    color: white; 
    font-weight: 600; 
    margin-top: 1rem;
}
.auth-form button:hover { background: #b20710; }

/* ================ پنل ادمین ================ */
.admin-body { 
    background: linear-gradient(135deg, #1a1a1a, #0f0f0f); 
    min-height: 100vh; 
}
.admin-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 2rem; 
}
.admin-header {
    display: flex; justify-content: space-between; align-items: center;
    background: #1a1a1a; padding: 1rem 2rem; border-radius: 12px; margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.2);
}
.admin-header h1 { font-size: 1.8rem; color: #e50914; }
.admin-form, .search-form {
    background: #1a1a1a; padding: 1.5rem; border-radius: 12px; margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.form-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem;
}
.form-grid input,
.form-grid textarea,
.form-grid select { 
    width: 100%; padding: 0.8rem; background: #2a2a2a; color: #fff; 
}
.form-grid textarea { min-height: 100px; resize: vertical; }
.form-grid label { display: flex; align-items: center; gap: 0.5rem; color: #ccc; }
.btn-primary {
    background: #e50914; color: white; padding: 0.8rem 1.5rem; font-weight: 600;
}
.btn-primary:hover { background: #b20710; }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-small.premium { background: #ffd700; color: #000; }
.btn-small.free { background: #28a745; color: white; }
.btn-small.danger { background: #dc3545; }
.btn-small.danger:hover { background: #c82333; }
.table-wrapper { overflow-x: auto; }
.admin-table {
    width: 100%; border-collapse: collapse; background: #1a1a1a; border-radius: 12px; overflow: hidden;
}
.admin-table th, .admin-table td {
    padding: 1rem; text-align: right; border-bottom: 1px solid #333;
}
.admin-table th { background: #e50914; color: white; }
.admin-table tr:hover { background: #252525; }
.badge {
    padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.8rem; font-weight: 600;
}
.badge.premium { background: #ffd700; color: #000; }
.badge.free { background: #28a745; color: white; }
.alert {
    padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; text-align: center; font-weight: 500;
}
.alert.success { background: #d4edda; color: #155724; }
.alert.error { background: #f8d7da; color: #721c24; }

/* ================ ریسپانسیو ================ */
@media (max-width: 768px) {
    .nav-links { gap: 1rem; font-size: 0.9rem; }
    .search-section input { max-width: 100%; }
    .movies-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .movie-detail { flex-direction: column; }
    .admin-header { flex-direction: column; text-align: center; gap: 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .admin-table { font-size: 0.9rem; }
}