/* Sidebar Container */
.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
}


/* Mobile State */
body[data-rds-mode="mobile"] .sidebar,
body[data-rds-mode="tablet"] .sidebar {
    position: fixed;
    z-index: 200;
    height: calc(100dvh - 60px);
    top: 60px;
    left: -320px;
}

/* Mini Rail State */
.sidebar.mini {
    width: 76px;
}

/* Mobile Open State */
body[data-rds-mode="mobile"] .sidebar.open,
body[data-rds-mode="tablet"] .sidebar.open {
    left: 0;
}

/* Global Tooltip for Mini Sidebar (Escapes overflow-y clip) */
.sidebar-global-tooltip {
    position: fixed;
    transform: translateY(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.1s ease, transform 0.1s ease;
}

.sidebar-global-tooltip.hidden {
    display: none;
}

/* Tooltip Arrow */
.sidebar-global-tooltip::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 6px 5px 0;
    border-style: solid;
    border-color: transparent var(--bg-primary) transparent transparent;
    pointer-events: none;
}

/* Sidebar Top */
.sidebar-top {
    flex: 1;
    min-height: 100px;
    width: 100%;
    display: flex;
    overflow-y: auto;
}

/* Sidebar Bottom */
.sidebar-btm {
    width: 100%;
    display: flex;
}

/* Sidebar Top Menu */
.sidebar-top-menu-container {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    list-style: none;
    padding: 10px;
}

/* Sidebar Bottom Menu */
.sidebar-btm-menu-container {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 3px;
    list-style: none;
    padding: 10px;
}

/* Sidebar Header */
.sidebar-menu-header {
    padding: 12px 15px;
    margin-bottom: 5px;
    font-weight: bold;
    opacity: 0.6;
    color: var(--text-primary);
}

/* Sidebar Header Mini */
.sidebar.mini .sidebar-menu-header {
    display: none;
}

/* Sidebar Item */
.sidebar-menu-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    user-select: none;
    position: relative;
}

/* Sidebar Icon */
.sidebar-icon {
    width: 24px;
    text-align: center;
    margin-right: 15px;
    flex-shrink: 0;
    color: var(--sidebar-icon-color);
    transition: color 0.2s;
}

/* Sidebar Chevron */
.sidebar-chevron {
    font-size: 10px !important;
    color: var(--sidebar-chevron-color);
    transition: transform 0.2s;
}

/* Sidebar Label */
.sidebar-label {
    flex: 1;
    color: var(--sidebar-label-color);
    transition: color 0.2s;
}

/* Sidebar Menu & Submenu Item Active */
.sidebar-menu-item.active,
.sidebar-submenu-item.active {
    background: var(--active-bg);
}

/* Sidebar Menu & Submenu Item Hover */
.sidebar-menu-item:hover,
.sidebar-submenu-item:hover {
    background: var(--hover-bg);
}

/* Sidebar Menu & Submenu Item Active Icon */
.sidebar-menu-item.active .sidebar-icon,
.sidebar-submenu-item.active .sidebar-icon {
    color: var(--sidebar-active-icon-color);
}

/* Sidebar Menu & Submenu Item Active Chevron */
.sidebar-menu-item.active .sidebar-chevron,
.sidebar-submenu-item.active .sidebar-chevron {
    color: var(--sidebar-active-chevron-color);
}

/* Sidebar Label Active */
.sidebar-menu-item.active .sidebar-label,
.sidebar-submenu-item.active .sidebar-label {
    color: var(--sidebar-active-label-color);
}

/* Sidebar Menu & Submenu Item Hover Icon */
.sidebar-menu-item:hover .sidebar-icon,
.sidebar-submenu-item:hover .sidebar-icon {
    color: var(--sidebar-hover-icon-color);
}

/* Sidebar Menu & Submenu Item Hover Chevron */
.sidebar-menu-item:hover .sidebar-chevron,
.sidebar-submenu-item:hover .sidebar-chevron {
    color: var(--sidebar-hover-chevron-color);
}

