.sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.custom-sidebar-header {
    position: relative;
    display: block;
    padding: 22px 20px 18px;
    flex-shrink: 0;
}

.sidebar-user-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-inline-start: 4px;
    padding-inline-end: 4px;
}

.sidebar-avatar-form {
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.sidebar-avatar-wrapper {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    user-select: none;
}

.sidebar-avatar {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: #ffffff;
    background: linear-gradient(135deg, #19e6d1 0%, #4da3ff 100%);
    box-shadow:
        0 10px 24px rgba(25, 230, 209, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-avatar.has-image {
    padding: 0;
    background: rgba(25, 230, 209, 0.10);
    border: 1px solid rgba(25, 230, 209, 0.22);
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar-user-info {
    min-width: 0;
    flex: 1;
}

.sidebar-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.sidebar-name-row strong {
    flex: 0 1 auto;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    font-size: 17px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.4;
}

.sidebar-level-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
}

.sidebar-profile-edit {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: rgba(25, 230, 209, 0.10);
    border: 1px solid rgba(25, 230, 209, 0.18);
    text-decoration: none;
    flex-shrink: 0;
    transition: 0.22s ease;
}

.sidebar-profile-edit svg {
    width: 16px;
    height: 16px;
}

.sidebar-profile-edit:hover {
    transform: translateY(-2px);
    background: rgba(25, 230, 209, 0.16);
}

.sidebar-level-shield {
    height: 28px;
    min-width: 92px;
    padding: 0 10px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
    flex-shrink: 0;
    transition: 0.22s ease;
    border: 1px solid transparent;
}

.sidebar-level-shield svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.sidebar-level-shield small {
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.sidebar-level-bronze {
    color: #d08a45;
    background: rgba(208, 138, 69, 0.10);
    border-color: rgba(208, 138, 69, 0.22);
}

.sidebar-level-silver {
    color: #c8d3df;
    background: rgba(200, 211, 223, 0.10);
    border-color: rgba(200, 211, 223, 0.22);
}

.sidebar-level-gold {
    color: #ffd166;
    background: rgba(255, 209, 102, 0.10);
    border-color: rgba(255, 209, 102, 0.25);
}

.sidebar-level-platinum {
    color: #a7f3d0;
    background: rgba(167, 243, 208, 0.10);
    border-color: rgba(167, 243, 208, 0.22);
}

.sidebar-level-diamond {
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.10);
    border-color: rgba(147, 197, 253, 0.22);
}

.sidebar-level-master {
    color: #c084fc;
    background: rgba(192, 132, 252, 0.10);
    border-color: rgba(192, 132, 252, 0.22);
}

.sidebar-level-vip {
    color: #19e6d1;
    background: rgba(25, 230, 209, 0.11);
    border-color: rgba(25, 230, 209, 0.28);
    box-shadow: 0 0 18px rgba(25, 230, 209, 0.10);
}

.sidebar-lang-mini {
    height: 28px;
    padding: 0 8px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
    color: var(--primary);
    background:
        linear-gradient(135deg, rgba(25, 230, 209, 0.12), rgba(77, 163, 255, 0.08)),
        rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(25, 230, 209, 0.18);
    box-shadow: 0 8px 18px rgba(25, 230, 209, 0.06);
    transition: 0.22s ease;
    flex-shrink: 0;
    direction: ltr;
}

.sidebar-lang-mini:hover {
    transform: translateY(-1px);
    background:
        linear-gradient(135deg, rgba(25, 230, 209, 0.18), rgba(77, 163, 255, 0.10)),
        rgba(255, 255, 255, 0.04);
    border-color: rgba(25, 230, 209, 0.32);
    box-shadow: 0 10px 20px rgba(25, 230, 209, 0.10);
}

.sidebar-lang-mini-icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-lang-mini-icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

.sidebar-lang-mini strong {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.5px;
    line-height: 1;
}

body.light-mode .sidebar-lang-mini {
    background:
        linear-gradient(135deg, rgba(18, 207, 192, 0.12), rgba(77, 163, 255, 0.08)),
        rgba(255, 255, 255, 0.76);
    border-color: rgba(18, 207, 192, 0.18);
    box-shadow: 0 8px 16px rgba(16, 32, 43, 0.06);
}

.sidebar-float-toggle {
    position: absolute;
    top: 18px;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(7, 19, 27, 0.98), rgba(4, 12, 18, 0.98));
    box-shadow: -6px 10px 28px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: 0.25s ease;
    z-index: 5;
}

html[dir="rtl"] .sidebar-float-toggle,
body.rtl .sidebar-float-toggle {
    left: -58px;
    right: auto;
    box-shadow: -6px 10px 28px rgba(0, 0, 0, 0.24);
}

html[dir="ltr"] .sidebar-float-toggle,
body.ltr .sidebar-float-toggle {
    right: -58px;
    left: auto;
    box-shadow: 6px 10px 28px rgba(0, 0, 0, 0.24);
}

body.light-mode .sidebar-float-toggle {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,250,255,0.98));
    border: 1px solid rgba(16,32,43,0.08);
}

.sidebar-float-toggle span {
    display: block;
    width: 18px;
    height: 2.5px;
    border-radius: 999px;
    background: var(--text);
    transition: 0.25s ease;
}

.sidebar-float-toggle:hover {
    transform: translateY(-2px);
}

.sidebar-float-toggle:hover span {
    background: var(--primary);
}

.sidebar-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.custom-sidebar-menu {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.logout-icon svg {
    width: 21px;
    height: 21px;
}

.sidebar-socials-bottom {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,0.06);
    background: transparent;
}

body.light-mode .sidebar-socials-bottom {
    border-top: 1px solid rgba(16,32,43,0.06);
}

.sidebar-social-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    transition: 0.22s ease;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.20);
    flex-shrink: 0;
}

