:root {
    /* Premium Color Palette - Modern & Harmonious */
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --secondary: #8b5cf6;
    --accent: #f43f5e;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Backgrounds - Default Dark Mode */
    --bg-main: #0b0f1a;
    --bg-card: rgba(30, 41, 59, 0.4);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-heavy: rgba(255, 255, 255, 0.08);

    /* Text - Default Dark Mode */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Borders & Depth */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

    /* Spacing & Radius */
    --radius-sm: 0.5rem;
    --radius: 0.875rem;
    --radius-lg: 1.25rem;
    --radius-full: 9999px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --bg-glass: rgba(0, 0, 0, 0.02);
    --bg-glass-heavy: rgba(0, 0, 0, 0.05);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);

    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.22);
}

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

/* Scrollbar refinement - Sleek & Subtle */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Global scrollbar hiding as requested for specific containers */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Glassmorphism Core */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.glass-hover:hover {
    background: var(--bg-glass-heavy);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-slide-in {
    animation: slideIn 0.5s ease-out forwards;
}

/* Layout Components */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1500px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 768px) {
    .main-content {
        padding: 3rem;
    }
}

/* Typography Fluidity */
h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: white;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: white;
}

p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    gap: 0.625rem;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

.btn-outline {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-glass-heavy);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Modern Data Tables */
.table-container {
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top: 2rem;
}

.table-responsive {
    overflow-x: auto;
    scrollbar-width: thin;
}

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

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table td {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
}

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

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

/* Premium Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 1rem;
}

.modal-content {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.6);
    animation: modalScale 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    overflow: hidden;
}

@keyframes modalScale {
    from {
        transform: scale(0.9) translateY(40px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
}

.modal-body::-webkit-scrollbar {
    display: none;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 1.25rem;
}

/* Forms - Refined */
.form-group {
    margin-bottom: 1.75rem;
}

.form-label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
}

/* Utilities */
.d-none {
    display: none !important;
}

@media (min-width: 992px) {
    .d-lg-block {
        display: block !important;
    }

    .d-lg-flex {
        display: flex !important;
    }

    .d-lg-none {
        display: none !important;
    }
}

.text-gradient {
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Responsive Grid Helper */
.grid-responsive {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Blazor Error UI - Premium Styling */
#blazor-error-ui {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 2px solid var(--error);
    bottom: 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
    color: var(--text-primary);
    font-weight: 500;
    animation: errorSlideIn 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

#blazor-error-ui .reload {
    margin-left: 1rem;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    background: rgba(99, 102, 241, 0.1);
    padding: 0.4rem 1rem;
    border-radius: 8px;
    transition: all 0.2s;
}

#blazor-error-ui .reload:hover {
    background: var(--primary);
    color: white;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

#blazor-error-ui .dismiss:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

@keyframes errorSlideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =======================================================================
   Premium SaaS Dashboard Layout & Left Sidebar Styles
   ======================================================================= */

/* Color Theme Tokens for Left Sidebar */
:root {
    --bg-sidebar: rgba(15, 23, 42, 0.6);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-link-hover: rgba(255, 255, 255, 0.04);
    --submenu-connector: rgba(255, 255, 255, 0.1);
    --bg-sidebar-mobile: #0f172a;
    --sidebar-border-mobile: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
    --bg-sidebar: rgba(255, 255, 255, 0.7);
    --sidebar-border: rgba(0, 0, 0, 0.06);
    --sidebar-text: #475569;
    --sidebar-text-active: #0f172a;
    --sidebar-link-hover: rgba(0, 0, 0, 0.03);
    --submenu-connector: rgba(0, 0, 0, 0.06);
    --bg-sidebar-mobile: #ffffff;
    --sidebar-border-mobile: rgba(0, 0, 0, 0.08);
}

/* Dashboard wrapper with floating double-pane layout */
.app-dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--bg-main);
    transition: var(--transition);
}

@media (min-width: 992px) {
    .app-dashboard-wrapper {
        padding: 1.25rem;
        gap: 1.25rem;
        height: 100vh;
    }
}

/* Floating left sidebar wrapper */
.sidebar-wrapper {
    width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .sidebar-wrapper {
        height: calc(100vh - 2.5rem);
    }
    .sidebar-wrapper.collapsed {
        width: 80px;
    }
}

/* Sidebar core container glass styling */
.sidebar-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    background: var(--bg-sidebar);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.35s, box-shadow 0.35s, border-color 0.35s;
    overflow: hidden;
    position: relative;
}

@media (min-width: 992px) {
    .sidebar-container {
        border-radius: 20px;
        border: 1px solid var(--sidebar-border);
        box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
    }
}

