:root {
    --primary: #FF3366;
    --secondary: #7C3AED;
    --bg-dark: #0f111a;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #ffffff;
    --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Outfit', sans-serif; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.mesh-background {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; overflow: hidden; background: #0b0c10;
}
.blob { position: absolute; filter: blur(90px); border-radius: 50%; opacity: 0.5; animation: float 20s infinite alternate ease-in-out; }
.blob-1 { width: 500px; height: 500px; background: rgba(255,51,102,0.3); top: -100px; left: -100px; }
.blob-2 { width: 600px; height: 600px; background: rgba(124,58,237,0.25); bottom: -200px; right: -100px; animation-delay: -5s; }
.blob-3 { width: 400px; height: 400px; background: rgba(56,189,248,0.2); top: 40%; left: 40%; animation-delay: -10s; }
@keyframes float { 0%{transform:translate(0,0) scale(1)} 100%{transform:translate(50px,50px) scale(1.1)} }

.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem; position: relative; z-index: 1; }

.view { display: none; opacity: 0; transform: translateY(15px); transition: all 0.4s cubic-bezier(0.4,0,0.2,1); }
.view.active { display: block; opacity: 1; transform: translateY(0); }

.glass-card {
    background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border); border-radius: 20px; padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

/* Auth */
.login-card { max-width: 480px; margin: 10vh auto; text-align: center; }
.login-card .logo { margin-bottom: 1.5rem; }
h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 0.5rem; background: linear-gradient(to right,#fff,#cbd5e1); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 2rem; font-weight: 300; }
.input-group { text-align: left; margin-bottom: 2rem; }
label { display: block; font-size: 0.9rem; font-weight: 500; color: #e2e8f0; margin-bottom: 0.5rem; }
textarea { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); border-radius: 12px; padding: 1rem; color: #fff; font-size: 0.95rem; font-family: monospace; resize: vertical; transition: all 0.3s ease; }
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(255,51,102,0.2); }
.error-msg { color: #ef4444; font-size: 0.9rem; margin-bottom: 1rem; display: none; }

.primary-btn {
    width: 100%; padding: 1rem; border-radius: 12px; border: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; font-size: 1.1rem; font-weight: 600; cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -10px var(--primary); }

.secondary-btn {
    padding: 0.5rem 1rem; border-radius: 8px; border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05); color: white; cursor: pointer; font-weight: 500; transition: all 0.2s ease;
}
.secondary-btn:hover { background: rgba(255,255,255,0.1); }

/* Dashboard Header */
/* Header Search */
.search-wrap { position: relative; flex: 1; max-width: 400px; margin: 0 1.5rem; }
#search-input { 
    width: 100%; background: rgba(0,0,0,0.25); border: 1px solid var(--glass-border); 
    border-radius: 12px; padding: 0.6rem 1rem 0.6rem 2.8rem; color: white; font-size: 0.95rem;
    transition: all 0.3s ease;
}
#search-input:focus { background: rgba(0,0,0,0.4); border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(255,51,102,0.2); }
.search-icon { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--text-muted); pointer-events: none; }

/* Continue Watching */
.continue-watching-section { margin-bottom: 2rem; }
.horizontal-grid { 
    display: flex; gap: 1.2rem; overflow-x: auto; padding-bottom: 1rem; scroll-behavior: smooth;
    scrollbar-width: none; -ms-overflow-style: none;
}
.horizontal-grid::-webkit-scrollbar { display: none; }
.horizontal-grid .drama-card { flex: 0 0 140px; min-width: 140px; }

/* Filter Bar */
.filter-bar { display: flex; gap: 0.8rem; overflow-x: auto; padding-bottom: 1.2rem; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip { 
    padding: 0.5rem 1.2rem; border-radius: 20px; border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05); color: white; cursor: pointer; white-space: nowrap;
    font-size: 0.9rem; font-weight: 500; transition: all 0.2s ease;
}
.filter-chip:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.filter-chip.active { background: var(--primary); border-color: transparent; box-shadow: 0 4px 12px rgba(255,51,102,0.3); }