/* Sidebar Label Hover */
.sidebar-submenu-item:hover .sidebar-label {
    color: var(--sidebar-hover-label-color);
}

/* Mini Rail State */
.sidebar.mini .sidebar-menu-item {
    justify-content: center;
    padding: 12px 0;
    width: 56px;
    transition: width 0.2s ease-in-out;
}

/* Mini Rail Icon */
.sidebar.mini .sidebar-menu-item .sidebar-icon {
    margin-right: 0;
    margin-bottom: 0;
}

/* Mini Rail Label */
.sidebar.mini .sidebar-menu-item .sidebar-label {
    display: none;
}

/* Mini Rail Chevron */
.sidebar.mini .sidebar-menu-item .sidebar-chevron {
    display: none;
}

/* Submenu / Accordion */
.submenu-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    list-style: none;
    margin: 0;
    margin-left: 35px;
    padding: 0;
    padding-left: 5px;
    border-left: 1px solid var(--border-color);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, visibility 0.2s ease;
}

/* Submenu Open State */
.submenu-container.open {
    min-height: 100px;
    max-height: 500px;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Submenu Item */
.sidebar-submenu-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    user-select: none;
}


/* Adjust Submenu in Mini Rail */
.sidebar.mini .submenu-container {
    padding: 0;
    /* When mini, maybe keep submenu hidden or display items differently. For now, hide it to keep it clean. */
    display: none;
}

/* Mobile Overlay */
.sidebar-mobile-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Mobile Overlay Active State */
body[data-rds-mode="mobile"] .sidebar-mobile-overlay.active,
body[data-rds-mode="tablet"] .sidebar-mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* =========================================================================
   SIDEBAR BOTTOM MENU & PROFILE CARD & POPOVER
   ========================================================================= */

/* Profile Card */
.sidebar-profile-card {
    position: relative;
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--sidebar-label-color);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

/* Profile Card Hover */
.sidebar-profile-card:hover {
    background: var(--hover-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    color: var(--sidebar-hover-label-color);
}

/* Avatar Wrapper */
.sidebar-profile-avatar-wrapper {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 12px;
    border: 2px solid var(--border-color);
    transition: border-color 0.2s;
}

/* Avatar Wrapper Hover */
.sidebar-profile-card:hover .sidebar-profile-avatar-wrapper {
    border-color: var(--accent-color);
}

/* Avatar Image */
.sidebar-profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Profile Details */
.sidebar-profile-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-right: 8px;
}

/* Email Address */
.sidebar-profile-email {
    opacity: 0.8;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Profile Action Button */
.sidebar-profile-logout-btn {
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.sidebar-profile-logout-icon {
    color: var(--sidebar-icon-color);
    transition: color 0.2s;
}

.sidebar-profile-logout-icon:hover {
    color: rgb(255, 0, 0);
}

/* Profile Action Button Hover */
.sidebar-profile-card:hover .sidebar-profile-logout-btn {
    opacity: 0.9;
    transform: translateX(2px);
}

/* Profile Popover Styling */
.sidebar-profile-popover {
    position: absolute;
    width: 100%;
    bottom: calc(100% + 10px);
    left: 0;
    background: var(--bg-secondary) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: popoverFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Popover Fade In Animation */
@keyframes popoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

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

/* Popover Header */
.sidebar-profile-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Popover Logo */
.sidebar-profile-popover-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Popover Logo Icon */
.sidebar-profile-popover-logo .logo-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #0095c8;
    color: #ffffff;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Popover Logo Text */
.sidebar-profile-popover-logo .logo-text {
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

/* Popover Close Button */
.sidebar-profile-close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}

/* Popover Close Button Hover */
.sidebar-profile-close-btn:hover {
    opacity: 0.9;
}

/* Popover Divider */
.sidebar-profile-popover-divider {
    height: 1px;
    background-color: var(--border-color);
    width: 100%;
}

/* Popover Profile Info */
.sidebar-profile-popover-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

/* Popover Avatar Container */
.sidebar-profile-popover-avatar-wrapper {
    margin-bottom: 12px;
}

/* Popover Avatar Gradient */
.sidebar-profile-popover-avatar-gradient {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.2);
}

/* Popover Avatar Image */
.sidebar-profile-popover-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Popover User Meta */
.sidebar-profile-popover-user-meta {
    margin-bottom: 8px;
}

/* Popover Name */
.sidebar-profile-popover-name {
    font-weight: bold;
    color: var(--text-primary);
}

/* Popover Email */
.sidebar-profile-popover-email {
    color: var(--text-primary);
    opacity: 0.6;
}

/* Popover Tier Badge */
.sidebar-profile-popover-tier-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Popover Menu Buttons */
.sidebar-profile-btn-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Popover Button */
.sidebar-profile-btn {
    width: 100%;
    padding: 12px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Popover Button Hover */
.sidebar-profile-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent-color);
}

/* Popover Danger Button */
.sidebar-profile-btn.btn-danger {
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.2);
}