/* Zero Layout Shift Hover Overlay Expansion */
@media (min-width: 992px) {
    .sidebar-wrapper.collapsed:hover .sidebar-container {
        width: 260px;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 2000;
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
        background: var(--bg-sidebar);
        border-color: rgba(99, 102, 241, 0.35);
    }
    
    [data-theme="dark"] .sidebar-wrapper.collapsed:hover .sidebar-container {
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15);
    }
}

/* Brand / Logo Header */
.sidebar-header {
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    overflow: hidden;
    transition: padding 0.3s;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-logo:hover .logo-icon {
    transform: rotate(10deg) scale(1.08);
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: opacity 0.25s ease, max-width 0.25s ease;
    white-space: nowrap;
    opacity: 1;
    max-width: 150px;
}

.sidebar-toggle-btn {
    background: var(--sidebar-link-hover);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    outline: none;
}

.sidebar-toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.08);
}

/* Sidebar Nav Scrollbar styling */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Navigation Menu Links and buttons */
.sidebar-link, .sidebar-item-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 12px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    position: relative;
    transition: var(--transition);
    outline: none;
}

/* Glowing Indicator animation */
.sidebar-link::before, .sidebar-item-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 0 4px 4px 0;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-link:hover::before, .sidebar-item-btn:hover::before {
    height: 55%;
}

.sidebar-link:hover, .sidebar-item-btn:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-link-hover);
    transform: translateX(2px);
}

/* Active Menu Link */
.sidebar-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    color: var(--sidebar-text-active);
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.08);
}

.sidebar-link.active::before {
    height: 70%;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    box-shadow: 0 0 10px var(--primary-glow);
}

.sidebar-item-group.child-active > .sidebar-item-btn {
    color: var(--sidebar-text-active);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-item-icon {
    font-size: 1.15rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-item-text {
    flex: 1;
    white-space: nowrap;
    opacity: 1;
    max-width: 150px;
    transition: opacity 0.25s ease, max-width 0.25s ease, visibility 0.25s;
    display: inline-block;
}

.sidebar-item-arrow {
    font-size: 0.75rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    color: var(--text-muted);
}

.sidebar-item-group.expanded .sidebar-item-arrow {
    transform: rotate(180deg);
    color: var(--sidebar-text-active);
}

/* Accordion nested Submenus and connect lines */
.sidebar-submenu-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-submenu-wrapper.expanded {
    grid-template-rows: 1fr;
}

.sidebar-submenu-inner {
    overflow: hidden;
}

.sidebar-submenu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-left: 2rem;
    border-left: 1px dashed var(--submenu-connector);
    padding-left: 0.75rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    transition: border-color 0.3s;
}

.sidebar-item-group.child-active .sidebar-submenu {
    border-left-color: rgba(99, 102, 241, 0.35);
}

.sidebar-submenu .sidebar-link {
    padding: 0.6rem 0.85rem 0.6rem 1.25rem;
    font-size: 0.86rem;
    background: transparent;
    opacity: 0.85;
    font-weight: 500;
}

.sidebar-submenu .sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--submenu-connector);
    transition: var(--transition);
}

.sidebar-submenu .sidebar-link:hover {
    opacity: 1;
    background: var(--sidebar-link-hover);
}

.sidebar-submenu .sidebar-link:hover::before {
    background: var(--primary);
    box-shadow: 0 0 6px var(--primary-glow);
    transform: translateY(-50%) scale(1.3);
    height: 5px;
}

.sidebar-submenu .sidebar-link.active {
    opacity: 1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.15);
    box-shadow: none;
}

.sidebar-submenu .sidebar-link.active::before {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
    transform: translateY(-50%) scale(1.3);
    height: 5px;
}

/* Badges for Notifications count */
.sidebar-item-badge {
    background: linear-gradient(135deg, var(--accent), #ff6b8b);
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(244, 63, 94, 0.3);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-link:hover .sidebar-item-badge {
    transform: scale(1.08);
}

/* Sidebar user card profile details footer */
.sidebar-footer {
    padding: 1.25rem 0.75rem;
    border-top: 1px solid var(--sidebar-border);
    overflow: hidden;
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--sidebar-border);
    transition: var(--transition);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

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

.user-avatar-glow {
    position: relative;
    flex-shrink: 0;
    padding: 2px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    transition: var(--transition);
}

.user-avatar-glow::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 14px;
    z-index: -1;
    opacity: 0.3;
    filter: blur(8px);
    transition: opacity 0.3s;
}

.user-profile-card:hover .user-avatar-glow::after {
    opacity: 0.7;
}

.user-avatar-main {
    width: 34px;
    height: 34px;
    background: #0f172a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 1rem;
}

.user-profile-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    transition: opacity 0.25s ease, max-width 0.25s ease;
    max-width: 120px;
}

