/* ===== Shared Layout Styles for Dashboard & Admin ===== */

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

.sidebar {
    width: 260px;
    background: var(--sidebar-bg, rgba(12, 12, 30, 0.95));
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-logo span {
    display: none;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 12px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-glass);
}

.sidebar-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.sidebar-link.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.12);
    box-shadow: inset 3px 0 0 var(--accent-1);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content,
.main-content.expanded {
    margin-left: 72px;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.main-header h1 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
}

.main-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ===== Stats Cards ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.06;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 14px;
}

.stat-card .stat-icon.purple { background: rgba(99, 102, 241, 0.15); }
.stat-card .stat-icon.pink { background: rgba(217, 70, 239, 0.15); }
.stat-card .stat-icon.green { background: rgba(16, 185, 129, 0.15); }
.stat-card .stat-icon.amber { background: rgba(245, 158, 11, 0.15); }
.stat-card .stat-icon.blue { background: rgba(59, 130, 246, 0.15); }

.stat-card .stat-number {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    display: block;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Content Cards ===== */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
}

.content-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.content-card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

/* ===== Data Table ===== */
.data-table-wrapper {
    overflow-x: auto;
    margin: -4px;
    padding: 4px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.table-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.table-user-info {
    min-width: 0;
}

.table-user-name {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
}

.table-user-email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Badges / Tags ===== */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.role-badge.student { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.role-badge.manager { background: rgba(99, 102, 241, 0.12); color: #818cf8; }
.role-badge.admin { background: rgba(217, 70, 239, 0.12); color: #e879f9; }
.role-badge.blocked { background: rgba(239, 68, 68, 0.12); color: #f87171; }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--text-muted); }
.status-dot.blocked { background: var(--danger); }

/* ===== Action Buttons ===== */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.action-btn.danger:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ===== Search & Filters ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-width: 320px;
    width: 100%;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-bar svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--bg-glass);
    cursor: pointer;
    transition: var(--transition);
}

.filter-pill:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.filter-pill.active {
    background: var(--accent-1);
    color: white;
    border-color: var(--accent-1);
}

/* ===== Progress Bar Component ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background: var(--gradient-main);
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.green .progress-fill {
    background: linear-gradient(90deg, #059669, #10b981);
}

.progress-bar.amber .progress-fill {
    background: linear-gradient(90deg, #d97706, #f59e0b);
}

/* ===== Course Card (Dashboard) ===== */
.course-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.dash-course-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.dash-course-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.dash-course-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.dash-course-emoji {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.dash-course-info h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.dash-course-info span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.dash-course-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.dash-course-progress .progress-bar {
    flex: 1;
}

.dash-course-progress span {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== Achievement Card ===== */
.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.achievement-card {
    text-align: center;
    padding: 24px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.achievement-card.unlocked {
    border-color: var(--border-hover);
}

.achievement-card.locked {
    opacity: 0.35;
}

.achievement-card.unlocked:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.achievement-card .ach-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.achievement-card .ach-name {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.achievement-card .ach-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Grid layouts ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ===== XP Bar ===== */
.xp-bar-container {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.xp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.xp-level {
    display: flex;
    align-items: center;
    gap: 10px;
}

.xp-level-icon {
    font-size: 1.5rem;
}

.xp-level-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
}

.xp-points {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.xp-points strong {
    color: var(--accent-2);
}

.xp-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.xp-bar-fill {
    height: 100%;
    background: var(--gradient-main);
    border-radius: 5px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== Form Styles (shared for registration/profile) ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input, .form-select {
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-error {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 4px;
}

.form-success {
    font-size: 0.78rem;
    color: var(--success);
    margin-top: 4px;
}

/* Password strength */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.strength-bar {
    height: 3px;
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    transition: var(--transition);
}

.strength-bar.active.weak { background: var(--danger); }
.strength-bar.active.medium { background: var(--accent-4); }
.strength-bar.active.strong { background: var(--success); }

.strength-label {
    font-size: 0.75rem;
    margin-top: 4px;
}

/* ===== Multi-step Registration ===== */
.register-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.register-container {
    width: 100%;
    max-width: 560px;
}

.register-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
}

.register-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 36px;
}

.step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    background: var(--bg-glass);
    border: 2px solid var(--border);
    color: var(--text-muted);
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.step-dot.active {
    background: var(--accent-1);
    border-color: var(--accent-1);
    color: white;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.step-dot.done {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-line {
    width: 60px;
    height: 2px;
    background: var(--border);
    transition: var(--transition);
}

.step-line.done {
    background: var(--success);
}

.step-content {
    animation: fadeInUp 0.3s ease-out;
}

.step-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-align: center;
}

.step-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 28px;
}

.step-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.step-actions .btn-primary,
.step-actions .btn-ghost {
    flex: 1;
    justify-content: center;
    padding: 14px;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 28px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--accent-2);
    font-weight: 600;
}

.login-footer a:hover {
    color: var(--accent-1);
}

.demo-accounts {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.demo-accounts h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    text-align: center;
}

.demo-btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.demo-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.demo-btn .demo-role {
    font-weight: 600;
    min-width: 100px;
}

/* ===== Notification Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 5000;
    animation: slideInToast 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

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

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ===== Mobile Responsive ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
    padding: 12px 20px;
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
}

.mobile-header .sidebar-logo {
    font-size: 1rem;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 80px 16px 24px;
    }

    .mobile-header {
        display: flex;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .course-row {
        grid-template-columns: 1fr;
    }

    .register-card, .login-card {
        padding: 28px 20px;
    }
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .achievements-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== AI Chat Panel ===== */
.ai-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-main);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 300;
    transition: var(--transition);
    border: none;
}

.ai-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.ai-panel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 380px;
    max-height: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInToast 0.3s ease-out;
}

.ai-panel.hidden {
    display: none;
}

.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(99, 102, 241, 0.05);
}

.ai-panel-header h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-panel-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-glass);
    border: none;
    cursor: pointer;
}

.ai-panel-close:hover {
    color: var(--text-primary);
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 360px;
}

.ai-msg {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.6;
    max-width: 90%;
    white-space: pre-line;
}

.ai-msg.bot {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    align-self: flex-start;
}

.ai-msg.user {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    align-self: flex-end;
}

.ai-msg strong {
    color: var(--text-primary);
}

.ai-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.ai-input-row input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.ai-input-row input:focus {
    border-color: var(--accent-1);
}

.ai-input-row button {
    padding: 10px 16px;
    background: var(--gradient-main);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.ai-input-row input::placeholder {
    color: var(--text-muted);
}

/* ===== AI Generate Button ===== */
.ai-gen-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-2);
    background: rgba(217, 70, 239, 0.08);
    border: 1px solid rgba(217, 70, 239, 0.2);
    cursor: pointer;
    transition: var(--transition);
}

