* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html.kb-layout-loading .app-container {
    opacity: 0;
    pointer-events: none;
}

html.kb-layout-ready .app-container {
    opacity: 1;
    transition: opacity 0.25s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.navbar-edu-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.3rem 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.navbar-edu-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: #1f2937;
    color: white;
    transition: all 0.3s;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .logo h2,
.sidebar.collapsed .sidebar-user .user-info,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .submenu-arrow,
.sidebar.collapsed .sidebar-footer span {
    display: none;
}

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

.sidebar.collapsed .nav-link,
.sidebar.collapsed .sidebar-footer a {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
}

.sidebar.collapsed .submenu {
    display: none !important;
}

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

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

.logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.logo h2 {
    font-size: 16px;
    margin: 0;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
}

/* Navigation */
.sidebar-nav {
    padding: 20px 0;
    flex: 1;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
    gap: 10px;
}

.nav-link:hover {
    background: rgba(52,152,219,0.18);
    color: white;
}

.nav-link i {
    width: 20px;
    font-size: 16px;
}

.submenu {
    list-style: none;
    padding-left: 50px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
}

.has-submenu.expanded .submenu {
    max-height: 200px;
}

.submenu li a {
    display: block;
    padding: 8px 0;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
}

.submenu li a:hover {
    color: white;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 8px 0;
}

.sidebar-footer-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
}

.sidebar-footer-item a:hover {
    background: rgba(52,152,219,0.18);
    color: #fff;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 999;
}

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

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    transition: margin-left 0.3s;
}

.sidebar.collapsed + .main-content {
    margin-left: 70px;
}

/* Navbar */
.navbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 6px 18px rgba(2,8,23,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #e2e8f0;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: #667eea;
    cursor: pointer;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-search {
    position: relative;
}

.navbar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.navbar-search input {
    padding: 8px 16px 8px 40px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    width: 250px;
    font-size: 14px;
}

.navbar-search input:focus {
    outline: none;
    border-color: #667eea;
}

.navbar-item {
    position: relative;
}

.navbar-icon {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    position: relative;
    padding: 8px;
    border-radius: 8px;
}

.navbar-icon:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #f44336;
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.navbar-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 14px 30px rgba(2, 8, 23, 0.16);
    z-index: 1200;
    display: none;
    overflow: hidden;
}

.dropdown-header,
.dropdown-footer,
.dropdown-body {
    padding: 10px 12px;
}

.dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
}

.dropdown-header h3 {
    margin: 0;
    font-size: 14px;
    color: #0f172a;
}

.dropdown-footer {
    border-top: 1px solid #e2e8f0;
}

.dropdown-footer a,
.dropdown-item {
    color: #1e293b;
    text-decoration: none;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}

.dropdown-item:hover {
    background: #f8fafc;
}

.dropdown-divider {
    height: 1px;
    background: #e2e8f0;
}

.btn-link {
    background: transparent;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 12px;
}

.notification-item,
.message-item {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.notification-item:last-child,
.message-item:last-child {
    border-bottom: none;
}

/* Content Wrapper */
.content-wrapper {
    padding: 30px;
}

/* Form Controls */
.form-control {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.4;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: #94a3b8;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #f0f0f0;
    color: #333;
}

/* Page Header */
.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-subtitle {
    color: #666;
    font-size: 14px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.bg-blue-100 { background: #e3f2fd; }
.bg-green-100 { background: #e8f5e9; }
.bg-purple-100 { background: #f3e5f5; }
.bg-yellow-100 { background: #fff3e0; }

.text-blue-600 { color: #1976d2; }
.text-green-600 { color: #388e3c; }
.text-purple-600 { color: #7b1fa2; }
.text-yellow-600 { color: #f57c00; }

.stat-details {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* Quick Actions */
.quick-actions-section {
    margin-bottom: 30px;
}

.quick-actions-section h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.quick-action-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.quick-action-card i {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 10px;
}

.quick-action-card span {
    display: block;
    font-size: 14px;
    font-weight: 500;
}

/* Recent Activities */
.recent-activities h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.activity-list {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item i {
    width: 32px;
    height: 32px;
    background: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
}

.activity-details {
    flex: 1;
}

.activity-details p {
    margin-bottom: 4px;
    font-size: 14px;
}

.activity-details span {
    font-size: 12px;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        width: 260px;
    }
    
    .sidebar.mobile-show {
        transform: translateX(0);
    }

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar.collapsed {
        width: 260px;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .navbar-search {
        display: none;
    }
    
    .content-wrapper {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1200;
    padding: 24px;
    overflow: auto;
}

.modal.show {
    display: block;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin: 24px auto;
    max-width: 720px;
    box-shadow: 0 16px 40px rgba(2, 8, 23, 0.2);
}

/* Accessibility and interaction consistency */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

button:disabled,
.btn:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}