/* Popover Danger Button Hover */
.sidebar-profile-btn.btn-danger:hover {
    background-color: rgba(231, 76, 60, 0.08);
    border-color: #e74c3c;
}

/* Popover Footer */
.sidebar-profile-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    gap: 8px;
    opacity: 0.5;
}

/* Mini Sidebar State adjustments */
.sidebar.mini .sidebar-profile-card-container {
    padding: 10px 5px;
}

/* Mini Sidebar Profile Card */
.sidebar.mini .sidebar-profile-card {
    justify-content: center;
    padding: 10px 5px;
    border: none;
    background: transparent;
}

/* Mini Sidebar Profile Card Hover */
.sidebar.mini .sidebar-profile-card:hover {
    background: var(--hover-bg);
    border-radius: 12px;
}

/* Mini Sidebar Profile Avatar Wrapper */
.sidebar.mini .sidebar-profile-avatar-wrapper {
    margin-right: 0;
}

/* Mini Sidebar Profile Details */
.sidebar.mini .sidebar-profile-details,
.sidebar.mini .profile-tier-badge-GLOBAL,
.sidebar.mini .sidebar-profile-logout-btn {
    display: none;
}

/* Mini Sidebar Profile Popover */
.sidebar.mini .sidebar-profile-popover {
    left: 85px;
    bottom: 10px;
    right: auto;
    width: 260px;
}

/* Mini Sidebar Theme Settings Popover */
.sidebar.mini .sidebar-theme-settings-popover {
    left: 85px;
    bottom: 10px;
    right: auto;
    width: 260px;
}





/* ------------------------------------------------------------ */
/* Settings Theme Menu                              */
/* ------------------------------------------------------------ */

.sidebar-theme-settings-trigger {
    position: relative;
}

/* Settings Theme Menu */
.sidebar-theme-settings-popover {
    position: absolute;
    width: 100%;
    bottom: calc(100% + 10px);
    left: 0;
    background: var(--bg-secondary) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    padding: 20px;
    display: flex;
    flex-direction: column;
    animation: popoverFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-theme-settings-popover-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 15px 0;
    width: 100%;
}

.sidebar-theme-settings-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Settings Theme Section */
.sidebar-theme-settings-popover-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 5px;
}

/* Settings Theme Label */
.sidebar-theme-settings-popover-section-label {
    font-weight: 600;
    color: var(--text-primary);
    opacity: 0.8;
}

/* Settings Theme Options */
.sidebar-theme-settings-popover-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* Settings Theme Button */
.sidebar-theme-settings-popover-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Settings Theme Button Icon */
.sidebar-theme-settings-popover-option-btn i {
    opacity: 0.7;
    transition: transform 0.2s;
}

