/* ===== 移动端特定样式 ===== */

:root {
    --header-height: 55px;
    --chat-functions-width: 100%;
    --chat-functions-height: 100%;
}

/* 平板设备和手机设备 */
@media (max-width: 768px) {

    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100vw;
        height: calc(100vh - var(--header-height));
        transform: translateX(-100%);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
        z-index: 2000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar:not(.closed) {
        transform: translateX(0);
        opacity: 1;
    }

    .sidebar.closed {
        transform: translateX(-100%);
        opacity: 0;
    }

    .system-event {
        max-width: 90%;
        margin: 8px auto;
    }

    .event-avatar {
        width: 20px;
        height: 20px;
    }

    .event-content {
        padding: 4px 10px;
        font-size: 11px;
        flex-direction: column;
        gap: 2px;
        align-items: flex-start;
    }

    .event-text {
        white-space: normal;
        text-align: center;
        width: 100%;
    }

    .event-time {
        align-self: flex-end;
        font-size: 9px;
    }

    .auth-container {
        padding: 20px 16px;
    }

    .auth-actions {
        flex-direction: column;
    }

    .auth-actions .mdui-btn {
        width: 100%;
    }

    #chat-function {
        position: fixed;
        top: var(--header-height);
        right: 0;
        width: 100%;
        height: calc(100vh - var(--header-height));
        transform: translateX(100%);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
        z-index: 2000;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    }

    #chat-functions:not(.closed) {
        transform: translateX(0);
        opacity: 1;
    }

    #chat-functions.closed {
        transform: translateX(100%);
        opacity: 0;
    }

    .message-content-wrapper {
        max-width: 85%;
    }

    .scroll-to-bottom-btn {
        bottom: 90px;
        right: 15px;
    }

    /* 移动端用户信息调整 */
    .user-info {
        padding: 10px 12px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        margin-right: 10px;
    }

    .user-name {
        font-size: 13px;
    }

    .user-status {
        font-size: 11px;
    }

    .user-actions .mdui-btn {
        width: 28px;
        height: 28px;
    }

    .user-actions .mdui-icon {
        font-size: 16px;
    }
}

/* 手机设备 */
@media (max-width: 480px) {
    .user-info {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .user-avatar {
        margin-right: 0;
        margin-bottom: 8px;
    }

    .user-actions {
        justify-content: center;
        margin-top: 4px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .message-avatar-container {
        margin: 0 8px;
    }

    .message-content-wrapper {
        max-width: 90%;
    }

    .message-area {
        padding: 12px;
    }

    /* 确保侧边栏不会溢出 */
    .sidebar {
        width: 100vw;
    }
}