/**
 * Professional Sidebar Styling
 * Custom sidebar design with modern gradients and effects
 * Maintains original sizes and dimensions
 */

/* Fix page shaking/jitter issues */
html {
    overflow-y: scroll !important;
    scroll-behavior: auto !important;
}

body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Disable all animations and transitions globally */
*,
*::before,
*::after {
    animation: none !important;
    transition: none !important;
    -webkit-animation: none !important;
    -moz-animation: none !important;
    -o-animation: none !important;
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -o-transition: none !important;
}

/* Fix main content area */
.main-content {
    transition: none !important;
    transform: none !important;
    animation: none !important;
}

/* Fix main wrapper */
.main-wrapper {
    transition: none !important;
    transform: none !important;
    animation: none !important;
    overflow-x: hidden !important;
}

/* Disable all animations and transitions globally for sidebar */
.main-sidebar,
.main-sidebar *,
.main-sidebar *::before,
.main-sidebar *::after {
    animation: none !important;
    transition: none !important;
}

/* Main Sidebar Container */
.main-sidebar {
    background: linear-gradient(180deg, #1a1c23 0%, #2d3142 100%) !important;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 880;
}

/* Sidebar wrapper stays fixed */
#sidebar-wrapper {
    position: sticky;
    top: 0;
}

/* Sidebar Scrollbar */
.main-sidebar::-webkit-scrollbar {
    width: 6px;
}

.main-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.main-sidebar::-webkit-scrollbar-thumb {
    background: rgba(103, 119, 239, 0.5);
    border-radius: 3px;
}

.main-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(103, 119, 239, 0.8);
}

