:root {
    --bg: #0a0e17;
    --bg2: #131a2a;
    --black: #e0e0e0;
    --white: #fff;
    --orange: #ff8c42;
    --violet: #8b5cf6;
    --cyan: #06b6d4;
    --yellow: #fbbf24;
    --green: #10b981;
    --red: #ef4444;
    --border: 3px solid #e0e0e0;
    --shadow: 6px 6px 0px #e0e0e0;
    --shadow-sm: 3px 3px 0px #e0e0e0;
    --text-muted: #94a3b8;
    --radius: 20px;
    --radius-sm: 12px;
    --gap: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    background-image: radial-gradient(rgba(255,255,255,0.03) 2px, transparent 2px);
    background-size: 24px 24px;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--black);
    padding-bottom: 80px;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: var(--violet); border-radius: 4px; }

/* Animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes glow { 0%,100% { box-shadow: 0 0 5px rgba(139,92,246,0.3); } 50% { box-shadow: 0 0 20px rgba(139,92,246,0.6); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.page { display: none; animation: fadeUp 0.4s ease; }
.page.active { display: block; }

/* Header */
.main-header {
    background: var(--violet);
    border-bottom: var(--border);
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s;
}
.main-header.scrolled { background: rgba(139,92,246,0.95); backdrop-filter: blur(10px); }
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--orange); border: 3px solid #fff; }
.brand-text { font-size: 18px; font-weight: 800; color: #fff; text-transform: uppercase; letter-spacing: -0.5px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.user-badge { text-align: right; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-status { font-size: 10px; color: var(--green); display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.dot-live { width: 7px; height: 7px; background: var(--green); border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--orange); display: flex; align-items: center; justify-content: center; cursor: pointer; border: 3px solid #fff; transition: all 0.2s; }
.avatar:hover { transform: scale(1.05); }
.avatar i { color: #fff; font-size: 16px; }

/* Main */
.main-content { max-width: 900px; margin: 0 auto; padding: 24px 20px; }

/* Search */
.search-section { margin-bottom: 28px; }
.search-box { position: relative; margin-bottom: 16px; }
.search-box-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; }
.search-input {
    width: 100%; padding: 14px 20px 14px 48px;
    background: var(--bg2); border: var(--border);
    border-radius: 40px; color: var(--black); outline: none;
    font-size: 15px; transition: all 0.2s;
}
.search-input:focus { border-color: var(--violet); box-shadow: 0 0 20px rgba(139,92,246,0.2); }

/* Genres */
.genres-scroll { overflow-x: auto; white-space: nowrap; padding: 8px 0; }
.genres-scroll::-webkit-scrollbar { height: 0; }
.genres-inner { display: inline-flex; gap: 10px; }
.genre-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; background: var(--bg2); border: 2px solid var(--black);
    border-radius: 40px; color: var(--text-muted); font-size: 12px;
    font-weight: 600; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.genre-chip:hover { background: var(--orange); color: #fff; border-color: var(--orange); transform: translateY(-2px); }
.genre-chip.active { background: var(--orange); border-color: var(--orange); color: #fff; box-shadow: 0 4px 15px rgba(255,140,66,0.4); }

/* Search Results */
.search-results { margin-top: 24px; }
.search-results-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.search-results-top h3 { font-size: 16px; font-weight: 700; }
.search-results-top h3 i { color: var(--violet); }
.btn-clear { background: none; border: none; color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-clear:hover { color: var(--orange); }

/* Card */
.card { background: var(--bg2); border: var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card-header { margin-bottom: 20px; }
.card-header h2 { font-size: 18px; font-weight: 800; text-transform: uppercase; }
.card-header h2 i { color: var(--violet); }

/* Movie Grid */
.movie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--gap); }

.movie-card {
    position: relative; border-radius: var(--radius-sm); overflow: hidden;
    cursor: pointer; transition: all 0.3s; background: var(--bg2);
    border: var(--border); box-shadow: var(--shadow-sm);
    animation: fadeUp 0.4s ease both;
}
.movie-card:hover { transform: scale(1.04) translateY(-6px); z-index: 5; box-shadow: 0 16px 32px rgba(139,92,246,0.3); }
.movie-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; transition: transform 0.4s; }
.movie-card:hover .movie-poster { transform: scale(1.06); }
.movie-info {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 40px 10px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0.6), transparent);
    opacity: 0; transform: translateY(10px); transition: all 0.3s;
}
.movie-card:hover .movie-info { opacity: 1; transform: translateY(0); }
.movie-title-card { font-weight: 700; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movie-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; font-size: 11px; }
.movie-year { color: var(--cyan); font-weight: 600; }
.movie-rating { display: flex; align-items: center; gap: 3px; background: rgba(139,92,246,0.3); padding: 2px 8px; border-radius: 20px; color: #c7d2fe; font-size: 10px; }
.movie-rating i { color: var(--violet); font-size: 9px; }

/* Buttons */
.btn-primary {
    background: var(--orange); border: var(--border); padding: 12px 28px;
    border-radius: 40px; color: #fff; font-size: 14px; font-weight: 700;
    cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
    box-shadow: var(--shadow-sm); text-transform: uppercase; transition: all 0.15s;
}
.btn-primary:hover { transform: translate(2px, 2px); box-shadow: 1px 1px 0px #e0e0e0; }
.btn-outline {
    background: var(--bg2); border: var(--border); padding: 10px 22px;
    border-radius: 40px; color: var(--black); font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px; transition: all 0.15s;
}
.btn-outline:hover { background: var(--orange); color: #fff; border-color: var(--orange); }

/* Install Page */
.install-card { text-align: center; padding: 48px 24px; }
.install-icon { width: 80px; height: 80px; background: var(--orange); border: var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; box-shadow: var(--shadow-sm); }
.install-icon i { font-size: 36px; color: #fff; }
.install-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; text-transform: uppercase; }
.install-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.install-note { font-size: 11px !important; color: var(--text-muted); margin-top: 12px !important; }

/* Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg2); border-top: var(--border);
    display: flex; justify-content: space-around; padding: 8px 16px 18px; z-index: 50;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 18px; border-radius: 40px; cursor: pointer;
    transition: all 0.2s; color: var(--text-muted); font-weight: 600;
    background: none; border: none; font-family: inherit; font-size: inherit;
}
.nav-item i { font-size: 18px; }
.nav-item span { font-size: 9px; font-weight: 700; letter-spacing: 0.3px; }
.nav-item.active { color: #fff; background: var(--orange); border: 2px solid #fff; }

/* Toast */
.toast-notif {
    position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--bg2); border: var(--border); color: var(--black);
    padding: 10px 22px; border-radius: 40px; font-size: 13px; font-weight: 600;
    z-index: 2000; transition: transform 0.3s; opacity: 0;
}
.toast-notif.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Loading */
.loading-spinner {
    width: 40px; height: 40px; border: 4px solid var(--bg2);
    border-top-color: var(--violet); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 40px auto;
}

/* Hero (Detail) */
.hero-section {
    position: relative; min-height: 55vh; background-size: cover; background-position: center 20%;
    margin-bottom: 32px; border-radius: var(--radius); overflow: hidden; border: var(--border);
}
.hero-section::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(105deg, rgba(10,14,23,0.98) 0%, rgba(10,14,23,0.6) 50%, transparent 80%);
    z-index: 0;
}
.hero-overlay { position: relative; z-index: 1; padding: 60px 28px 40px; max-width: 550px; }
.hero-title { font-size: 36px; font-weight: 900; line-height: 1.1; margin-bottom: 12px; color: #fff; text-transform: uppercase; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.badge { background: var(--orange); border: 2px solid #fff; padding: 4px 12px; border-radius: 30px; font-size: 11px; font-weight: 700; color: #fff; }
.hero-desc { color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; font-size: 13px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.back-btn {
    position: fixed; top: 80px; left: 16px; z-index: 200;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg2); border: var(--border); color: var(--black);
    font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.back-btn:hover { background: var(--orange); color: #fff; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.96); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-container { max-width: 900px; width: 95%; background: var(--bg2); border-radius: var(--radius); overflow: hidden; border: var(--border); box-shadow: var(--shadow); }
.embed-iframe { width: 100%; height: 480px; border: none; }

/* Profile Modal */
.profile-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.96); z-index: 2000; display: none; align-items: center; justify-content: center; }
.profile-modal-content { background: var(--bg2); border: var(--border); box-shadow: var(--shadow); border-radius: var(--radius); padding: 28px; max-width: 380px; width: 90%; text-align: center; }
.avatar-preview { width: 90px; height: 90px; border-radius: 50%; margin: 0 auto 16px; background: var(--orange); display: flex; align-items: center; justify-content: center; overflow: hidden; border: 3px solid #fff; cursor: pointer; }
.avatar-preview i { color: #fff; font-size: 36px; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* Responsive */
@media (max-width: 768px) {
    .main-header { padding: 12px 16px; }
    .brand-logo { width: 34px; height: 34px; }
    .brand-text { font-size: 15px; }
    .avatar { width: 34px; height: 34px; }
    .user-badge { display: none; }
    .hero-title { font-size: 26px; }
    .hero-overlay { padding: 40px 16px 24px; }
    .movie-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
    .embed-iframe { height: 250px; }
}