.sidebar-social-icon svg {
    width: 20px;
    height: 20px;
}

.sidebar-social-icon:hover {
    transform: translateY(-2px);
}

.sidebar-social-icon.whatsapp {
    background: linear-gradient(135deg, #1fbf75 0%, #25d366 100%);
}

.sidebar-social-icon.facebook {
    background: linear-gradient(135deg, #1877f2 0%, #3b82f6 100%);
}

.sidebar-social-icon.telegram {
    background: linear-gradient(135deg, #1f9bd1 0%, #2aabee 100%);
}

@media (max-width: 640px) {
    .custom-sidebar-header {
        padding: 18px 16px 14px;
    }

    .sidebar-user-box {
        gap: 12px;
    }

    .sidebar-avatar {
        width: 50px;
        height: 50px;
        border-radius: 15px;
        font-size: 21px;
    }

    .sidebar-name-row strong {
        max-width: 120px;
        font-size: 15px;
    }

    .sidebar-profile-edit {
        width: 28px;
        height: 28px;
        border-radius: 9px;
    }

    .sidebar-profile-edit svg {
        width: 15px;
        height: 15px;
    }

    .sidebar-level-shield {
        height: 26px;
        min-width: 82px;
        padding: 0 8px;
        border-radius: 9px;
    }

    .sidebar-level-shield svg {
        width: 14px;
        height: 14px;
    }

    .sidebar-level-shield small {
        font-size: 9px;
    }

    .sidebar-lang-mini {
        height: 26px;
        padding: 0 7px;
        border-radius: 9px;
        gap: 4px;
    }

    .sidebar-lang-mini-icon,
    .sidebar-lang-mini-icon svg {
        width: 14px;
        height: 14px;
    }

    .sidebar-lang-mini strong {
        font-size: 9px;
    }

    html[dir="rtl"] .sidebar-float-toggle,
    body.rtl .sidebar-float-toggle {
        top: 14px;
        left: -52px;
        right: auto;
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    html[dir="ltr"] .sidebar-float-toggle,
    body.ltr .sidebar-float-toggle {
        top: 14px;
        right: -52px;
        left: auto;
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .sidebar-float-toggle span {
        width: 16px;
    }

    .custom-sidebar-menu {
        padding: 14px;
        gap: 9px;
    }

    .sidebar-icon {
        width: 20px;
        height: 20px;
    }

    .sidebar-icon svg {
        width: 18px;
        height: 18px;
    }

    .sidebar-socials-bottom {
        gap: 10px;
        padding: 12px 14px 16px;
    }

    .sidebar-social-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .sidebar-social-icon svg {
        width: 18px;
        height: 18px;
    }
}