/* Минималистичный Sidebar CRM */

.crm-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.2s ease;
}

.mobile-sidebar-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.mobile-sidebar-toggle .icon {
    width: 20px;
    height: 20px;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 900;
    display: none;
}

.sidebar-backdrop.active {
    display: block;
}

.crm-sidebar.collapsed {
    width: 72px;
}

.crm-sidebar.collapsed .nav-text,
.crm-sidebar.collapsed .nav-section-title,
.crm-sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
}

.sidebar-logo:hover {
    opacity: 0.8;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
    display: block;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-toggle .icon {
    width: 16px;
    height: 16px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 0 20px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: var(--text-primary);
}

#navAdmin {
    color: #ef4444;
}

#navAdmin.active {
    color: #ef4444;
    border-left-color: #ef4444;
}

.nav-item .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.nav-item-restricted {
    display: none;
}

.nav-item-restricted.visible {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Кнопка создания лота */
#sidebarCreateLotBtn {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

#sidebarCreateLotBtn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.logout-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.logout-btn .icon {
    width: 18px;
    height: 18px;
}

/* Scrollbar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Неоновая красная точка для индикатора новых заявок */
.new-requests-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ff0000;
    border-radius: 50%;
    margin-left: 8px;
    position: relative;
    animation: neonPulse 2s ease-in-out infinite;
    box-shadow: 
        0 0 5px #ff0000,
        0 0 10px #ff0000,
        0 0 15px #ff0000,
        0 0 20px #ff0000;
}

.new-requests-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: #ff0000;
    border-radius: 50%;
    animation: neonRipple 2s ease-out infinite;
}

@keyframes neonPulse {
    0%, 100% {
        box-shadow: 
            0 0 5px #ff0000,
            0 0 10px #ff0000,
            0 0 15px #ff0000,
            0 0 20px #ff0000;
        opacity: 1;
    }
    50% {
        box-shadow: 
            0 0 10px #ff0000,
            0 0 20px #ff0000,
            0 0 30px #ff0000,
            0 0 40px #ff0000;
        opacity: 0.8;
    }
}

@keyframes neonRipple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Неоновая красная точка для карточки клиента */
.new-activity-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ff0000;
    border-radius: 50%;
    margin-left: 6px;
    position: relative;
    vertical-align: middle;
    animation: neonPulse 2s ease-in-out infinite;
    box-shadow: 
        0 0 5px #ff0000,
        0 0 10px #ff0000,
        0 0 15px #ff0000;
}

/* Адаптивность */
@media (max-width: 768px) {
    .crm-sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    
    .crm-sidebar.mobile-open {
        transform: translateX(0);
    }

    .mobile-sidebar-toggle {
        display: inline-flex;
    }
}