.ai-gen-btn:hover {
    background: rgba(217, 70, 239, 0.15);
    border-color: rgba(217, 70, 239, 0.35);
}

/* ===== Alert Cards ===== */
.alert-card {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border: 1px solid;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-card.warning {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-card.success {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-card.info {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}

.alert-card .alert-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.alert-card .alert-text {
    font-size: 0.85rem;
    line-height: 1.5;
}

.alert-card .alert-text strong {
    display: block;
    margin-bottom: 4px;
}

/* ===== Emoji Picker Grid ===== */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.emoji-option {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.emoji-option:hover {
    border-color: var(--border-hover);
}

.emoji-option.active {
    border-color: var(--accent-1);
    background: rgba(99, 102, 241, 0.1);
}

@media (max-width: 600px) {
    .ai-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 80px;
    }

    .ai-fab {
        right: 16px;
        bottom: 16px;
    }
}

/* ===== Lesson Content Styles ===== */
.lesson-content h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

.lesson-content h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 12px 0;
}

.lesson-content p {
    margin-bottom: 14px;
}

.lesson-content ul, .lesson-content ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.lesson-content li {
    margin-bottom: 8px;
}

.lesson-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.85rem;
}

.lesson-content th, .lesson-content td {
    padding: 10px 14px;
    text-align: left;
    border: 1px solid var(--border);
}

.lesson-content th {
    background: var(--bg-glass);
    font-weight: 700;
    color: var(--text-primary);
}

.lesson-content td {
    color: var(--text-secondary);
}

.lesson-tip {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin: 20px 0;
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ===== Theme Picker ===== */
.theme-picker-wrap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--bg-glass);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    cursor: pointer;
    transition: all 0.25s;
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.theme-option:hover {
    border-color: var(--accent-1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-option.active {
    border-color: var(--accent-1);
    background: rgba(99,102,241,0.08);
    color: var(--text-primary);
    font-weight: 600;
}

.theme-preview {
    width: 48px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}

.theme-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10px;
    border-radius: 0 0 6px 6px;
}

.theme-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-main);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 20px rgba(99,102,241,0.4);
    z-index: 1000;
    transition: all 0.3s;
}
.theme-fab:hover {
    transform: scale(1.12);
}

.theme-popup {
    position: fixed;
    bottom: 80px;
    right: 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    animation: popIn 0.25s ease;
}
.theme-popup.hidden { display: none; }

.theme-popup h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
}

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

/* ===== Light theme overrides ===== */
body.theme-light .sidebar {
    background: rgba(255,255,255,0.95) !important;
    backdrop-filter: blur(20px);
    box-shadow: 2px 0 20px rgba(0,0,0,0.06);
    border-right: 1px solid rgba(0,0,0,0.08);
}

body.theme-light .sidebar-logo,
body.theme-light .sidebar-logo span {
    color: #1a1a2e;
}

body.theme-light .sidebar-link {
    color: rgba(26,26,46,0.65);
}

