:root {
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 70px;
    --transition-speed: 0.3s;
    --sidebar-bg: #1a1a27;
}

.sidebar {
    position: fixed;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    transition: width var(--transition-speed) ease;
    overflow-x: hidden;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
}

.sidebar[data-state="expanded"] .sidebar__brand-text,
.sidebar[data-state="expanded"] .sidebar__text {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear;
}

.sidebar[data-state="collapsed"] .sidebar__brand-text,
.sidebar[data-state="collapsed"] .sidebar__text {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

/* Sidebar Header */
.sidebar__header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar__logo {
    width: 35px;
    height: 35px;
    flex-shrink: 0;
}

.sidebar__brand-text {
    font-size: 20px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
}

/* Navigation Menu */
.sidebar__nav {
    padding: 20px 0;
}

.sidebar__menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar__item {
    padding: 0 15px;
    margin: 5px 0;
}

.sidebar__link {
    display: flex;
    align-items: center;
    padding: 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
    margin: 4px 15px;
}

.sidebar__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin-right: 12px;
    font-size: 18px;
    flex-shrink: 0;
    transition: all var(--transition-speed) ease;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar__text {
    font-size: 15px;
    font-weight: 500;
    opacity: 1;
    transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
}

/* Active State */
.sidebar__link--active {
    background: var(--accent-primary);
}

.sidebar__link--active .sidebar__icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Hover States */
.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar__link:hover .sidebar__icon {
    background: rgba(255, 255, 255, 0.1);
}

/* Collapsed State */
.sidebar[data-state="collapsed"] {
    width: var(--sidebar-width-collapsed);
}

.sidebar[data-state="collapsed"] .sidebar__link {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 8px auto;
    justify-content: center;
}

.sidebar[data-state="collapsed"] .sidebar__icon {
    margin: 0;
    width: 100%;
    height: 100%;
}

.sidebar[data-state="collapsed"] .sidebar__text {
    display: none;
}

/* Expanded State */
.sidebar[data-state="expanded"] {
    width: var(--sidebar-width);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform var(--transition-speed) ease;
        width: var(--sidebar-width) !important;
        z-index: 1000;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar[data-state="collapsed"],
    .sidebar[data-state="expanded"] {
        width: var(--sidebar-width) !important;
    }

    .sidebar[data-state="collapsed"] .sidebar__brand-text,
    .sidebar[data-state="collapsed"] .sidebar__text {
        opacity: 1;
        visibility: visible;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        z-index: 999;
        opacity: 0;
        transition: opacity var(--transition-speed) ease;
    }

    .sidebar-backdrop.show {
        display: block;
        opacity: 1;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Icon Colors */
.sidebar__icon--home { color: #26a69a; }
.sidebar__icon--coloring { color: #ff6d00; }
.sidebar__icon--puzzle { color: #8541d4; }
.sidebar__icon--activity { color: #2196f3; }
.sidebar__icon--settings { color: #78909c; }

.sidebar__link--active .sidebar__icon {
    color: white !important;
}