.user-profile-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-profile-role {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-logout-btn {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--error);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    outline: none;
}

.sidebar-logout-btn:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Main Viewport Container */
.app-main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition);
}

@media (min-width: 992px) {
    .app-main-container {
        background: var(--bg-card);
        border: 1px solid var(--border);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        border-radius: 20px;
        height: calc(100vh - 2.5rem);
        overflow: hidden;
        box-shadow: var(--shadow-lg);
    }

    .app-main-container .main-content {
        overflow-y: auto;
        min-height: 0;
    }
}

/* Desktop Collapsed Toggle visibility control */
@media (min-width: 992px) {
    .sidebar-wrapper.collapsed:not(:hover) .brand-text {
        opacity: 0;
        max-width: 0;
        visibility: hidden;
    }
    
    .sidebar-wrapper.collapsed:not(:hover) .sidebar-item-text {
        opacity: 0;
        max-width: 0;
        visibility: hidden;
    }
    
    .sidebar-wrapper.collapsed:not(:hover) .sidebar-toggle-btn {
        display: none !important;
    }

    .sidebar-wrapper.collapsed:not(:hover) .sidebar-item-arrow {
        opacity: 0;
        visibility: hidden;
    }

    .sidebar-wrapper.collapsed:not(:hover) .sidebar-item-badge {
        display: none !important;
    }
    
    .sidebar-wrapper.collapsed:not(:hover) .user-profile-details {
        opacity: 0;
        max-width: 0;
        visibility: hidden;
    }

    .sidebar-wrapper.collapsed:not(:hover) .sidebar-logout-btn {
        display: none !important;
    }

    .sidebar-wrapper.collapsed:not(:hover) .sidebar-header {
        justify-content: center;
        padding: 0;
    }

    .sidebar-wrapper.collapsed:not(:hover) .user-profile-card {
        justify-content: center;
        padding: 0.4rem;
        background: transparent;
        border-color: transparent;
    }

    .sidebar-wrapper.collapsed:not(:hover) .sidebar-submenu-wrapper {
        display: none !important;
    }
}

/* Top Header */
.app-top-header {
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 900;
}

@media (min-width: 992px) {
    .app-top-header {
        border-bottom-color: var(--border);
        background: rgba(30, 41, 59, 0.1);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.menu-toggle {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
    outline: none;
}

.menu-toggle:hover {
    background: var(--bg-glass-heavy);
    border-color: var(--primary);
    transform: scale(1.03);
}

.header-page-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.welcome-text {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-brand-mobile {
    font-weight: 900;
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-icons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.nav-icon-btn {
    position: relative;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transition: var(--transition);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    outline: none;
}

.nav-icon-btn:hover {
    background: var(--bg-glass-heavy);
    color: var(--text-primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.nav-icon-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent);
    color: white;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    border-radius: 6px;
    border: 2px solid var(--bg-main);
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.4);
}

.lang-btn {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.25);
}

.lang-btn:hover {
    color: white;
    background: var(--primary);
}

/* Mobile responsive drawer overlay backdrop */
@media (max-width: 991.98px) {
    .sidebar-wrapper {
        width: 0 !important;
        height: 0 !important;
        position: absolute;
        z-index: 5000 !important;
    }

    .sidebar-container {
        position: fixed;
        left: -280px;
        top: 0;
        width: 270px;
        height: 100vh;
        z-index: 5000;
        box-shadow: none;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        transform: none !important;
        background: var(--bg-sidebar-mobile) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--sidebar-border-mobile) !important;
    }
    
    .sidebar-wrapper.drawer-open .sidebar-container {
        left: 0 !important;
        transform: none !important;
        box-shadow: 15px 0 50px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar-toggle-btn {
        display: none !important;
    }
    
    .sidebar-wrapper.collapsed .sidebar-container {
        width: 270px;
    }

    .sidebar-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 4000;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        animation: fadeInBackdrop 0.3s ease;
    }

    .app-top-header {
        padding: 0 1.25rem;
        background: var(--bg-sidebar-mobile) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-bottom: 1px solid var(--border) !important;
    }
}

@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Global Toast Notifications positioning & wrapper styling */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 9999;
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    min-width: 300px;
    max-width: 400px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toast-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.notif .toast-icon {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.chat .toast-icon {
    color: var(--secondary);
    background: rgba(139, 92, 246, 0.1);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: white;
    margin: 0 0 0.25rem;
}

.toast-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.8rem;
}

.toast-close:hover {
    color: white;
}

.animate-slide-in {
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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