/* 移动端适配样式 */
@media (max-width: 768px) {
    /* 显示移动端菜单按钮 */
    .menu-btn {
        display: flex !important;
    }
    
    /* 隐藏桌面端控制按钮 */
    .refresh-btn,
    .minimize-btn {
        display: none !important;
    }
    
    .login-container {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }

    .chat-page {
        padding: 10px;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        margin-bottom: 10px;
    }

    .main-content {
        margin-left: 0;
    }

    .user-sections {
        height: 200px;
    }

    .messages {
        height: calc(100vh - 350px);
    }

    .input-area {
        padding: 10px;
    }

    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    .input-group input {
        width: 100%;
    }

    .button-group {
        flex-direction: column;
        width: 100%;
    }

    .button-group button {
        width: 100%;
        margin: 5px 0;
    }

    .file-upload-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .modal {
        width: 95%;
        margin: 10px;
    }

    .voice-call-modal {
        width: 95%;
        height: 90vh;
        margin: 10px;
    }

    .paste-preview {
        width: 95%;
        padding: 15px;
    }

    .toast {
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        max-width: 90%;
        width: auto;
        text-align: center;
    }
    
    .toast.show {
        transform: translate(-50%, -50%) scale(1);
    }
    
    /* 移动端图片消息优化 */
    .message-bubble img {
        max-width: 120px !important;
        max-height: 120px !important;
        width: auto !important;
        height: auto !important;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        object-fit: cover;
        touch-action: manipulation;
        transition: transform 0.1s ease !important;
    }
    
    /* 移动端图片消息悬停效果优化 */
    .message-bubble img:hover {
        transform: scale(1.05) !important;
    }
    
    /* 移动端图片消息点击反馈 */
    .message-bubble img:active {
        transform: scale(0.95) !important;
        opacity: 0.8;
    }
    
    /* 图片预览模态框移动端优化 */
    .image-preview-modal {
        width: 95% !important;
        height: 90vh !important;
        margin: 5vh auto !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
    
    .image-preview-content img {
        max-width: 100% !important;
        max-height: 70vh !important;
        width: auto !important;
        height: auto !important;
    }
    
    /* 移动端图片预览模态框关闭按钮优化 */
    .close-preview {
        top: 15px !important;
        right: 15px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 28px !important;
        background: rgba(0, 0, 0, 0.7) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
    }
    
    /* 移动端图片预览内容区域优化 */
    .image-preview-content {
        padding: 60px 20px 20px !important;
        height: 100% !important;
    }
    
    /* 移动端图片预览缩放行为优化 */
    #previewImage {
        cursor: default !important;
        transition: none !important;
    }
    
    #previewImage:active {
        transform: none !important;
        cursor: default !important;
    }
    
    /* 移动端双击缩放支持 */
    #previewImage {
        touch-action: manipulation !important;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 15px;
    }

    .login-container h2 {
        font-size: 24px;
    }

    .input-area {
        padding: 5px;
    }

    .button-group button {
        padding: 8px 12px;
        font-size: 14px;
    }

    .user-item {
        padding: 8px 5px;
    }

    .username {
        font-size: 14px;
    }

    .message {
        padding: 8px;
    }

    .message-content {
        font-size: 14px;
    }

    .timestamp {
        font-size: 11px;
    }
    
    /* 超小屏幕图片消息优化 */
    .message-bubble img {
        max-width: 100px !important;
        max-height: 100px !important;
    }
    
    /* 超小屏幕图片预览关闭按钮 */
    .close-preview {
        width: 45px !important;
        height: 45px !important;
        font-size: 24px !important;
        top: 10px !important;
        right: 10px !important;
    }
    
    /* 超小屏幕图片预览内容区域 */
    .image-preview-content {
        padding: 50px 15px 15px !important;
    }
}