/* ===================================
   SIDEBAR REDESIGN - PIXEL PERFECT
   =================================== */

/* Import Outfit font */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;600&display=swap");

/* ---- Sidebar Shell ---- */
.left-sidebar.with-vertical {
    background: #ffffff;
    border-radius: 24px;
    margin: 16px;
    height: calc(100vh - 32px);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    border: 1px solid #e8edf2;
    width: 272px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- Push the main content right ---- */
.page-wrapper {
    margin-left: 270px !important; /* 272 width + 16 margin + 24 gap */
    transition: all 0.3s ease;
}

/* ---- Logo Area ---- */
.brand-logo {
    padding: 28px 24px 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.brand-logo .back-arrow {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.brand-logo .back-arrow:hover {
    opacity: 1;
}

/* ---- Scrollable Nav ---- */
.scroll-sidebar {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px;
    /* hide scrollbar */
    scrollbar-width: none;
}
.scroll-sidebar::-webkit-scrollbar {
    display: none;
}

/* ---- Nav container ---- */
.sidebar-nav {
    padding: 0;
}

.sidebar-nav ul#sidebarnav {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ---- Each menu item ---- */
.sidebar-item {
    margin-bottom: 24px;
}

/* ---- Link row ---- */
.sidebar-link {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 11px 12px !important;
    color: #323232 !important;
    text-decoration: none !important;
    border-radius: 12px !important;
    transition: background 0.15s ease !important;
    font-family: "Outfit", sans-serif !important;
    font-weight: 400 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    border-left: none !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.sidebar-link:hover {
    background: #f5f7fa !important;
    color: #323232 !important;
    text-decoration: none !important;
}

/* ---- Normal active (current page) ---- */
.sidebar-link.active {
    background: #e5f1ff !important;
    color: #323232 !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    border-left: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* ---- Activities active parent ---- */
.sidebar-link.active-activities {
    background: #e5f1ff !important;
    color: #323232 !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    border-left: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* ---- Icon ---- */
.sidebar-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    object-fit: contain;
}

/* ---- Arrow chevron on Activities ---- */
.sidebar-link iconify-icon.ms-auto {
    margin-left: auto !important;
    font-size: 18px;
    color: #6b7280;
    transition: transform 0.25s ease;
}

.sidebar-item.has-submenu.expanded > .sidebar-link iconify-icon.ms-auto {
    transform: rotate(180deg);
}

/* =====================================
   SUBMENU CONTAINER
   ===================================== */
.submenu-container {
    background: #f2f4f7;
    border-radius: 16px;
    padding: 8px 0;
    margin: 6px 0 6px 0;
    display: none;
}

.sidebar-item.expanded > .submenu-container {
    display: block;
}

/* Sub-items */
.submenu-container .sidebar-item {
    margin-bottom: 0;
}

.submenu-container .sidebar-link {
    padding: 9px 14px;
    font-size: 15px;
    font-weight: 400;
    color: #323232;
    border-radius: 10px;
    gap: 12px;
    margin: 0 6px;
    white-space: normal !important;
    align-items: flex-start !important;
    line-height: 1.35 !important;
}

.submenu-container .sidebar-link .hide-menu {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    flex: 1 1 auto;
}

/* Make submenu icons black */
.submenu-container .sidebar-icon {
    filter: brightness(0);
}

.submenu-container iconify-icon[icon="mdi:circle-small"].sidebar-icon {
    display: none;
}

/* Keep Quick Response icon in its original blue color */
.submenu-container .sidebar-link[href*="quickResponse"] .sidebar-icon,
.submenu-container .sidebar-link:has(img[alt="Quick Response"]) .sidebar-icon {
    filter: none;
}

.submenu-container .sidebar-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #323232;
}

.submenu-container .sidebar-link.active {
    background: transparent;
    color: #007bff;
    font-weight: 500;
}

/* Quick Response — blue */
.submenu-container .sidebar-link[href*="quickResponse"],
.submenu-container .sidebar-link:has(img[alt="Quick Response"]) {
    color: #00aeef !important;
    font-weight: 500;
}

/* =====================================
   FOOTER (Sign out)
   ===================================== */
.sidebar-footer {
    flex-shrink: 0;
    padding: 8px 16px 20px 16px;
    border-top: 1px solid #eef1f5;
}

.sidebar-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-footer .sidebar-item {
    margin-bottom: 0;
    margin-top: 0;
}

.sidebar-footer .sidebar-link {
    color: #323232;
    font-size: 16px;
    font-weight: 400;
}

/* =====================================
   MINI-SIDEBAR (COLLAPSED / ICON-ONLY)
   ===================================== */

/* Transition on the sidebar itself */
.left-sidebar.with-vertical {
    transition: width 0.3s ease;
}

/* When body has data-sidebartype="mini-sidebar" */
body[data-sidebartype="mini-sidebar"] .left-sidebar.with-vertical {
    width: 76px !important;
}

/* Expand content area when collapsed */
body[data-sidebartype="mini-sidebar"] .page-wrapper {
    /* margin-left: 116px !important; 76 width + 16 margin + 24 gap */
}

/* Hide text labels and logo image */
body[data-sidebartype="mini-sidebar"] .left-sidebar .hide-menu,
body[data-sidebartype="mini-sidebar"] .left-sidebar .logo-img,
body[data-sidebartype="mini-sidebar"] .left-sidebar .submenu-container,
body[data-sidebartype="mini-sidebar"] .left-sidebar .sidebar-footer ul li span {
    display: none !important;
}

/* Center the back-arrow when collapsed (no logo beside it) */
body[data-sidebartype="mini-sidebar"] .left-sidebar .brand-logo {
    justify-content: center !important;
    padding: 28px 12px 20px 12px;
}

/* Rotate the arrow icon to show "open" direction when collapsed */
body[data-sidebartype="mini-sidebar"] .left-sidebar .back-arrow img {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.back-arrow img {
    transition: transform 0.3s ease;
}

/* Center icons in the nav when collapsed */
body[data-sidebartype="mini-sidebar"] .left-sidebar .scroll-sidebar {
    padding: 0 8px !important;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .sidebar-link {
    justify-content: center !important;
    padding: 11px 8px !important;
    gap: 0 !important;
}

/* Center icons in footer (Sign out) */
body[data-sidebartype="mini-sidebar"] .left-sidebar .sidebar-footer {
    padding: 8px 8px 20px 8px;
}

/* Hide chevron arrow on Activities when collapsed */
body[data-sidebartype="mini-sidebar"]
    .left-sidebar
    .sidebar-link
    iconify-icon.ms-auto {
    display: none !important;
}

/* Tooltip on hover when collapsed */
body[data-sidebartype="mini-sidebar"] .left-sidebar .sidebar-item {
    position: relative;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .sidebar-item:hover::after {
    content: attr(data-title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #323232;
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: "Outfit", sans-serif;
    font-size: 13px;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* =====================================
   RTL LAYOUT SUPPORT (FA/AR)
   ===================================== */
html[dir="rtl"] .left-sidebar.with-vertical {
    left: auto;
    right: 0;
}

html[dir="rtl"] .page-wrapper {
    margin-left: 0 !important;
    margin-right: 312px !important;
}

html[dir="rtl"] body[data-sidebartype="mini-sidebar"] .page-wrapper {
    margin-left: 0 !important;
    margin-right: 116px !important;
}

html[dir="rtl"] .sidebar-link iconify-icon.ms-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

html[dir="rtl"] .left-sidebar .back-arrow img {
    transform: rotate(180deg);
}

html[dir="rtl"]
    body[data-sidebartype="mini-sidebar"]
    .left-sidebar
    .back-arrow
    img {
    transform: rotate(0deg);
}

html[dir="rtl"]
    body[data-sidebartype="mini-sidebar"]
    .left-sidebar
    .sidebar-item:hover::after {
    left: auto;
    right: calc(100% + 12px);
}
