:root {
    /* Enterprise Light Theme Colors (Synced with Detroit Axle system) */
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-surface: #ffffff;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-muted: #94a3b8;
    
    --brand-primary: #3cb4e5;
    --brand-hover: #34a2ce;
    --brand-light: #e0f2fe;
    
    --border-light: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --status-success: #10b981;
    --status-error: #ef4444;
    --status-warning: #f59e0b;

    /* Spacing & Radius */
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;

    --sidebar-width: 260px;
    --sidebar-width-collapsed: 72px;
    --header-height: 64px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow-premium: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Legacy Var Mappings for backward compatibility */
    --text-main: var(--text-primary);
    --accent-color: var(--brand-primary);
    --accent-hover: var(--brand-hover);
    --danger-color: var(--status-error);
    --border-color: var(--border-light);
}

html.theme-dark {
    color-scheme: dark;
    --bg-main: #0b1220;
    --bg-sidebar: #101a2c;
    --bg-card: #111d33;
    --bg-surface: #15213a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    --brand-primary: #38bdf8;
    --brand-hover: #0ea5e9;
    --brand-light: #082f49;
    --border-light: #2a3a57;
    --border-hover: #3a4d72;
    --border-color: #2a3a57;
    --shadow-premium: 0 12px 28px -16px rgba(0, 0, 0, 0.55);
    --shadow-md: 0 10px 20px -12px rgba(0, 0, 0, 0.6);
}

/* Light Theme as Baseline */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-main);
    background-image: none !important;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Auth Cloak - Enterprise Style Loader */
#auth-cloak {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s var(--transition);
}

#auth-cloak .loader-content {
    text-align: center;
    animation: cloak-reveal 0.8s ease-out;
}

#auth-cloak i {
    font-size: 3.5rem;
    color: var(--brand-primary);
    margin-bottom: 1.5rem;
    display: block;
    animation: logo-pulse 2s infinite ease-in-out;
}

@keyframes logo-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

#auth-cloak h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.loader-bar {
    width: 200px;
    height: 3px;
    background: var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto;
    position: relative;
}

.loader-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--brand-primary);
    animation: cloak-progress 1.5s infinite ease-in-out;
}

@keyframes cloak-progress { to { left: 100%; } }
@keyframes cloak-reveal {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Course Designer Modal - Enterprise Style */
.designer-modal-container {
    background: #ffffff !important;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    overflow: hidden;
}

.designer-layout {
    display: flex;
    height: 100vh;
}

.designer-sidebar {
    width: 400px;
    background: var(--bg-main) !important;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.designer-header {
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.designer-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.designer-tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 0;
    margin-right: 1.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.designer-tab-btn.active {
    color: var(--brand-primary) !important;
    border-bottom: 2px solid var(--brand-primary) !important;
}

.designer-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-premium);
}

.units-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.units-add-sticky {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    padding: 1rem 0;
    background: linear-gradient(to top, #ffffff 80%, rgba(255, 255, 255, 0));
}

.units-format-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
}

.unit-format-btn, .unit-content-image-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem !important;
    font-size: 0.75rem !important;
    border-radius: var(--radius-sm);
    background: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-premium) !important;
}

.unit-format-btn:hover {
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary) !important;
}

.unit-content-body {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.designer-preview-pane {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main) !important;
    background-image: radial-gradient(var(--border-light) 1px, transparent 1px) !important;
    background-size: 20px 20px !important;
}

.designer-preview-pane .preview-topbar {
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    padding: 10px 20px;
    z-index: 10;
    font-size: 12px;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.designer-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
    background: #ffffff;
    flex-shrink: 0;
}

.modal-close-btn {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.modal-close-btn:hover {
    background: var(--bg-main);
    color: var(--status-error);
    border-color: var(--status-error);
}

body:not(.auth-resolved) {
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-speed);
}

ul {
    list-style: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

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

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0;
    transition: margin-left 0.4s var(--transition);
    display: flex;
    flex-direction: column;
}

.main-menu:hover + .main-content {
    margin-left: var(--sidebar-width);
}

