/* NextGen Player Hub - V4 (Multi-Page Edition) */
:root {
    --bg: #000000;
    --card: #0a0a0a;
    --sidebar: #050505;
    --primary: #9333ea;
    --primary-hover: #a855f7;
    --text: #f8fafc;
    --border: rgba(147, 51, 234, 0.35);
    --glow-strong: 0 4px 12px rgba(147, 51, 234, 0.25);
    --glow-soft: 0 2px 6px rgba(147, 51, 234, 0.15);
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    margin: 0; 
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text); 
    min-height: 100vh; 
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* Sidebar Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px; 
    background: var(--sidebar); 
    border-right: 1px solid var(--border);
    position: fixed; 
    height: 100vh; 
    z-index: 1000;
    display: flex; 
    flex-direction: column; 
    transition: transform 0.3s ease;
}

.sidebar-header { padding: 25px; text-align: center; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { margin: 0; color: #fff; font-size: 20px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; }
.sidebar-logo { max-width: 150px; margin-bottom: 10px; }

.nav-list { flex-grow: 1; padding: 15px 10px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 15px; padding: 14px 20px; color: #d8b4fe;
    text-decoration: none; border-radius: 12px; transition: 0.3s; cursor: pointer;
    font-weight: 600; margin-bottom: 8px;
}
.nav-item:hover { background: rgba(147, 51, 234, 0.1); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), #7e22ce); color: #fff; box-shadow: var(--glow-soft); }

.main-content { margin-left: 260px; flex-grow: 1; padding: 30px; }
.mobile-header { display: none; }

/* Mobile Adaptations */
@media (max-width: 850px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 15px; padding-top: 80px; }
    
    .mobile-header {
        display: flex; align-items: center; gap: 15px;
        position: fixed; top: 0; left: 0; width: 100%; height: 60px;
        background: rgba(0,0,0,0.9); border-bottom: 1px solid var(--border);
        padding: 0 15px; z-index: 900; backdrop-filter: blur(10px);
    }
    .mobile-header h3 { margin: 0; color: #fff; font-weight: 800; }
}

/* UI Components */
h2 { color: var(--primary-hover); margin-top: 0; display: flex; align-items: center; gap: 10px; }
.card-box { background: var(--card); padding: 22px; border-radius: 20px; border: 1px solid var(--border); margin-bottom: 20px; width: 100%; }
label { display: block; font-size: 12px; color: #d8b4fe; margin-bottom: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
input, textarea, select {
    width: 100%; padding: 14px 16px; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    color: #fff; border-radius: 12px; font-size: 15px; margin-bottom: 15px; transition: 0.3s; font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary-hover); outline: none; background: rgba(255,255,255,0.08); }

.flex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.flex-row { display: flex; gap: 10px; flex-wrap: wrap; }
.flex-row > * { flex: 1; min-width: 100px; margin-bottom: 0; }

button {
    background: linear-gradient(135deg, var(--primary), #7e22ce); color: #fff; border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 14px 20px; border-radius: 12px; cursor: pointer; font-weight: 700; display: inline-flex;
    align-items: center; justify-content: center; gap: 8px; transition: 0.2s; font-size: 15px;
}
button:active { transform: scale(0.96); }
button.secondary { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: #fff; }
button.danger { background: linear-gradient(135deg, #ef4444, #991b1b); border-color: #fca5a5; color: #fff; }
button.success { background: linear-gradient(135deg, #10b981, #059669); border-color: #34d399; color: #fff; }
button.info { background: linear-gradient(135deg, #3b82f6, #1d4ed8); border-color: #93c5fd; }
button.warning { background: linear-gradient(135deg, #f59e0b, #b45309); border-color: #fcd34d; color: #fff;}

/* Overlays & Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: 9999; padding: 20px; }
.modal-content { background: var(--card); padding: 30px; border-radius: 24px; width: 100%; max-width: 400px; border: 1px solid var(--border); text-align: center; max-height: 90vh; overflow-y: auto; }

/* Library Grid */
.saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.saved-item { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; cursor: pointer; position: relative; transition: 0.3s; aspect-ratio: 2/3; }
.saved-item:hover { transform: translateY(-5px); box-shadow: var(--glow-strong); border-color: var(--primary-hover); z-index: 2; }
.saved-item img { width: 100%; height: 100%; object-fit: cover; }
.saved-item .info { padding: 12px; background: linear-gradient(to top, rgba(0,0,0,0.95), transparent); position: absolute; bottom: 0; width: 100%; }
.saved-item .info h4 { margin: 0 0 3px; font-size: 13px; font-weight:800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-badge { position: absolute; top: 10px; left: 10px; background: var(--primary); padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 800; border: 1px solid rgba(255,255,255,0.2); z-index: 2; }

/* Utilities */
.img-preview { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; margin-bottom: 15px; border: 1px solid var(--primary); display: none; background: #000; }
.banner-preview { height: 100px; }
.mode-toggle { display: flex; background: rgba(255,255,255,0.05); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.mode-toggle button { flex: 1; padding: 8px 12px; font-size: 11px; border: none; background: transparent; color: #a78bfa; border-radius: 0; margin: 0; }
.mode-toggle button.active { background: var(--primary); color: #fff; }

/* Notifications */
#notification-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast { min-width: 280px; padding: 16px 20px; border-radius: 14px; background: #050505; color: white; border: 1px solid var(--border); border-left: 5px solid var(--primary); box-shadow: 0 5px 15px rgba(0,0,0,0.5); display: flex; align-items: flex-start; gap: 12px; pointer-events: auto; animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.toast i { font-size: 24px; margin-top: 2px; }
.toast .toast-title { font-weight: 800; font-size: 14px; margin-bottom: 2px; }
.toast .toast-msg { font-size: 12px; color: #d8b4fe; }
.toast.success { border-left-color: var(--success); } .toast.success i { color: var(--success); }
.toast.error { border-left-color: var(--error); } .toast.error i { color: var(--error); }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOutRight { to { transform: translateX(120%); opacity: 0; } }