@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #bc13fe;
    --primary-glow: rgba(188, 19, 254, 0.5);
    --accent: #fbbf24;
    --bg: #03000a;
    --surface: #0f0a1d;
    --surface-light: rgba(255, 255, 255, 0.05);
    --text: #ffffff;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --radius-lg: 20px;
    --radius-md: 12px;
    --transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 40px;
}

/* --- Navigation --- */
.navbar {
    height: 80px;
    position: fixed;
    top: 0; width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    background: rgba(5, 1, 13, 0.85); /* Dark background matching the theme */
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    white-space: nowrap;
    color: white;
}

.logo span {
    color: var(--primary);
}

.nav-menu {
    display: flex;
    gap: 25px;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

.search-container {
    position: relative;
    flex: 0 1 350px;
    margin: 0 20px;
}

.search-container i {
    position: absolute;
    left: 15px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    z-index: 2;
}

.search-input {
    width: 100%;
    padding: 10px 15px 10px 45px;
    background: rgba(255, 255, 255, 0.05); /* Transparent dark background */
    border: 1px solid var(--border);
    border-radius: 10px;
    color: white;
    outline: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.search-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(188, 19, 254, 0.2);
}

.user-auth-area {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 150px;
}

/* Fallback Login Button Style */
.btn-tg-login {
    background: #0088cc;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 5px 15px rgba(0, 136, 204, 0.3);
    transition: var(--transition);
}

.btn-tg-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 136, 204, 0.5);
}

/* --- Profile Dropdown --- */
.profile-dropdown {
    position: relative;
    cursor: pointer;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 15px;
    border-radius: 50px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.user-photo-container {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grad);
    color: white;
    font-weight: 800;
    font-size: 0.9rem;
    border: 1.5px solid var(--primary);
    overflow: hidden;
}

.user-photo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* User Sections */
.user-section {
    padding: 40px 0;
    display: none;
}

.user-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.section-head-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.btn-back {
    background: var(--surface-light);
    color: white;
    padding: 8px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    cursor: pointer;
}

.genre-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.genre-tag {
    background: var(--surface-light);
    border: 1px solid var(--border);
    padding: 12px 30px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.genre-tag:hover, .genre-tag.active {
    border-color: var(--primary);
    background: rgba(188, 19, 254, 0.1);
    box-shadow: 0 0 15px rgba(188, 19, 254, 0.2);
}

.profile-trigger span {
    font-size: 0.9rem;
    font-weight: 600;
}

.profile-trigger i {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 220px;
    background: #0a0118;
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    padding: 10px;
    display: none;
    flex-direction: column;
    z-index: 1100;
    animation: dropdownSlide 0.3s ease;
}

.dropdown-menu.show {
    display: flex;
}

@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
    padding: 10px 15px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 10px;
    transition: 0.2s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: rgba(188, 19, 254, 0.15);
    color: var(--primary);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

.logout-link:hover i {
    color: #ef4444 !important;
}

/* Custom Telegram Login Button */
.btn-tg-custom {
    background: #0088cc;
    color: white;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.4);
    transition: var(--transition);
}

.btn-tg-custom:hover {
    background: #0099ee;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.6);
}

.btn-tg-custom i {
    font-size: 1.2rem;
}

/* --- Section Headings & Filters --- */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 60px 0 30px;
}

.filters {
    display: flex;
    gap: 12px;
}

.cat-btn {
    padding: 10px 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-light);
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.cat-btn:hover {
    color: var(--text);
    border-color: var(--primary);
    background: rgba(188, 19, 254, 0.1);
}

.cat-btn.active {
    background: var(--grad);
    color: white;
    border: none;
    box-shadow: var(--shadow-neon);
}

/* --- Hero Section --- */
.hero {
    height: 90vh; /* Restore proper height */
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    padding-top: 80px;
    margin-bottom: 0; /* Remove negative or extra margins */
}

/* Ensure catalog section-head is visible */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 30px; /* Standard professional margin */
}

.hero-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    z-index: 1;
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 70% 40%, transparent 0%, var(--bg) 85%),
                linear-gradient(0deg, var(--bg) 5%, transparent 50%);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 700px;
}

.hero-badge {
    background: var(--primary-glow);
    color: white;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero-title {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -2px;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 35px;
    line-height: 1.6;
}

.hero-btns {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 14px 35px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--grad);
    color: white;
    box-shadow: 0 10px 30px rgba(188, 19, 254, 0.3);
}

.btn-primary:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(188, 19, 254, 0.5);
}

.btn-blur {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
}

.btn-blur:hover { background: rgba(255, 255, 255, 0.15); }

/* --- Section Headings --- */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin: 80px 0 30px;
}

.section-head h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -1px;
}

/* --- Movie Grid & Cards --- */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
}

.movie-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border);
}

.movie-card:hover {
    transform: translateY(-12px) scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    z-index: 10;
}

.poster-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
}

.movie-card img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.6s ease;
}

.movie-card:hover img { transform: scale(1.1); }

.card-info {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(3, 0, 10, 1) 15%, rgba(3, 0, 10, 0.8) 40%, transparent 100%);
    opacity: 1;
    transform: translateY(0);
    transition: var(--transition);
}

.movie-card:hover .card-info {
    background: linear-gradient(to top, var(--primary-glow) 0%, rgba(3, 0, 10, 0.9) 50%, transparent 100%);
}

.card-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 5px;
    white-space: normal; /* Allow title to wrap for visibility */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Fallback background for cards without images */
.poster-wrapper {
    background: #0a041a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

/* --- Skeleton --- */
.skeleton-card {
    height: 350px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* --- Modal Upgrade --- */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(25px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show { display: flex; animation: fadeIn 0.4s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--surface);
    width: 95%;
    max-width: 1100px;
    border-radius: 30px;
    display: flex;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

.modal-left { width: 40%; }
.modal-left img { width: 100%; height: 100%; object-fit: cover; }

.modal-right { width: 60%; padding: 60px; }

.modal-title { font-size: 3rem; font-weight: 800; margin-bottom: 10px; }
.modal-meta { display: flex; gap: 20px; color: var(--text-dim); margin-bottom: 25px; }

.close-modal {
    position: absolute;
    top: 30px; right: 30px;
    font-size: 2rem; color: var(--text-dim);
    cursor: pointer; transition: var(--transition);
}

.close-modal:hover { color: white; transform: rotate(90deg); }

/* --- Mobile Responsive --- */
@media (max-width: 1024px) {
    .container { padding: 0 25px; }
    .hero-title { font-size: 3.5rem; }
    .modal-box { flex-direction: column; max-height: 90vh; overflow-y: auto; }
    .modal-left, .modal-right { width: 100%; }
    .modal-right { padding: 30px; }
}

@media (max-width: 768px) {
    .navbar .nav-menu, .navbar .search-container { display: none; }
    .hero-title { font-size: 2.8rem; }
    .movie-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; }
}
