/* Sidebar Layout & Container */
.sidebar-left {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: #ffffff;
    border-right: none;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    overflow-y: visible;
    overflow-x: visible;
    transform: translateX(0);
    display: flex;
    flex-direction: column;
}

/* Sidebar Header */
.sidebar-header {
    flex: 0 0 auto;
    padding: 1.5rem 1.5rem;
    display: flex;
    align-items: center;
}

.sidebar-left .logo {
    padding: 0;
    color: #0f1419;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-left .logo:hover {
    color: #00d084;
}

/* Sidebar Content */
.sidebar-content {
    padding: 1.5rem;
    flex: 1;
    padding-bottom: 4rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.region-sidebar-left {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Menu Blocks */
.sidebar-left .block {
    margin-bottom: 2rem;
}

.sidebar-left .block h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8899a6;
    margin-bottom: 0.75rem;
    font-weight: 700;
    padding-left: 0.75rem;
}

/* Menu Links */
.sidebar-left ul.menu {
    list-style: none;
    padding: 0;
}

.sidebar-left .menu-item--expanded ul.menu {
    margin-left: 1rem;
}

.sidebar-left ul.menu li {
    margin-bottom: 0;
}

.sidebar-left ul.menu li a {
    display: block;
    padding: 0.5rem 0.5rem;
    color: #495057;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-left ul.menu li a:hover {
    background-color: #f8f9fa;
    color: #212529;
}

.sidebar-left ul.menu li a.is-active {
    background-color: #e8f5e9;
    /* Light green tint to match logo hover */
    color: #00a166;
    /* Darker green for text */
    font-weight: 600;
}

/* Sidebar Toggle */
.sidebar-toggle-input {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    bottom: 1.5rem;
    right: -40px;
    width: 40px;
    height: 40px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-left: none;
    border-radius: 0 0.5rem 0.5rem 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease-in-out;
    z-index: 1001;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.05);
    color: #6c757d;
}

.sidebar-toggle:hover {
    background-color: #f8f9fa;
    color: #212529;
}

.sidebar-toggle svg {
    transition: transform 0.3s ease-in-out;
    width: 20px;
    height: 20px;
}

/* Toggle Logic */
.sidebar-toggle-input:not(:checked)~.sidebar-left {
    transform: translateX(-281px);
}

.sidebar-toggle-input:not(:checked)~.sidebar-left .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Hide sidebar on admin pages when toolbar is present */
body.toolbar-tray-open .sidebar-left,
body.toolbar-vertical .sidebar-left {
    display: none;
}

/* Disable transition on initial load */
.sidebar-left.sidebar-no-transition {
    transition: none;
}

/* Closed state init */
.sidebar-closed-init .sidebar-toggle-input {
    display: none;
}

.sidebar-closed-init .sidebar-toggle-input~.sidebar-left {
    transform: translateX(-240px);
}

.sidebar-closed-init .sidebar-toggle-input~.main-content {
    margin-left: 0;
}

/* Main content area adjustment */
.main-content.with-sidebar {
    margin-left: 280px;
    transition: margin-left 0.3s ease-in-out;
    min-height: 100vh;
}

/* Remove sidebar margin when toolbar is present (admin pages) */
body.toolbar-tray-open .main-content,
body.toolbar-vertical .main-content {
    margin-left: 0;
}

/* When checkbox is unchecked, remove margin from main content */
.sidebar-toggle-input:not(:checked)~.main-content {
    margin-left: 0;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .sidebar-left {
        transform: translateX(-280px);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar-toggle-input:checked~.sidebar-left {
        transform: translateX(0);
    }

    .sidebar-toggle-input:not(:checked)~.sidebar-left {
        transform: translateX(-280px);
    }

    .sidebar-toggle {
        right: -48px;
        width: 48px;
        height: 48px;
    }

    /* Mobile backdrop */
    .sidebar-toggle-input:checked~.sidebar-left::before {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
}