/* Skeleton Loader */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1.2rem; }
.skeleton-card { border-radius: 14px; background: rgba(255,255,255,0.03); overflow: hidden; height: 320px; }
.skeleton-img { width: 100%; height: 75%; background: linear-gradient(90deg, #1e1b4b 25%, #312e81 50%, #1e1b4b 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-title { height: 15px; width: 80%; background: #334155; margin: 12px; border-radius: 4px; }
.skeleton-text { height: 10px; width: 40%; background: #262626; margin: 0 12px; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; margin-bottom: 1.5rem; border-radius: 16px; }
.header-left { display: flex; align-items: center; gap: 1rem; }
.highlight { background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.highlight-text { color: var(--primary); font-weight: 600; }
.section-title { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.section-title h3 { font-size: 1.4rem; font-weight: 600; }

/* Grid */
.drama-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.2rem;
}

.drama-card {
    background: rgba(255,255,255,0.02); border: 1px solid var(--glass-border); border-radius: 14px;
    overflow: hidden; cursor: pointer; transition: all 0.3s cubic-bezier(0.25,0.46,0.45,0.94);
    display: flex; flex-direction: column;
    animation: cardIn 0.4s ease both;
}
@keyframes cardIn { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }

.drama-card:hover { transform: translateY(-6px); box-shadow: 0 12px 25px -8px rgba(0,0,0,0.5); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); }
.card-image-wrap { position: relative; width: 100%; aspect-ratio: 3/4; overflow: hidden; }
.card-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.drama-card:hover .card-image { transform: scale(1.05); }

.premium-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.dubbed-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.episodes-badge { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); color: white; font-size: 0.7rem; padding: 3px 7px; border-radius: 5px; }

.card-info { padding: 0.8rem; flex-grow: 1; display: flex; flex-direction: column; }
.card-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: auto; }

/* Load More */
.load-more-btn {
    display: block; margin: 2rem auto; padding: 0.9rem 2.5rem; border-radius: 12px; border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.04); color: white; font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease;
}
.load-more-btn:hover { background: linear-gradient(135deg, var(--primary), var(--secondary)); border-color: transparent; transform: translateY(-2px); }

