:root {
    --sidebar-collapsed: 64px;
    --sidebar-expanded: 240px;
    --header-height: 0px;
}

.container {
    position: relative;
}

main,
footer {
    margin-left: 0;
    width: 100%;
    padding-left: calc(var(--sidebar-collapsed) / 2);
    transition: padding-left 0.2s ease;
}

body.sidebar-expanded main,
body.sidebar-expanded footer {
    padding-left: calc(var(--sidebar-expanded) / 2);
}

body.sidebar-hidden main,
body.sidebar-hidden footer {
    padding-left: 0;
}

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    height: calc(100vh - var(--header-height));
    width: var(--sidebar-collapsed);
    background: rgba(12, 13, 20, 0.92);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    padding: 16px 10px;
    gap: 12px;
    z-index: 2500;
    overflow: hidden;
    transition: width 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar:hover {
    width: var(--sidebar-expanded);
    box-shadow: 12px 0 24px rgba(0, 0, 0, 0.25);
}

body.sidebar-expanded .sidebar {
    width: var(--sidebar-expanded);
    box-shadow: 12px 0 24px rgba(0, 0, 0, 0.25);
}

body.sidebar-hidden .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
}

.sidebar-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.sidebar-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    background: transparent;
    color: #F9FAFF;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.95em;
    font-weight: 600;
    color: #F9FAFF;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 2px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.sidebar:hover .sidebar-title,
.sidebar:hover .sidebar-links,
body.sidebar-expanded .sidebar-title,
body.sidebar-expanded .sidebar-links {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: rgba(249, 250, 255, 0.7);
    text-decoration: none;
    font-size: 0.92em;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
    background: rgba(104, 66, 255, 0.18);
    color: #F9FAFF;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: #F9FAFF;
    font-weight: 600;
}

.sidebar-link-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(249, 250, 255, 0.5);
    flex-shrink: 0;
}

.sidebar-empty {
    color: rgba(249, 250, 255, 0.6);
    font-size: 0.85em;
    padding: 8px 10px;
}

.sidebar-home-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    color: #F9FAFF;
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
    box-shadow: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar-home-button:hover {
    color: #F9FAFF;
    transform: translateY(-1px);
}

.sidebar-home-button.active {
    color: #F9FAFF;
}

.sidebar-home-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-home-icon img,
.sidebar-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.sidebar-home-label {
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.sidebar:hover .sidebar-home-label,
body.sidebar-expanded .sidebar-home-label {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-category-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.sidebar-toggle {
    position: fixed;
    left: 0;
    top: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #F9FAFF;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border 0.2s ease, transform 0.2s ease;
    z-index: 3500;
}

.sidebar-toggle:hover {
    background: rgba(104, 66, 255, 0.25);
    border-color: rgba(104, 66, 255, 0.6);
    transform: translateY(-1px);
}

.sidebar-toggle-icon {
    width: 20px;
    height: 16px;
    display: inline-block;
    background:
        linear-gradient(#F9FAFF 0 0) 0 0/100% 2px,
        linear-gradient(#F9FAFF 0 0) 0 7px/100% 2px,
        linear-gradient(#F9FAFF 0 0) 0 14px/100% 2px;
    background-repeat: no-repeat;
}

@media (max-width: 768px) {
    :root {
        --sidebar-collapsed: 56px;
        --sidebar-expanded: 180px;
    }

    main,
    footer {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-collapsed);
    }

    body.sidebar-expanded .sidebar {
        transform: translateX(0);
        width: var(--sidebar-expanded);
    }
}