/* Sidebar Brand/Logo */
.main-sidebar .sidebar-brand {
    background: linear-gradient(135deg, #6777ef 0%, #4e5cd9 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.main-sidebar .sidebar-brand::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.main-sidebar .sidebar-brand:hover::before {
    left: 100%;
}

.main-sidebar .sidebar-brand a {
    color: #ffffff !important;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Menu Header */
.main-sidebar .sidebar-menu li.menu-header {
    color: rgba(255, 255, 255, 0.4) !important;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding-top: 15px !important;
    padding-bottom: 8px !important;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.main-sidebar .sidebar-menu li.menu-header:first-child {
    border-top: none;
    margin-top: 0;
}

/* Menu Items */
.main-sidebar .sidebar-menu li a {
    color: rgba(255, 255, 255, 0.7) !important;
    border: none !important;
    margin: 2px 10px;
    border-radius: 6px;
    position: relative;
    transition: none !important;
    animation: none !important;
}

.main-sidebar .sidebar-menu li a i {
    color: rgba(255, 255, 255, 0.5);
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
    transition: none !important;
    animation: none !important;
    transform: none !important;
    font-size: 16px;
}

.main-sidebar .sidebar-menu li a:hover {
    background: rgba(103, 119, 239, 0.15) !important;
    color: #ffffff !important;
}

.main-sidebar .sidebar-menu li a:hover i {
    color: #6777ef !important;
}

/* Active Menu Item */
.main-sidebar .sidebar-menu li.active > a {
    background: linear-gradient(135deg, #6777ef 0%, #5563e0 100%) !important;
    color: #ffffff !important;
    font-weight: 600;
    border: none !important;
    box-shadow: 0 4px 15px rgba(103, 119, 239, 0.35);
}

.main-sidebar .sidebar-menu li.active > a i {
    color: #ffffff !important;
}

/* Dropdown Arrow */
.main-sidebar .sidebar-menu li a.has-dropdown:after {
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.main-sidebar .sidebar-menu li a.has-dropdown:hover:after {
    color: #ffffff;
}

.main-sidebar .sidebar-menu li.active a.has-dropdown:after {
    color: #ffffff;
}

/* Dropdown Menu */
.main-sidebar .sidebar-menu li ul.dropdown-menu {
    background: #1e2130 !important;
    border-radius: 0 0 8px 8px;
    margin: 0 10px;
    padding: 5px 0 !important;
    border-left: none !important;
    border: none !important;
}

/* Show dropdown when parent is active (clicked) */
.main-sidebar .sidebar-menu li.active > ul.dropdown-menu {
    display: block !important;
    background: #1e2130 !important;
}

.main-sidebar .sidebar-menu li ul.dropdown-menu li a {
    color: rgba(255, 255, 255, 0.7) !important;
    background: transparent !important;
    margin: 0;
    border-radius: 0;
    border-left: none !important;
    border: none !important;
    padding-left: 55px !important;
    position: relative;
}

.main-sidebar .sidebar-menu li ul.dropdown-menu li a::after {
    content: '';
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.main-sidebar .sidebar-menu li ul.dropdown-menu li a:hover {
    color: #6777ef !important;
    background: rgba(103, 119, 239, 0.1) !important;
    transform: translateX(0);
}

.main-sidebar .sidebar-menu li ul.dropdown-menu li a:hover::after {
    background: #6777ef;
    box-shadow: 0 0 8px rgba(103, 119, 239, 0.6);
}

.main-sidebar .sidebar-menu li ul.dropdown-menu li.active > a {
    color: #6777ef !important;
    background: rgba(103, 119, 239, 0.15) !important;
    font-weight: 600;
    box-shadow: none;
}

.main-sidebar .sidebar-menu li ul.dropdown-menu li.active > a::after {
    background: #6777ef;
    box-shadow: 0 0 8px rgba(103, 119, 239, 0.6);
}

/* Badge Styling */
.main-sidebar .sidebar-menu li a .badge {
    background: linear-gradient(135deg, #fc544b 0%, #e53e3e 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(252, 84, 75, 0.4);
}

/* Active Dropdown Background */
.main-sidebar .sidebar-menu li.active ul.dropdown-menu {
    background: rgba(0, 0, 0, 0.25) !important;
}

/* Sidebar Mini Mode Adjustments */
body.sidebar-mini .main-sidebar {
    background: linear-gradient(180deg, #1a1c23 0%, #2d3142 100%) !important;
}

body.sidebar-mini .main-sidebar:after {
    background: linear-gradient(180deg, #1a1c23 0%, #2d3142 100%) !important;
}

body.sidebar-mini .main-sidebar .sidebar-menu > li.active > a {
    background: linear-gradient(135deg, #6777ef 0%, #5563e0 100%) !important;
    box-shadow: 0 4px 15px rgba(103, 119, 239, 0.4);
}

body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu {
    background: #2d3142 !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
}

body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu li a {
    color: rgba(255, 255, 255, 0.7) !important;
    padding-left: 20px !important;
}

body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu li a::after {
    left: 8px;
}

body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu li > a:focus,
body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu li.active > a,
body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu li.active > a:hover {
    background: linear-gradient(135deg, #6777ef 0%, #5563e0 100%) !important;
    color: #fff !important;
}

body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu li a:hover {
    background: rgba(103, 119, 239, 0.15) !important;
    color: #6777ef !important;
}

/* Tooltip for Mini Sidebar */
body.sidebar-mini .main-sidebar .sidebar-menu > li > a:hover {
    background: rgba(103, 119, 239, 0.2) !important;
}

/* User section in sidebar if exists */
.main-sidebar .sidebar-user {
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.main-sidebar .sidebar-user .sidebar-user-details .user-name {
    color: #ffffff !important;
}

.main-sidebar .sidebar-user .sidebar-user-details .user-role {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* RTL Support */
[dir="rtl"] .main-sidebar .sidebar-menu li a {
    border-left: none;
    border-right: 3px solid transparent;
}

[dir="rtl"] .main-sidebar .sidebar-menu li a:hover {
    border-right-color: #6777ef;
    transform: translateX(-3px);
}

[dir="rtl"] .main-sidebar .sidebar-menu li.active > a {
    border-left-color: transparent;
    border-right-color: #fff;
}

[dir="rtl"] .main-sidebar .sidebar-menu li ul.dropdown-menu {
    border-left: none;
    border-right: 2px solid rgba(103, 119, 239, 0.3);
}

[dir="rtl"] .main-sidebar .sidebar-menu li ul.dropdown-menu li a::after {
    left: auto;
    right: 35px;
}

[dir="rtl"] body.sidebar-mini .main-sidebar .sidebar-menu > li ul.dropdown-menu li a::after {
    left: auto;
    right: 8px;
}

/* Section body spacing when no section-header */
.section > .section-body:first-child {
    padding-top: 50px;
}

/* Hide section-header and move title to navbar */
.section-header {
    display: none !important;
}

/* Adjust section-body spacing - add more top margin */
.section .section-body {
    margin-top: 40px !important;
}

/* When section-body is right after hidden section-header */
.section-header + .section-body {
    margin-top: 50px !important;
}