body.theme-light .sidebar-link:hover {
    background: rgba(99,102,241,0.08);
    color: #1a1a2e;
}

body.theme-light .sidebar-link.active {
    background: rgba(99,102,241,0.12);
    color: #6366f1;
}

body.theme-light .sidebar-user {
    border-color: rgba(0,0,0,0.06);
}

body.theme-light .sidebar-user-info h4 {
    color: #1a1a2e;
}

body.theme-light .sidebar-user-info small {
    color: rgba(26,26,46,0.5);
}

body.theme-light .sidebar-header {
    border-color: rgba(0,0,0,0.06);
}

body.theme-light .sidebar-toggle {
    color: rgba(26,26,46,0.5);
}

body.theme-light .sidebar-toggle:hover {
    color: #1a1a2e;
    background: rgba(0,0,0,0.05);
}

body.theme-light .content-card,
body.theme-light .stat-card,
body.theme-light .dash-course-card {
    background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

body.theme-light .form-input {
    background: rgba(255,255,255,0.9);
    border-color: rgba(0,0,0,0.1);
    color: var(--text-primary);
}

body.theme-light .filter-pill {
    background: rgba(255,255,255,0.6);
    border-color: rgba(0,0,0,0.08);
    color: var(--text-secondary);
}

body.theme-light .filter-pill.active {
    background: var(--gradient-main);
    color: white;
    border-color: transparent;
}

body.theme-light .data-table th {
    background: rgba(0,0,0,0.03);
}

body.theme-light .data-table td {
    border-color: rgba(0,0,0,0.05);
}

body.theme-light .mobile-header {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px);
}

body.theme-light .login-card,
body.theme-light .register-card {
    background: rgba(255,255,255,0.9);
    box-shadow: 0 8px 40px rgba(0,0,0,0.08);
}

body.theme-light .bg-animation {
    opacity: 0.3;
}

@media (max-width: 900px) {
    .theme-popup { right: 16px; bottom: 72px; min-width: 260px; }
    .theme-fab { bottom: 16px; right: 16px; width: 42px; height: 42px; font-size: 1.1rem; }
    .theme-picker-wrap { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Астэрик Widget ===== */
#asterik-widget {
    position: fixed;
    bottom: 24px;
    left: 280px;
    z-index: 999;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.asterik-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--accent-1);
    background: var(--gradient-main);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(99,102,241,0.3);
    transition: all 0.3s;
    padding: 0;
    flex-shrink: 0;
    animation: asterikFloat 3s ease-in-out infinite;
}

.asterik-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(99,102,241,0.5);
}

.asterik-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.asterik-fallback {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes asterikFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.asterik-bubble {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 18px 18px 18px 4px;
    padding: 16px 20px;
    max-width: 320px;
    min-width: 220px;
    box-shadow: var(--shadow-md);
    position: relative;
    animation: bubbleIn 0.4s ease;
}

.asterik-bubble.hidden {
    display: none !important;
}

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

.asterik-msg {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-primary);
    transition: opacity 0.2s;
}

.asterik-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.asterik-close:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.asterik-refresh {
    background: none;
    border: none;
    color: var(--accent-1);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 10px;
    font-family: var(--font-body);
    transition: opacity 0.2s;
    display: block;
}

.asterik-refresh:hover {
    opacity: 0.7;
}

body.theme-light .asterik-bubble {
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* Move theme fab up when asterik present */
.theme-fab {
    bottom: 96px !important;
}

@media (max-width: 900px) {
    #asterik-widget {
        left: 16px;
        bottom: 16px;
    }
    .asterik-avatar {
        width: 52px;
        height: 52px;
    }
    .asterik-bubble {
        max-width: 240px;
        font-size: 0.82rem;
    }
    .theme-fab {
        bottom: 80px !important;
        right: 16px;
    }
}

/* Wave animation for Asterik greeting */
.asterik-wave {
    animation: asterikWave 0.6s ease-in-out 3 !important;
}

@keyframes asterikWave {
    0% { transform: rotate(0deg) scale(1); }
    15% { transform: rotate(14deg) scale(1.1); }
    30% { transform: rotate(-8deg) scale(1.05); }
    45% { transform: rotate(14deg) scale(1.1); }
    60% { transform: rotate(-4deg) scale(1.05); }
    75% { transform: rotate(10deg) scale(1.08); }
    100% { transform: rotate(0deg) scale(1); }
}

/* Entrance animation */
.asterik-entrance {
    animation: asterikEntrance 0.5s ease-out;
}

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

/* Hello badge */
.asterik-hello-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 1.2rem;
    animation: badgeBounce 0.5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes badgeBounce {
    from { transform: translateY(0) rotate(-10deg); }
    to { transform: translateY(-4px) rotate(10deg); }
}

/* Name label in bubble */
.asterik-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--accent-1);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Bubble show animation */
.asterik-bubble-show {
    animation: bubbleIn 0.4s ease !important;
}
