:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #0F172A;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --accent: #38BDF8;
    --danger: #EF4444;
    --success: #10B981;
}

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

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #1E1B4B, transparent 40%),
                      radial-gradient(circle at bottom left, #0F172A, transparent 40%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.highlight { color: var(--accent); }

/* --- VIEWS --- */
.view-container {
    display: none;
    width: 100%;
    height: 100vh;
}
.view-container.active {
    display: flex;
}

/* --- LOGIN VIEW --- */
#login-view {
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    margin: 20px;
    animation: fadeIn 0.5s ease;
}

.logo-area { text-align: center; margin-bottom: 30px; }
.logo-area h2 { font-size: 2rem; font-weight: 700; letter-spacing: -1px; }
.logo-area p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 5px; }

.input-group { margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-secondary); }
.input-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}
.input-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3); }

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }

.error-message { color: var(--danger); font-size: 0.85rem; margin-bottom: 15px; display: none; text-align: center; }

/* --- DASHBOARD VIEW --- */
#main-view { flex-direction: row; }

/* Sidebar */
.sidebar {
    width: 260px;
    height: calc(100vh - 30px);
    margin: 10px 0 20px 10px;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 100;
    position: sticky;
    top: 20px;
}

.sidebar.collapsed {
    width: 80px;
}
.sidebar.collapsed .brand-text { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center !important; }
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 15px 0; }
.sidebar.collapsed .nav-item i { font-size: 1.3rem; }
.sidebar.collapsed .btn-logout span { display: none; }
.sidebar.collapsed .btn-logout { padding: 12px 0; justify-content: center; }
.sidebar.collapsed .btn-logout i { margin: 0; font-size: 1.2rem; }

.sidebar-header { padding: 30px 20px; text-align: center; }
.sidebar-header h2 { font-size: 1.5rem; }

.sidebar-nav { flex: 1; padding: 0 15px; display: flex; flex-direction: column; gap: 8px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 15px; border-radius: 8px;
    color: var(--text-secondary); text-decoration: none;
    transition: all 0.3s;
}
.nav-item:hover, .nav-item.active {
    background: rgba(79, 70, 229, 0.1); color: var(--accent);
}
.nav-item.active { background: rgba(79, 70, 229, 0.2); font-weight: 600; border-left: 3px solid var(--accent); }

.sidebar-footer { padding: 20px; }
.btn-logout {
    width: 100%; padding: 10px; background: transparent; color: var(--text-secondary);
    border: 1px solid var(--panel-border); border-radius: 8px; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: var(--danger); }

/* Main Area */
.content-area { flex: 1; display: flex; flex-direction: column; padding: 10px 20px 20px 10px; }

.content-header { padding: 8px 25px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.content-header h1 { font-size: 1.1rem; font-weight: 600; }
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar { font-size: 1.8rem; color: var(--accent); }

.content-body { flex: 1; padding: 15px; overflow-y: visible; }

.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-refresh { background: var(--panel-border); color: white; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; gap: 8px; }
.btn-refresh:hover { background: rgba(255,255,255,0.2); }

/* Table */
.table-responsive { overflow-x: auto; }
.modern-table { width: 100%; border-collapse: collapse; text-align: left; }
.modern-table th { padding: 12px 15px; color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; border-bottom: 1px solid var(--panel-border); }
.modern-table td { padding: 6px 15px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.85rem; }
.modern-table tbody tr { transition: background 0.2s; }
.modern-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: var(--text-secondary); transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); background-color: white; }
input:disabled + .slider { opacity: 0.5; cursor: not-allowed; }

/* Mobile Support */
.mobile-menu-btn { display: none; position: fixed; top: 20px; left: 20px; z-index: 200; background: var(--primary); border: none; color: white; padding: 10px 15px; border-radius: 8px; font-size: 1.2rem; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

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

@media (max-width: 768px) {
    .mobile-menu-btn { display: block; top: 15px; left: 15px; }
    
    .sidebar {
        position: fixed; left: -280px; top: 0; margin: 0; height: 100vh; border-radius: 0;
        background: rgba(15, 23, 42, 0.95);
    }
    .sidebar.open { transform: translateX(280px); }
    
    .content-area { padding: 90px 15px 15px 15px; }
    
    .content-header {
        position: fixed;
        top: 15px;
        left: 70px;
        right: 15px;
        margin: 0;
        z-index: 100;
        padding: 8px 12px;
        min-height: 44px;
    }
    .content-header h1 { font-size: 0.85rem; max-width: 35%; line-height: 1.1; }
    .user-info { flex: 1; justify-content: flex-end; }
    .user-info .avatar { font-size: 1.4rem; }
    .user-info .user-name { font-size: 0.75rem; text-align: right; line-height: 1.2; word-break: break-word; }
    
    /* Responsive Table (Cards) */
    .modern-table thead { display: none; }
    .modern-table, .modern-table tbody, .modern-table tr, .modern-table td { display: block; width: 100%; }
    .modern-table tr { margin-bottom: 15px; background: rgba(255,255,255,0.02); border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); }
    .modern-table td { display: flex; justify-content: space-between; align-items: center; text-align: right; padding: 10px 15px; border-bottom: 1px solid rgba(255,255,255,0.05); }
    .modern-table td:last-child { border-bottom: none; }
    .modern-table td::before { content: attr(data-label); font-weight: bold; color: var(--text-secondary); text-transform: uppercase; font-size: 0.75rem; text-align: left; margin-right: 15px; }
    
    /* Responsive Filters */
    .list-header { flex-direction: column; align-items: stretch !important; gap: 10px; }
    .list-header > div { margin: 0 !important; flex-direction: column; }
    .list-header input, .list-header select { width: 100%; margin-bottom: 5px; }
    
    /* Responsive Modals */
    .modal-box div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .modal-box .form-group { grid-column: 1 / -1 !important; }
    .modal-header h3 { font-size: 1.1rem; }
}

select option {
    background-color: #1e1e2d;
    color: #ffffff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* VIDEO GRID YOUTUBE STYLE */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.video-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.video-thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

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

.video-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.video-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
}