.padded-container {
    padding: 40px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar Component - enterprise light */

/* Sidebar (Main Menu) */
.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    box-shadow: none;
    z-index: 1000;
    transition: width 0.3s var(--transition);
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.main-menu:hover {
    width: var(--sidebar-width);
}

.main-menu.collapsed {
    width: var(--sidebar-width-collapsed);
}

.main-menu.collapsed + .main-content {
    margin-left: var(--sidebar-width-collapsed);
}

.main-menu.collapsed:hover {
    width: var(--sidebar-width-collapsed);
}

.main-menu.collapsed:hover + .main-content {
    margin-left: var(--sidebar-width-collapsed);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: var(--header-height);
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    transition: all 0.3s var(--transition);
}

.sidebar-toggle-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.main-menu.collapsed .sidebar-toggle-btn {
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
}

.sidebar-logo i {
    font-size: 24px;
    color: var(--brand-primary);
    transition: transform 0.3s var(--transition);
}

.main-menu:hover .sidebar-logo i {
    transform: scale(1.1);
}

.main-menu ul {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    flex: 1;
}

.main-menu li {
    width: 100%;
}

.main-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.925rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
}

.main-menu a:hover {
    color: var(--text-primary);
    background-color: var(--bg-main);
}

.main-menu li.active a {
    background-color: var(--brand-light);
    color: var(--brand-primary);
    box-shadow: inset 0 0 0 1px rgba(60, 180, 229, 0.1), 0 0 15px rgba(60, 180, 229, 0.08);
}

.main-menu li.active a .nav-icon {
    color: var(--brand-primary);
    opacity: 1;
}

.nav-icon {
    width: 18px;
    height: 18px;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.main-menu.collapsed a {
    padding: 0.75rem 0;
    justify-content: center;
}

.nav-text {
    opacity: 1;
    transition: opacity 0.3s var(--transition);
}

.main-menu.collapsed .nav-text {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.nav-icon.completed {
    color: #00c864;
}

/* Course Focus Mode */
.main-menu.focus-mode li:not(.course-link):not(.role-nav-item):not(.exit-link) {
    display: none;
}

/* Ensure Dashboard and Courses links remain as exits */
.main-menu.focus-mode li.exit-link {
    display: block !important;
}

.main-menu.focus-mode .sidebar-profile {
    display: flex !important;
}

/* Custom class for course pages to highlight active course nav */
.course-link i {
    color: var(--accent-color);
}


/* Header & Typography */
header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1.5rem;
}

.main-content>header {
    padding: 40px 40px 20px;
}

h1, h2, h3 {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }

p, .text-muted {
    color: var(--text-secondary);
}

/* Cards & Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* UI Shared Components */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-speed);
}

.card, .glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* Card Hover Shared */
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-primary);
}

/* Layout Components */


/* Enterprise UI Buttons */
/* UI Elements: Buttons */
.btn {
    background: var(--brand-primary);
    color: #ffffff;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-premium);
}

.btn:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--border-light);
    border-color: var(--border-hover);
}

/* UI Elements: Inputs */
input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(60, 180, 229, 0.1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Loading States */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading::after {
    content: "";
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Section Specifics */
.dashboard-section {
    margin-bottom: 3rem;
}

.section-title {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-title h3 {
    text-transform: none;
    letter-spacing: normal;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

/* Forum & Messaging Components */
.forum-container {
    display: flex;
    gap: 1.5rem;
    height: calc(100vh - 180px);
}

.topics-section, .messages-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-premium);
}

.topic-item {
    background: var(--bg-main);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.topic-item:hover, .topic-item.active {
    background: var(--brand-light);
    border-color: var(--brand-primary);
}

.topic-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.topic-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.message-item {
    background: var(--bg-main);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    border: 1px solid var(--border-light);
}


.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.message-username {
    color: var(--accent-color);
    font-weight: 600;
}

.message-text {
    line-height: 1.6;
    color: var(--text-primary);
}

/* Layout Utilities */
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding-bottom: 80px;
        /* Space for bottom nav */
    }

    .main-menu {
        width: 100%;
        height: auto;
        bottom: 0;
        top: auto;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 0;
    }

    .main-menu:hover {
        width: 100%;
    }

    .main-menu ul {
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        margin: 0;
    }

    .nav-text {
        display: none;
        /* Hide text on mobile for bottom bar style */
    }

    .nav-icon {
        margin: 0;
    }

    .main-menu a {
        padding: 15px;
        flex-direction: column;
        border-left: none;
        border-top: 3px solid transparent;
    }

    .main-menu a:hover,
    .main-menu li.active a {
        border-left: none;
        border-top-color: var(--accent-color);
    }

    /* Forum Mobile */
    .forum-container {
        flex-direction: column;
        height: auto;
    }

    .topics-section,
    .messages-section {
        min-height: 400px;
    }

    .messages-section {
        display: none;
        /* Hide by default on mobile until topic selected */
    }

    .messages-section.active {
        display: flex;
    }

    .topics-section.hidden {
        display: none;
    }
}

/* User Role Labels */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--accent-color), #00d2ff);
    color: white;
    box-shadow: 0 4px 15px rgba(77, 166, 255, 0.4);
    margin-top: 4px;
    transition: all 0.4s var(--transition);
    white-space: nowrap;
}

