/**
 * SAW Admin - Navigation Sidebar
 * @package SAW_Visitors
 * @version 4.0.0
 */

/* ============================================
   SIDEBAR CONTAINER - MODERN GRADIENT DESIGN
   ============================================ */

.sa-app-sidebar {
    position: fixed;
    top: var(--saw-header-height, 60px);
    left: 0;
    bottom: var(--saw-footer-height, 45px);
    width: var(--saw-sidebar-width, 260px);

    /* Elegant gradient background - dark to light blue */
    background: linear-gradient(180deg,
            #0a2540 0%,
            #0d3a5c 30%,
            #005A8C 70%,
            #0077b6 100%);

    /* Subtle pattern overlay for depth */
    background-image:
        linear-gradient(180deg,
            #0a2540 0%,
            #0d3a5c 30%,
            #005A8C 70%,
            #0077b6 100%),
        repeating-linear-gradient(45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.01) 2px,
            rgba(255, 255, 255, 0.01) 4px);

    /* Shadow between sidebar and content - elegant depth */
    box-shadow:
        4px 0 24px rgba(0, 0, 0, 0.15),
        1px 0 0 rgba(255, 255, 255, 0.05);

    border-right: none;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for dark background */
.sa-app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.sa-app-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sa-app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.sa-app-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ============================================
   SIDEBAR OVERLAY (mobile/tablet)
   ============================================ */

.sa-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(10, 37, 64, 0.5);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sa-sidebar-overlay--active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   TABLET & MOBILE SIDEBAR
   ============================================ */
@media (max-width: 1024px) {
    .sa-sidebar-overlay {
        display: block;
    }

    .sa-app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100% !important;
        z-index: 9999 !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: auto !important;

        /* End above bottom-nav */
        bottom: var(--saw-bottom-nav-height, 52px) !important;
        height: calc(100vh - var(--saw-bottom-nav-height, 52px)) !important;
        height: calc(100dvh - var(--saw-bottom-nav-height, 52px)) !important;

        /* Extra padding for safety */
        padding-bottom: var(--saw-space-4, 16px);
    }

    .sa-app-sidebar--open {
        transform: translateX(0);
    }
}

/* ============================================
   MOBILE SIDEBAR
   ============================================ */
@media (max-width: 768px) {
    .sa-app-sidebar {
        bottom: var(--saw-bottom-nav-height-mobile, 48px) !important;
        height: calc(100vh - var(--saw-bottom-nav-height-mobile, 48px)) !important;
        height: calc(100dvh - var(--saw-bottom-nav-height-mobile, 48px)) !important;
        padding-bottom: var(--saw-space-4, 16px);
    }
}

/* ============================================
   SWITCHERS SECTION - GLASSMORPHISM CONTAINER
   ============================================ */

.sa-sidebar-switchers {
    margin: 0;
    padding: var(--saw-space-3);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ============================================
   NAVIGATION MENU
   ============================================ */

.sa-sidebar-nav {
    padding: var(--saw-space-3) 0;
    display: flex !important;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* ============================================
   NAVIGATION SECTION
   ============================================ */

.sa-nav-section {
    margin-bottom: var(--saw-space-2);
    padding-top: var(--saw-space-2);
}

/* Section separator line */
.sa-nav-section::before {
    content: '';
    display: block;
    height: 1px;
    margin: 0 var(--saw-space-4) var(--saw-space-2);
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.15) 20%,
            rgba(255, 255, 255, 0.15) 80%,
            transparent 100%);
}

.sa-nav-section:first-child::before {
    display: none;
}

.sa-nav-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--saw-space-2) var(--saw-space-5) var(--saw-space-2);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.sa-nav-heading:hover {
    color: rgba(255, 255, 255, 0.7);
}

.sa-nav-heading-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: var(--saw-radius-sm);
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.sa-nav-heading:hover .sa-nav-heading-toggle {
    background: rgba(255, 255, 255, 0.1);
}

.sa-nav-heading-toggle svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: transform 0.2s ease;
}

.sa-nav-section--collapsed .sa-nav-heading-toggle svg {
    transform: rotate(-90deg);
}

.sa-nav-items {
    display: flex;
    flex-direction: column;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    padding: 0 var(--saw-space-2);
}

.sa-nav-section--collapsed .sa-nav-items {
    max-height: 0;
    opacity: 0;
}

/* ============================================
   NAVIGATION ITEMS
   ============================================ */

.sa-sidebar-nav .sa-nav-item {
    margin: 2px var(--saw-space-2) !important;
    padding: 0 !important;
    text-indent: 0 !important;
    position: relative;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: var(--saw-space-3);
    width: calc(100% - 2 * var(--saw-space-2)) !important;
    box-sizing: border-box !important;
    padding: 10px var(--saw-space-4) !important;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--saw-radius-md);
    transition: all 0.2s ease;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
}

.sa-sidebar-nav .sa-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(2px);
}

.sa-sidebar-nav .sa-nav-item--active,
.sa-sidebar-nav .sa-nav-item.sa-nav-item--active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-weight: 600;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    margin: 2px var(--saw-space-2) !important;
    padding: 10px var(--saw-space-4) !important;
}

/* Active indicator - left accent bar */
.sa-sidebar-nav .sa-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, #60d0ff 0%, #00a8e8 100%);
    border-radius: 0 2px 2px 0;
    transition: height 0.2s ease;
    box-shadow: 0 0 8px rgba(96, 208, 255, 0.4);
}

.sa-sidebar-nav .sa-nav-item--active::before {
    height: 60%;
}

/* Icon styling */
.sa-sidebar-nav .sa-nav-item .sa-nav-icon {
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sa-sidebar-nav .sa-nav-item:hover .sa-nav-icon,
.sa-sidebar-nav .sa-nav-item--active .sa-nav-icon {
    opacity: 1;
}

.sa-sidebar-nav .sa-nav-item--active .sa-nav-icon {
    transform: scale(1.05);
}

.sa-sidebar-nav .sa-nav-icon svg {
    stroke: currentColor;
    width: 18px;
    height: 18px;
}

/* Label styling */
.sa-sidebar-nav .sa-nav-item .sa-nav-label {
    margin: 0 !important;
    padding: 0 !important;
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* First section items - slightly larger */
.sa-sidebar-nav>.sa-nav-item:first-child,
.sa-sidebar-nav>a.sa-nav-item:nth-child(-n+3) {
    padding: 12px var(--saw-space-4) !important;
}

/* ============================================
   TABLET ADJUSTMENTS
   ============================================ */
@media (max-width: 1024px) {
    .sa-app-sidebar {
        box-shadow:
            8px 0 32px rgba(0, 0, 0, 0.3),
            1px 0 0 rgba(255, 255, 255, 0.05);
    }
}

/* ============================================
   MOBILE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .sa-sidebar-switchers {
        margin: var(--saw-space-3);
        padding: var(--saw-space-2);
    }

    .sa-nav-heading {
        padding: var(--saw-space-2) var(--saw-space-4) var(--saw-space-1);
        font-size: 10px;
    }

    .sa-sidebar-nav .sa-nav-item {
        padding: 10px var(--saw-space-3) !important;
    }
}

/* ============================================
   SIDEBAR FOOTER - VERSION INFO
   ============================================ */

.sa-sidebar-footer {
    margin-top: auto;
    padding: var(--saw-space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sa-sidebar-version {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
}