:root {
    --bg-dark: #0a0a0f;
    --card-bg: rgba(20, 20, 30, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f0f0f5;
    --text-muted: #9ba1a6;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #0ea5e9;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --glass-blur: blur(12px);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.05), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.05), transparent 25%);
}

.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    padding: 3rem;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow);
    text-align: center;
}

.logo-container img { width: 70px; margin-bottom: 1rem; }
.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; letter-spacing: -0.5px; }
.login-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 2rem; }

.input-group { margin-bottom: 1.5rem; text-align: left; }
.input-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 1px; }
.input-group input {
    width: 100%; padding: 12px 16px; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color);
    border-radius: 10px; color: #fff; font-size: 1rem; outline: none; transition: 0.3s;
}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2); }

.btn-primary {
    width: 100%; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none; border-radius: 10px; color: #fff; font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: 0.3s; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6); }
.btn-primary:active { transform: translateY(0); }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-secondary { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background: rgba(255,255,255,0.05); }

/* Main Dashboard */
.admin-layout { display: flex; height: 100vh; }

.sidebar {
    width: 260px; background: var(--card-bg); border-right: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur); display: flex; flex-direction: column; padding: 1.5rem 0;
    flex-shrink: 0;
}
.sidebar-header { padding: 0 1.5rem 2rem; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); }
.sidebar-header img { width: 35px; }
.sidebar-header h2 { font-size: 1.1rem; font-weight: 700; }

.nav-links { list-style: none; padding: 1.5rem 1rem; flex: 1; }
.nav-item { margin-bottom: 0.5rem; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-muted);
    text-decoration: none; border-radius: 10px; transition: 0.3s; font-weight: 500; font-size: 0.95rem;
}
.nav-link:hover, .nav-link.active { background: rgba(139, 92, 246, 0.1); color: var(--primary); }

.main-content { flex: 1; overflow-y: auto; padding: 2rem 3rem; }

.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.top-header h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; }
.admin-badge { padding: 6px 12px; background: rgba(139, 92, 246, 0.15); border: 1px solid rgba(139, 92, 246, 0.3); border-radius: 20px; color: var(--primary); font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2.5rem; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border-color); padding: 1.5rem; border-radius: 16px; }
.stat-title { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 700; color: #fff; }

/* Student Search & List */
.search-bar-container { position: relative; margin-bottom: 2rem; }
.search-bar-container i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-bar { width: 100%; padding: 16px 16px 16px 45px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; color: #fff; font-size: 1rem; outline: none; transition: 0.3s; }
.search-bar:focus { border-color: var(--primary); }

.students-table-container { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; }
.students-table { width: 100%; border-collapse: collapse; }
.students-table th, .students-table td { padding: 1rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.students-table th { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; background: rgba(0,0,0,0.2); }
.students-table td { font-size: 0.95rem; }
.students-table tr:last-child td { border-bottom: none; }
.students-table tbody tr:hover { background: rgba(255,255,255,0.02); cursor: pointer; }

.user-cell { display: flex; align-items: center; gap: 12px; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 600; color: #fff; }
.avatar-sm img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.live { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.offline { background: var(--text-muted); }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; z-index: 100; opacity: 0; pointer-events: none; transition: 0.3s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--bg-dark); border: 1px solid var(--border-color); border-radius: 20px; width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; transform: translateY(20px); transition: 0.3s; }
.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background: var(--card-bg); position: sticky; top: 0; z-index: 10; }
.modal-header h2 { font-size: 1.3rem; }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: 0.3s; }
.close-btn:hover { color: var(--danger); }

.modal-body { padding: 2rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

.control-section { background: rgba(255,255,255,0.02); border: 1px solid var(--border-color); border-radius: 16px; padding: 1.5rem; }
.control-section h3 { font-size: 1rem; color: var(--primary); margin-bottom: 1.5rem; display: flex; align-items: center; gap: 8px; }

.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; align-items: flex-end; }
.form-row > div { flex: 1; }
.btn-sm { padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: none; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { background: rgba(255,255,255,0.05); }

/* Task Manager */
.task-list-admin { max-height: 300px; overflow-y: auto; padding-right: 10px; }
.admin-task-item { background: rgba(0,0,0,0.3); border: 1px solid var(--border-color); border-radius: 10px; padding: 12px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.admin-task-info { display: flex; flex-direction: column; gap: 4px; }
.admin-task-title { font-size: 0.95rem; font-weight: 500; }
.admin-task-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 10px; }
.admin-task-actions { display: flex; gap: 8px; }
.admin-task-actions button { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1rem; transition: 0.3s; }
.admin-task-actions button:hover { color: #fff; }
.admin-task-actions .del:hover { color: var(--danger); }

/* Toast */
#toast { position: fixed; bottom: 20px; right: 20px; padding: 16px 24px; border-radius: 12px; font-weight: 600; color: #fff; transform: translateY(100px); opacity: 0; transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 1000; box-shadow: var(--shadow); }
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { background: var(--success); }
#toast.error { background: var(--danger); }
#toast.warning { background: var(--warning); color: #000; }

@media (max-width: 900px) {
    .modal-body { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; padding: 1rem; border-right: none; border-bottom: 1px solid var(--border-color); flex-direction: row; justify-content: space-between; align-items: center; }
    .nav-links { display: none; }
    .main-content { padding: 1rem; }
    .top-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}