.role-badge.role-admin, 
.role-badge.role-superadmin {
    background: linear-gradient(135deg, #ff4d4d, #f1c40f);
    box-shadow: 0 4px 15px rgba(255, 77, 77, 0.4);
}

.role-badge.role-quality {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.role-badge.role-trainer {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

/* Sidebar Profile Section Enhancement */
.sidebar-profile {
    padding: 1.5rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    margin-top: auto;
    transition: all 0.4s var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 90px;
    position: relative;
}

.main-menu.collapsed .sidebar-profile {
    /* Existing rules keep */
    padding: 1.5rem 0.75rem;
    align-items: center;
}

.user-profile-compact {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    width: 100%;
    overflow: visible; /* Always visible to let shadows breathe */
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, var(--accent-color), #00d2ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 16px;
    box-shadow: 0 0 15px rgba(77, 166, 255, 0.4);
    transition: all 0.4s var(--transition);
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.logout-container {
    width: 100%;
    margin-top: 0.5rem;
}

.main-menu.collapsed .logout-container {
    display: none;
}

.main-menu.collapsed .profile-popup-menu.active {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(10px) !important;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.3s var(--transition);
}

.user-profile-trigger:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Profile Popup Menu */
.profile-popup-menu {
    position: absolute;
    bottom: 80px;
    left: 20px;
    width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s var(--transition);
    z-index: 2000;
}

.profile-popup-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    background: var(--brand-primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.popup-user-info {
    display: flex;
    flex-direction: column;
}

.popup-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.popup-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.popup-divider {
    height: 1px;
    background: var(--border-light);
    margin: 8px 0;
}

.popup-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all 0.2s;
    text-decoration: none;
}

.popup-item i {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.popup-item:hover {
    background: var(--bg-main);
    color: var(--brand-primary);
}

.popup-item.logout {
    color: var(--status-error);
}

.popup-item.logout:hover {
    background: #fef2f2;
}

.main-menu.collapsed .user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 16px;
}

.main-menu.collapsed .role-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    min-width: 12px;
    padding: 0;
    border-radius: 50%;
    box-shadow: 0 0 15px currentColor;
    color: transparent;
    font-size: 0;
    border: 2px solid #1a1a1a;
    overflow: visible;
}

.nav-text {
    opacity: 1;
    transition: all 0.4s var(--transition);
    white-space: nowrap;
    flex: 1;
    max-width: 200px;
}

.main-menu.collapsed .nav-text {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
    visibility: hidden;
    margin: 0;
}

.user-info {
    transition: all 0.4s var(--transition);
    font-weight: 600;
    white-space: nowrap;
    opacity: 1;
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 65px;
    pointer-events: none;
    max-width: 150px;
}

.main-menu.collapsed .user-info {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
    visibility: hidden;
    overflow: hidden;
    left: 80px; /* Slide out transition */
}

.error {
    color: var(--danger-color);
    background: rgba(255, 77, 77, 0.1);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--danger-color);
    margin: 10px 0;
    text-align: center;
}

/* Page Loader Transition */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s var(--transition);
}

.page-loader.active {
    opacity: 1;
    visibility: visible;
}

.page-loader .loader-content {
    text-align: center;
    animation: cloak-reveal 0.8s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes logo-pulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

@keyframes loader-progress {
    to {
        left: 100%;
    }
}

/* Custom Notifications */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification {
    min-width: 300px;
    max-width: 450px;
    padding: 16px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    animation: slideIn 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
    transition: all 0.3s var(--transition);
}

.notification i {
    font-size: 20px;
}

.notification.success i { color: #2ecc71; }
.notification.error i { color: var(--danger-color); }
.notification.info i { color: var(--accent-color); }

.notification.fade-out {
    opacity: 0;
    transform: translateX(50px);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Custom Confirm Modal */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

.confirm-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    animation: modalPop 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

.confirm-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-main);
}

.confirm-message {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 25px;
}

.confirm-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@keyframes fadeIn { to { opacity: 1; } }
@keyframes modalPop { to { transform: scale(1); } }

/* Break System Oversight Refinements */
.counter-badge {
    background: var(--accent-color);
    color: #121212;
    font-size: 0.95rem;
    font-weight: 800;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0 8px;
    box-shadow: 0 0 15px rgba(77, 166, 255, 0.4);
    animation: counter-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes counter-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#team-cards-container.grid-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 25px !important;
    width: 100%;
}

@media (min-width: 1400px) {
    #team-cards-container.grid-container {
        grid-template-columns: repeat(auto-fill, minmax(calc(25% - 20px), 1fr)) !important;
    }
}

.team-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
    transition: all 0.2s var(--transition);
    box-shadow: var(--shadow-premium);
}