/* Loader */
.loader { width: 20px; height: 20px; border: 3px solid rgba(255,51,102,0.3); border-radius: 50%; border-top-color: var(--primary); animation: spin 1s ease-in-out infinite; display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Back Button */
.back-btn {
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: white;
    padding: 0.5rem 1rem; border-radius: 10px; cursor: pointer; font-size: 0.9rem; font-weight: 500;
    transition: all 0.2s ease; margin-bottom: 1rem;
}
.back-btn:hover { background: rgba(255,255,255,0.1); transform: translateX(-3px); }

/* Detail View */
.detail-content { padding: 1.5rem; }
.detail-top { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; }
.detail-cover { width: 180px; height: 260px; object-fit: cover; border-radius: 14px; flex-shrink: 0; box-shadow: 0 12px 25px rgba(0,0,0,0.4); }
.detail-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.8rem; background: linear-gradient(to right,#fff,#cbd5e1); -webkit-background-clip: text; background-clip: text; color: transparent; }
.detail-desc { color: var(--text-muted); line-height: 1.6; font-size: 0.9rem; max-height: 160px; overflow-y: auto; }

.download-btn {
    margin-top: 1rem; padding: 0.7rem 1.5rem; border-radius: 10px; border: none;
    background: linear-gradient(135deg, #10b981, #059669); color: white;
    font-weight: 700; font-size: 0.95rem; cursor: pointer; transition: all 0.3s ease;
    display: inline-block;
}
.download-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 20px -6px rgba(16,185,129,0.5); }
.download-btn:disabled { opacity: 0.6; cursor: wait; }

.download-progress { margin-top: 0.8rem; }
.progress-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.08); border-radius: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #10b981); border-radius: 8px; transition: width 0.4s ease; width: 0%; }
.download-status { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }
.download-link { color: #10b981; font-weight: 700; text-decoration: underline; }
.episodes-section h3 { font-size: 1.2rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.75rem; }

.episode-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.6rem; }
.episode-item {
    background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); border-radius: 10px;
    padding: 0.7rem; cursor: pointer; transition: all 0.2s ease; text-align: center;
}
.episode-item:hover { background: rgba(255,51,102,0.15); border-color: rgba(255,51,102,0.3); transform: translateY(-2px); }
.episode-item.locked { opacity: 0.55; }
.ep-info { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.ep-name { font-weight: 500; font-size: 0.8rem; }
.ep-lock { font-size: 0.7rem; }
.ep-free { font-size: 0.6rem; background: linear-gradient(135deg,#10b981,#059669); color: white; padding: 2px 5px; border-radius: 4px; font-weight: 700; }

/* Player */
.player-header { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.player-title { font-size: 1.1rem; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-counter { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.player-wrapper { border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 20px 50px rgba(0,0,0,0.6); }
.video-player { width: 100%; max-height: 75vh; display: block; }

.player-controls { display: flex; justify-content: center; gap: 1rem; margin-top: 1rem; }
.ep-nav-btn {
    padding: 0.7rem 1.5rem; border-radius: 10px; border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.04); color: white; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s ease;
}
.ep-nav-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); transform: translateY(-2px); }
.ep-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ep-nav-btn.next-btn { background: linear-gradient(135deg, var(--primary), var(--secondary)); border-color: transparent; }
.ep-nav-btn.next-btn:disabled { background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); }

@keyframes pulse-glow { 0%,100% { box-shadow: 0 0 0 0 rgba(255,51,102,0.4); } 50% { box-shadow: 0 0 20px 6px rgba(255,51,102,0.6); } }
.ep-nav-btn.pulse { animation: pulse-glow 0.7s ease-in-out 2; }

/* ===== RESPONSIVE ===== */

/* Tablets */
@media (max-width: 1024px) {
    .container { padding: 1rem; }
    .drama-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
    .detail-cover { width: 150px; height: 220px; }
    .detail-title { font-size: 1.4rem; }
}

/* Mobile */
@media (max-width: 640px) {
    .container { padding: 0.75rem; }
    .dashboard-header { padding: 0.8rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
    .dashboard-header h2 { font-size: 1.1rem; }
    .dashboard-header p { font-size: 0.8rem; }
    .section-title h3 { font-size: 1.1rem; }
    
    .drama-grid { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
    .card-info { padding: 0.5rem; }
    .card-title { font-size: 0.75rem; }
    .card-meta { font-size: 0.65rem; }
    .premium-badge { font-size: 0.55rem; padding: 2px 5px; top: 5px; right: 5px; }
    .episodes-badge { font-size: 0.6rem; padding: 2px 5px; bottom: 5px; right: 5px; }

    .glass-card, .detail-content { padding: 1rem; border-radius: 12px; }
    .detail-top { flex-direction: column; align-items: center; text-align: center; gap: 1rem; }
    .detail-cover { width: 140px; height: 200px; }
    .detail-title { font-size: 1.3rem; }
    .detail-desc { max-height: 120px; font-size: 0.85rem; }

    .episode-list { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem; }
    .episode-item { padding: 0.5rem; }
    .ep-name { font-size: 0.7rem; }

    .player-header { gap: 0.5rem; }
    .player-title { font-size: 0.95rem; }
    .ep-counter { font-size: 0.75rem; }
    .video-player { max-height: 50vh; }
    .player-controls { gap: 0.5rem; }
    .ep-nav-btn { padding: 0.6rem 1rem; font-size: 0.8rem; }
    .back-btn { padding: 0.4rem 0.8rem; font-size: 0.8rem; }

    .login-card { margin: 5vh 1rem; padding: 1.5rem; }
    h1 { font-size: 1.8rem; }
    .subtitle { font-size: 0.95rem; margin-bottom: 1.5rem; }
    
    .load-more-btn { padding: 0.7rem 2rem; font-size: 0.9rem; }
}

/* Small phones */
@media (max-width: 380px) {
    .drama-grid { grid-template-columns: repeat(2, 1fr); }
}