/* Settings Theme Button Hover */
.sidebar-theme-settings-popover-option-btn:hover {
    background: var(--hover-bg);
    border-color: var(--text-primary);
}

/* Settings Theme Button Hover Icon */
.sidebar-theme-settings-popover-option-btn:hover i {
    transform: scale(1.1);
}

/* Settings Theme Button Active */
.sidebar-theme-settings-popover-option-btn.active {
    background: rgba(0, 0, 0, 0.05);
    border-color: #000000;
    color: #000000;
    font-weight: 600;
}

/* Dark Theme Button Active */
html.dark .sidebar-theme-settings-popover-option-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: #ffffff;
    color: #ffffff;
}

.sidebar-theme-settings-popover-close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}

/* =========================================================================
   NOTIFICATION CENTER POPOVER & ITEMS (PREMIUM STYLING)
   ========================================================================= */

.sidebar-notification-popover {
    position: absolute;
    width: 100%;
    bottom: calc(100% + 10px);
    left: 0;
    background: var(--bg-secondary) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: popoverFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.mini .sidebar-notification-popover {
    left: 85px;
    bottom: 10px;
    right: auto;
    width: 280px;
}

.sidebar-notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-notification-header-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.sidebar-notification-mark-all {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sidebar-notification-mark-all:hover {
    background: var(--hover-bg);
    opacity: 0.9;
}

.sidebar-notification-divider {
    height: 1px;
    background-color: var(--border-color);
    width: 100%;
}

.sidebar-notification-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom Scrollbar for Notification List */
.sidebar-notification-list::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.sidebar-notification-list::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-notification-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.sidebar-notification-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Empty State */
.sidebar-notification-empty {
    padding: 30px 10px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.sidebar-notification-empty i {
    font-size: 24px;
    opacity: 0.5;
}

/* Notification Item Accordion Card */
.notification-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.notification-item:hover {
    border-color: var(--text-muted);
}

.notification-item.read {
    opacity: 0.75;
}

/* Side Borders */
.notification-item.success {
    border-left: 4px solid #2ecc71;
    background: rgba(46, 204, 113, 0.03);
}

.notification-item.warning {
    border-left: 4px solid #f1c40f;
    background: rgba(241, 196, 15, 0.03);
}

.notification-item.danger {
    border-left: 4px solid #e74c3c;
    background: rgba(231, 76, 60, 0.03);
}

.notification-item.info {
    border-left: 4px solid #3498db;
    background: rgba(52, 152, 219, 0.03);
}

html.dark .notification-item.success {
    background: rgba(46, 204, 113, 0.05);
}

html.dark .notification-item.warning {
    background: rgba(255, 145, 0, 0.05);
    border-left-color: #ff9100;
}

html.dark .notification-item.danger {
    background: rgba(255, 77, 77, 0.05);
    border-left-color: #ff4d4d;
}

html.dark .notification-item.info {
    background: rgba(0, 240, 255, 0.05);
    border-left-color: #00f0ff;
}

/* Header Box */
.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.notification-item-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding-right: 10px;
}

.notification-item-title {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: break-word;
}

.notification-item-chevron {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

/* Accordion Expandable Content */
.notification-item-body {
    max-height: 0;
    overflow: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-item.open .notification-item-body {
    max-height: 280px;
    overflow-y: auto;
}

.notification-item-body::-webkit-scrollbar {
    display: none;
}

.notification-item.open .notification-item-chevron {
    transform: rotate(180deg);
}

.notification-item-body-content {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    margin-top: 10px;
    white-space: pre-line;
}

/* Badge for sidebar trigger */
#sidebar-notification-center-trigger {
    position: relative;
}

.badge-count-GLOBAL {
    background: #ff4d4d;
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: auto;
    box-shadow: 0 0 6px rgba(255, 77, 77, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
}

.badge-count-GLOBAL.hidden {
    display: none;
}