:root {
    /* Color Palette */
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #f3f4f6;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-main: #f9fafb;
    --bg-surface: #ffffff;
    --border-color: #e5e7eb;
    
    /* Dimensions */
    --sidebar-width: 260px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: blur(10px);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --primary-color: #6366f1;
    --primary-hover: #818cf8;
    --secondary-color: #374151;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --bg-main: #111827;
    --bg-surface: #1f2937;
    --border-color: #374151;
    --glass-bg: rgba(31, 41, 55, 0.7);
    --glass-border: rgba(55, 65, 81, 0.5);
}

body {
    font-family: 'Inter', 'Hind', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* Layout Setup */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 999;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.main-content {
    margin-left: 0;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Sidebar Details */
.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.25rem;
}
.sidebar-menu {
    padding: 20px 12px;
    flex: 1;
    overflow-y: auto;
}
.sidebar-menu .nav-link {
    color: var(--text-muted);
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}
.sidebar-menu .nav-link i {
    margin-right: 12px;
    font-size: 1.1rem;
}
.sidebar-menu .nav-link:hover, .sidebar-menu .nav-link.active {
    background-color: rgba(79, 70, 229, 0.08);
    color: var(--primary-color);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}
.user-profile {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.user-profile:hover {
    background-color: var(--secondary-color);
}
.user-profile .avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), #0dcaf0);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
}
.user-info {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
}
.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Collapsed Sidebar Styles */
body.sidebar-collapsed .sidebar {
    width: 80px;
}
body.sidebar-collapsed .main-content {
    margin-left: 80px;
}
body.sidebar-collapsed .sidebar-header {
    padding: 20px 10px;
    display: flex;
    justify-content: center;
}
body.sidebar-collapsed .brand-link {
    justify-content: center;
}
body.sidebar-collapsed .brand-icon {
    margin-right: 0 !important;
}
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-heading,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .user-info,
body.sidebar-collapsed .logout-btn {
    display: none;
}
body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 12px 10px;
}
body.sidebar-collapsed .nav-link i {
    margin-right: 0;
    font-size: 1.3rem;
}
body.sidebar-collapsed .sidebar-footer {
    padding: 16px 10px;
}
body.sidebar-collapsed .user-profile {
    justify-content: center;
}
body.sidebar-collapsed .user-profile .avatar {
    margin-right: 0;
}

/* Topbar Glassmorphism */
.topbar {
    background-color: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 998;
    padding: 12px 24px;
}
.search-form {
    background-color: var(--secondary-color);
    border-radius: 20px;
    padding: 2px;
    width: 300px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.search-form:focus-within {
    background-color: var(--bg-surface);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.search-form input:focus {
    box-shadow: none;
}
.nav-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    background-color: var(--secondary-color);
    transition: all 0.2s ease;
}
.nav-icon:hover {
    background-color: var(--border-color);
    color: var(--text-main);
}

/* Card Styles */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.active {
        margin-left: 0;
    }
    .main-content {
        margin-left: 0;
    }
}

/* Drag and Drop Cursors */
.cursor-grab {
    cursor: grab;
}
.cursor-grab:active {
    cursor: grabbing;
}
.question-block {
    cursor: grab;
}
.question-block:active {
    cursor: grabbing;
}
