/* Professional Sidebar Layout - Based on Reference */

/* Hide legacy right chat/promocode column */
.chat,
.chat__wrapper,
.chat__messages,
.winter {
    display: none !important;
}

/* Main content alignment - ПОЛНОСТЬЮ делегируем unified-alignment.css */
/* Этот файл управляет только sidebar, wrapper управляется unified-alignment.css */

#_ajax_content_ { 
    width: 100%;
    max-width: 100%;
    overflow-x: visible !important;
    box-sizing: border-box;
}

/* Fix games grid alignment */
.games {
    max-width: 100%;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    box-sizing: border-box;
}

.games__item {
    max-width: 100%;
    box-sizing: border-box;
}

/* Fix header alignment */
.header,
.balance {
    max-width: 100%;
    box-sizing: border-box;
}

/* Top rounded corner for main content */
body {
    background: #190127;
}

#_ajax_content_ {
    background: #190127;
    border-top-left-radius: 0;
    min-height: 100vh;
}

/* Скругление только на десктопах */
@media (min-width: 1024px) {
    #_ajax_content_ {
        border-top-left-radius: 20px;
    }
    
    /* Скрываем верхние навигационные ссылки на десктопах */
    .header__links {
        display: none !important;
    }
    
    /* Центрируем баланс и кнопку на десктопах */
    .header .wrapper {
        justify-content: center !important;
        gap: 20px;
    }
}

/* Professional Sidebar - только для десктопов */
.sidebar-mell {
    position: fixed;
    top: 8px;
    left: 8px;
    width: 260px;
    height: calc(100vh - 16px);
    background: #1f1632;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 8px 6px;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    display: none; /* Скрыто по умолчанию для мобильных */
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width, padding;
}

/* Показываем только на десктопах (от 1024px) */
@media (min-width: 1024px) {
    .sidebar-mell {
        display: flex;
    }
}

/* Collapsed state */
.sidebar-mell.collapsed {
    width: 70px;
    padding: 12px 6px;
}

.sidebar-mell::-webkit-scrollbar { width: 3px; }
.sidebar-mell::-webkit-scrollbar-track { background: transparent; }
.sidebar-mell::-webkit-scrollbar-thumb { background: rgba(147,51,234,0.4); border-radius: 10px; }

/* Players Online */
.sidebar-mell__online {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 14px;
    margin-bottom: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-weight: 400; /* тоньше */
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: padding, gap;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-mell__online-right { margin-left: auto; }
.sidebar-mell__online-label { opacity: .8; }

.sidebar-mell.collapsed .sidebar-mell__online {
    flex-direction: column;
    gap: 4px;
    padding: 8px 4px;
    font-size: 10px;
}

.sidebar-mell__online-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 12px #22c55e;
    animation: pulse-green-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-green-glow {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 12px #22c55e;
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.2);
        box-shadow: 0 0 20px #22c55e;
    }
}

.sidebar-mell__online-count {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

/* User Profile (крупнее как MELLSTROY) */
.sidebar-mell__profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 0 6px 2px 6px;
    background: rgba(255,255,255,0.03);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: padding, gap;
}

.sidebar-mell__profile:hover {
    background: #7c3aed;
    transform: translateX(2px);
}

.sidebar-mell.collapsed .sidebar-mell__profile {
    padding: 8px;
    justify-content: center;
}

.sidebar-mell__profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9333ea, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    position: relative;
    flex-shrink: 0;
}

.sidebar-mell__profile-avatar::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border: 2px solid #1e1b2e;
    border-radius: 50%;
}

.sidebar-mell__profile-info {
    flex: 1;
    min-width: 0;
}

.sidebar-mell__profile-name {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-mell__profile-id {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    margin-top: 1px;
}

.sidebar-mell__profile-arrow {
    width: 16px;
    height: 16px;
    color: rgba(255,255,255,0.6);
    flex-shrink: 0;
}

/* Collapse Toggle Button (большая скругленная как на фото) */
.sidebar-mell__collapse-toggle {
    position: absolute;
    top: 50%;
    right: -18px;
    transform: translateY(-50%);
    width: 36px;
    height: 60px;
    background: rgba(42, 26, 82, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255,255,255,0.7);
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.sidebar-mell__collapse-toggle:hover {
    background: rgba(124, 58, 237, 0.4);
    border-color: rgba(124, 58, 237, 0.6);
    color: #fff;
    transform: translateY(-50%) scale(1.05);
}

.sidebar-mell__collapse-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.sidebar-mell.collapsed .sidebar-mell__collapse-toggle svg {
    transform: rotate(180deg);
}

/* Old toggle styles (keep for compatibility) */
.sidebar-mell__toggle {
    display: none;
}

/* Logo (for guests) */
.sidebar-mell__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 800;
    font-size: 17px;
    padding: 10px 12px;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-mell__logo img {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 2px 10px rgba(139,92,246,0.5));
}

.sidebar-mell.collapsed .sidebar-mell__logo {
    padding: 10px 8px;
    justify-content: center;
}

.sidebar-mell.collapsed .sidebar-mell__logo img {
    width: 32px;
    height: 32px;
}

/* Menu Sections (компактные чтобы всё поместилось) */
.sidebar-mell__section { 
    margin: 4px 0 2px; 
    padding: 0 16px; 
    color: rgba(255,255,255,0.3);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Menu Items (компактные но крупные MELLSTROY) */
.sidebar-mell__item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.7);
    padding: 9px 14px;
    margin: 0 6px 1px 6px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: background-color, transform;
    font-weight: 500;
    font-size: 15px;
    position: relative;
    white-space: nowrap;
    line-height: 1.3;
    background: transparent;
}