.team-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.team-card .user-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 15px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    overflow: hidden !important;
}

.team-card .user-avatar {
    width: 48px !important;
    height: 48px !important;
    background: linear-gradient(135deg, #aaddff, #4da6ff) !important;
    color: #000 !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 800 !important;
    font-size: 1.3rem !important;
    flex-shrink: 0 !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
}

.team-card .user-info {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    position: relative !important;   /* Neutralize global absolute */
    left: auto !important;           /* Neutralize global offset */
    pointer-events: auto !important; /* Neutralize global disable */
    max-width: none !important;      /* Neutralize global limit */
}

.team-card .user-info h4 {
    font-size: 1.1rem !important;
    margin: 0 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-weight: 700 !important;
}

.team-card .user-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.team-card .status-pill {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 15px;
    width: fit-content;
}

.status-pill.available { background: rgba(255, 255, 255, 0.1); color: var(--text-main); }
.status-pill.active { background: #00c864; color: #121212; box-shadow: 0 0 10px rgba(0, 200, 100, 0.3); }
.status-pill.pending { background: var(--accent-color); color: #121212; box-shadow: 0 0 10px rgba(77, 166, 255, 0.3); }
.status-pill.approved { background: #f1c40f; color: #121212; }

.team-card .break-info {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-card .stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.team-card .stat-row strong {
    color: var(--text-main);
}

.team-card .actions {
    margin-top: 20px;
    display: flex;
    gap: 15px; /* Increased gap */
}

.team-card .btn-secondary, 
.team-card .btn-danger {
    padding: 10px 18px !important; /* Larger buttons */
    font-weight: 600;
}

/* Exit Button Resizing */
.exit-link, .btn-exit {
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
    min-width: 80px;
    justify-content: center;
}

/* Exam Checkbox Left Alignment */
.exam-checkbox-container {
    display: flex;
    align-items: center;
    justify-content: flex-start !important; /* Left aligned */
    gap: 10px;
}

/* Edit Course Title Padding */
.edit-course-header h2 {
    padding: 20px 0 !important;
}

/* Published Content Button Size */
.btn-published-content {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

/* Profile Popup Menu */
.profile-popup-menu {
    position: absolute;
    bottom: 80px;
    left: 20px;
    width: 220px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    padding: 15px;
    z-index: 9999; /* Higher than sidebar (1000) */
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.profile-popup-menu.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.popup-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.popup-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-role {
    font-size: 0.75rem;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.popup-divider {
    height: 1px;
    background: var(--border-color);
    margin: 10px 0;
}

.popup-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.2s;
    text-decoration: none;
}

.popup-item i {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.popup-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.popup-item.logout {
    color: var(--danger-color);
}

.popup-item.logout:hover {
    background: rgba(255, 77, 77, 0.1);
}

/* Accessibility: Focus Outlines for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(77, 166, 255, 0.25);
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transform: none !important;
    }

    .main-menu:hover .sidebar-logo i {
        transform: none !important;
    }

    .card:hover {
        transform: none !important;
    }

    .btn:hover {
        transform: none !important;
    }

    .unit-format-btn:hover {
        transform: none !important;
    }

    .modal-close-btn:hover {
        transform: none !important;
    }

    .team-card:hover {
        transform: none !important;
    }

    .user-profile-trigger:hover {
        transform: none !important;
    }

    .popup-item:hover {
        transform: none !important;
    }
}


