/* Global Vars & Reset */
:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --border: #334155;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }

/* Utilities */
.container { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.875rem; }
.form-control {
    width: 100%;
    padding: 0.625rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-main);
}
.form-control:focus { outline: none; border-color: var(--primary); }

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade { animation: fadeIn 0.4s ease-out forwards; }

/* Login Page */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}
.login-box { width: 100%; max-width: 400px; }

/* Admin Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: transform 0.3s;
    z-index: 50;
}
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border); font-weight: bold; font-size: 1.25rem; }
.sidebar-nav { flex: 1; padding: 1rem; }
.nav-link {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.nav-link:hover, .nav-link.active { background: var(--bg-hover); color: var(--text-main); }
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}
/* Mobile Admin */
.mobile-toggle { display: none; }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1rem; }
    .mobile-toggle { display: block; position: fixed; bottom: 1rem; right: 1rem; z-index: 100; border-radius: 50%; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; background: var(--primary); box-shadow: var(--shadow); }
}

/* Dashboard Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { display: flex; flex-direction: column; }
.stat-value { font-size: 2rem; font-weight: bold; margin-bottom: 0.25rem; }
.stat-label { color: var(--text-muted); font-size: 0.875rem; }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th { padding: 0.75rem; border-bottom: 1px solid var(--border); color: var(--text-muted); font-weight: 500; font-size: 0.875rem; }
.table td { padding: 0.75rem; border-bottom: 1px solid var(--border); color: var(--text-main); font-size: 0.95rem; }
.table tr:last-child td { border-bottom: none; }

/* Public Home */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2rem; padding: 2rem 0; }
.album-card { 
    display: block; 
    transition: transform 0.2s, box-shadow 0.2s; 
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}
.album-card:hover { transform: translateY(-4px); box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3); border-color: var(--primary); }
.album-thumb {
    aspect-ratio: 16/9;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 3rem;
}
.album-info { padding: 1rem; }
.album-title { font-weight: 600; font-size: 1.125rem; margin-bottom: 0.5rem; color: var(--text-main); }
.album-meta { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 0.875rem; }

/* Playlist Page */
.player-layout { display: grid; grid-template-columns: 1fr 350px; gap: 2rem; height: calc(100vh - 4rem); max-height: 900px; }
.video-stage { background:black; border-radius: var(--radius); overflow: hidden; position:relative; display:flex; flex-direction:column; }
.video-container { 
    position: relative; 
    padding-bottom: 56.25%; /* 16:9 */ 
    height: 0; 
    flex-shrink:0; 
    background: #000;
}
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
.video-details { padding: 1.5rem; overflow-y:auto; flex:1;}
.playlist-sidebar { 
    background: var(--bg-card); 
    border-radius: var(--radius); 
    border: 1px solid var(--border);
    display: flex; flex-direction: column; overflow: hidden;
    height: 100%;
}
.playlist-header { padding: 1rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.playlist-items { overflow-y: auto; flex: 1; }
.playlist-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    gap: 0.75rem;
    transition: 0.2s;
}
.playlist-item:hover { background: var(--bg-hover); }
.playlist-item.active { background: rgb(59 130 246 / 0.1); border-left: 3px solid var(--primary); }
.item-idx { color: var(--text-muted); font-size: 0.875rem; width: 1.5rem; }
.item-title { font-size: 0.95rem; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 900px) {
    .player-layout { grid-template-columns: 1fr; height: auto; display:block;}
    .video-stage { margin-bottom: 2rem; }
    .playlist-sidebar { height: 500px; }
}