.sidebar-mell__item svg,
.sidebar-mell__item-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* Hide text when collapsed */
.sidebar-mell.collapsed .sidebar-mell__item {
    padding: 10px;
    justify-content: center;
}

.sidebar-mell.collapsed .sidebar-mell__item svg {
    margin: 0;
}

.sidebar-mell__item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #8b5cf6;
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transition: all .2s ease;
}

/* Hover: подсвечиваем только текст и иконку, без заливки всей ячейки */
.sidebar-mell__item:hover:not(.active) {
    background: transparent;
    color: rgba(255,255,255,0.95);
}
.sidebar-mell__item:hover:not(.active) svg { opacity: 1; color: #a63ef7; stroke: #a63ef7; fill: none !important; }
.sidebar-mell__item:hover:not(.active) .sidebar-mell__item-text {
    background: linear-gradient(135deg, #a63ef7 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Active: как у Mellstroy — подсветка текста/иконки и левый маркер */
.sidebar-mell__item.active {
    background: transparent;
    color: #ffffff;
    font-weight: 600;
}
.sidebar-mell__item.active .sidebar-mell__item-text {
    background: linear-gradient(135deg, #a63ef7 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-mell__item.active svg { color: #a63ef7; stroke: #a63ef7; fill: none !important; }

/* Press/active feedback color */
.sidebar-mell__item:active {
    background: rgba(124, 58, 237, 0.25);
}

/* Guest login row */
.sidebar-mell__login { 
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 0 6px 6px 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 14px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    border: none; /* без обводки */
}
.sidebar-mell__login:hover { background: rgba(255,255,255,0.06); color: #ffffff; }
.sidebar-mell__login svg { width: 22px; height: 22px; opacity: .9 }
.sidebar-mell__login-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; border: none; overflow: hidden; }
.sidebar-mell__login:hover svg { color: #a63ef7; stroke: #a63ef7; fill: #a63ef7; }
.sidebar-mell__login-avatar svg { opacity: .9 }
.sidebar-mell__login-avatar img { width: 22px; height: 22px; display: block; }

.sidebar-mell__item.active svg {
    opacity: 1;
}

.sidebar-mell__item.active::before {
    height: 60%;
    opacity: 1;
}

.sidebar-mell__item-badge {
    margin-left: auto;
    background: #22c55e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide text content when collapsed */
.sidebar-mell.collapsed .sidebar-mell__item-text,
.sidebar-mell.collapsed .sidebar-mell__item-badge,
.sidebar-mell.collapsed .sidebar-mell__profile-info,
.sidebar-mell.collapsed .sidebar-mell__profile-arrow,
.sidebar-mell.collapsed .sidebar-mell__logo span,
.sidebar-mell.collapsed .sidebar-mell__footer-lang,
.sidebar-mell.collapsed .sidebar-mell__section {
    display: none;
}

/* Footer */
.sidebar-mell__footer {
    margin-top: auto;
    padding: 10px 12px 0;
    border-top: 1px solid rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-mell__footer-social {
    display: flex;
    gap: 6px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-mell__footer-social a {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    transition: all 0.25s ease;
    text-decoration: none;
}

.sidebar-mell__footer-social a:hover {
    background: #3b82f6;
    transform: translateY(-2px);
}

.sidebar-mell.collapsed .sidebar-mell__footer {
    padding: 10px 4px 0;
    flex-direction: column;
    gap: 6px;
}

.sidebar-mell.collapsed .sidebar-mell__footer-social {
    flex-direction: column;
    gap: 6px;
}

.sidebar-mell__footer-lang {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sidebar-mell__footer-lang:hover {
    background: rgba(255,255,255,0.08);
}

/* Shift page content to the right of sidebar */
body .theme--dark, 
body { 
    background: #190127;
    overflow-x: visible !important;
}

main#_ajax_content_, 
.content, 
.page-content { 
    margin-left: 292px;
    padding: 0;
    box-sizing: border-box;
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: margin-left;
}

/* Adapt when sidebar is collapsed */
body.sidebar-collapsed main#_ajax_content_,
body.sidebar-collapsed .content,
body.sidebar-collapsed .page-content {
    margin-left: 102px;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar-mell { 
        transform: translateX(-100%);
        transition: transform .3s ease;
    }
    .sidebar-mell.open { 
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0,0,0,0.5);
    }
    main#_ajax_content_, 
    .content, 
    .page-content { 
        margin-left: 0;
        padding: 16px;
    }
    body .wrapper {
        max-width: 100%;
        padding: 12px;
    }
}


