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

:root {
    --bg-primary: #0f1923;
    --bg-secondary: #1a2634;
    --bg-card: #1e2d3d;
    --bg-card-hover: #243447;
    --bg-overlay: rgba(15, 25, 35, 0.92);
    --bg-input: #162230;
    --text-primary: #e8edf2;
    --text-secondary: #8899a6;
    --text-muted: #5c6e7e;
    --accent: #1da1f2;
    --accent-hover: #1a91da;
    --accent-glow: rgba(29, 161, 242, 0.25);
    --accent-gradient: linear-gradient(135deg, #1da1f2, #6c63ff);
    --vip-gold: #f5c518;
    --border: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== HEADER ========== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 16px 16px 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

/* ========== SEARCH BAR ========== */
.search-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.search-btn:active {
    transform: scale(0.96);
    background: var(--accent-hover);
}

/* ========== NAV TABS ========== */
.nav-tabs {
    display: flex;
    gap: 8px;
}

.nav-tab {
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.nav-tab:not(.active):active {
    background: var(--bg-card);
}

/* ========== MOVIES GRID ========== */
.content-area {
    padding: 16px;
    padding-bottom: 80px;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

/* ========== MOVIE CARD ========== */
.movie-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    border: 1px solid var(--border);
}

.movie-card:active {
    transform: scale(0.97);
}

.movie-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.1);
}

.movie-poster {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
    background: var(--bg-secondary);
}

.movie-poster-skeleton {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: linear-gradient(110deg, var(--bg-secondary) 30%, var(--bg-card-hover) 50%, var(--bg-secondary) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.movie-info {
    padding: 10px 12px 12px;
}

.movie-title {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-eps-badge {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ========== DETAIL MODAL ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s;
    overflow-y: auto;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    min-height: 100vh;
    padding: 0;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-poster-container {
    position: relative;
    width: 100%;
}

.modal-poster {
    width: 100%;
    max-height: 55vh;
    object-fit: cover;
    display: block;
}

.modal-poster-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(transparent, var(--bg-primary));
    pointer-events: none;
}

.modal-back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
    z-index: 10;
}

.modal-back-btn:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.75);
}

.modal-body {
    padding: 0 20px 40px;
    margin-top: -30px;
    position: relative;
    z-index: 5;
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.modal-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.modal-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-description {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-height: 150px;
    overflow-y: auto;
}

.modal-description::-webkit-scrollbar {
    width: 3px;
}

.modal-description::-webkit-scrollbar-track {
    background: transparent;
}

.modal-description::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}

.watch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 20px var(--accent-glow);
    text-decoration: none;
    letter-spacing: 0.2px;
}

.watch-btn:active {
    transform: scale(0.97);
}

.watch-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ========== LOADING & EMPTY STATES ========== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 12px;
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.4;
}

.empty-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ========== LOAD MORE ========== */
.load-more-container {
    display: flex;
    justify-content: center;
    padding: 24px;
}

.load-more-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 10px 32px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:active {
    transform: scale(0.96);
    background: var(--bg-card-hover);
}

/* ========== SCROLL TO TOP ========== */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 1.2rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 50;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

/* No poster placeholder */
.no-poster {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    opacity: 0.3;
}

.modal-no-poster {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    opacity: 0.2;
}

/* Responsive */
@media (min-width: 400px) {
    .movies-grid {
        gap: 16px;
    }
    .movie-title {
        font-size: 0.85rem;
    }
}

@media (min-width: 600px) {
    .movies-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
