.upload-progress-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.3);
}

.upload-circle-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    cursor: pointer;
    transition: transform 0.2s;
    pointer-events: auto;
    animation: uploadCircleIn 0.3s ease;
}

@keyframes uploadCircleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.upload-circle-wrap:hover {
    transform: scale(1.08);
}

.upload-circle-wrap:active {
    transform: scale(0.95);
}

.upload-circle-outer {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    position: relative;
    background: rgba(0, 0, 0, 0.08);
}

.upload-circle-inner {
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border-radius: 50%;
    background: #fff;
}

.upload-circle-cancel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #999;
    font-weight: 300;
    line-height: 1;
    pointer-events: none;
    transition: color 0.2s;
    z-index: 1;
}

.upload-circle-wrap:hover .upload-circle-cancel {
    color: #ff4d4f;
}

.upload-circle-filename {
    margin-top: 6px;
    font-size: 11px;
    color: #666;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    pointer-events: auto;
}

.upload-error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.2s ease;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.upload-error-dialog {
    background: #fff;
    border-radius: 12px;
    width: 340px;
    max-width: 90vw;
    overflow: hidden;
    animation: dialogSlideIn 0.3s ease;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.upload-error-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px 12px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.upload-error-icon {
    font-size: 20px;
}

.upload-error-body {
    padding: 0 20px 16px;
}

.upload-error-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #ff4d4f;
    line-height: 1.5;
}

.upload-error-bullet {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 14px;
}

.upload-suggestion-title {
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #faad14;
}

.upload-suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.upload-suggestion-bullet {
    flex-shrink: 0;
    color: #faad14;
    font-size: 14px;
}

.upload-error-footer {
    padding: 12px 20px 16px;
    display: flex;
    justify-content: center;
}

.upload-error-btn {
    background: linear-gradient(270deg, #1890ff, #3875ea);
    color: #fff;
    border: none;
    padding: 8px 40px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-error-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.upload-error-btn:active {
    transform: scale(0.97);
}

.upload-success-toast {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100000;
    animation: toastIn 0.3s ease;
    transition: all 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.upload-success-icon {
    color: #52c41a;
    font-size: 18px;
}

/* ==================== 移动端适配样式 ==================== */

/* 基础响应式设置 */
@media screen and (max-width: 768px) {
    /* 防止页面横向滚动 */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* 登录页面容器适配 */
    .login-container,
    .login-wrapper {
        width: 100% !important;
        padding: 20px 15px !important;
        min-height: 100vh;
        box-sizing: border-box;
    }
    
    /* 登录卡片适配 */
    .login-card,
    .ivu-card,
    .ivu-card-body {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 20px 15px !important;
        box-sizing: border-box;
    }
    
    /* 表单元素适配 */
    .ivu-form {
        width: 100% !important;
    }
    
    .ivu-form-item {
        margin-bottom: 18px !important;
    }
    
    .ivu-input-wrapper,
    .ivu-input {
        width: 100% !important;
        font-size: 16px !important; /* 防止 iOS 缩放 */
        height: 44px !important;
        line-height: 44px !important;
    }
    
    /* 按钮适配 */
    .ivu-btn,
    .login-btn,
    .submit-btn {
        width: 100% !important;
        height: 46px !important;
        font-size: 16px !important;
        margin-top: 10px !important;
    }
    
    /* 验证码适配 */
    .captcha-wrapper,
    .code-input-wrapper {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .captcha-wrapper .ivu-input-wrapper,
    .code-input-wrapper .ivu-input-wrapper {
        width: 100% !important;
    }
    
    .captcha-img,
    .code-img {
        width: 100% !important;
        height: 44px !important;
        margin-left: 0 !important;
    }
    
    /* Logo/标题适配 */
    .login-logo,
    .login-title {
        text-align: center !important;
        margin-bottom: 20px !important;
    }
    
    .login-logo img,
    .logo-img {
        max-width: 150px !important;
        height: auto !important;
    }
    
    /* 背景图适配 */
    .login-bg,
    .bg-wrapper {
        background-size: cover !important;
        background-position: center !important;
    }
    
    /* 文字链接适配 */
    .login-links,
    .form-footer {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    /* 复选框适配 */
    .ivu-checkbox-wrapper {
        font-size: 14px !important;
    }
    
    /* 表格横向滚动 */
    .ivu-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* 侧边栏适配 */
    .layout-wrapper,
    .ivu-layout {
        min-height: 100vh !important;
    }
    
    /* 导航适配 */
    .ivu-tabs-nav {
        flex-wrap: wrap !important;
    }
    
    /* 弹窗适配 */
    .ivu-modal {
        margin: 10px !important;
        width: calc(100% - 20px) !important;
        max-width: 100% !important;
    }
    
    .ivu-modal-header,
    .ivu-modal-body,
    .ivu-modal-footer {
        padding: 15px !important;
    }
    
    /* 标签适配 */
    .ivu-tag {
        margin-bottom: 5px !important;
        display: inline-block !important;
    }
}

/* 小屏幕手机适配 */
@media screen and (max-width: 480px) {
    .login-card,
    .ivu-card {
        border-radius: 12px !important;
    }
    
    .ivu-input-wrapper,
    .ivu-input {
        height: 42px !important;
        line-height: 42px !important;
    }
    
    .ivu-btn {
        height: 44px !important;
        border-radius: 8px !important;
    }
}

/* 横屏适配 */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .login-container,
    .login-wrapper {
        padding: 15px !important;
    }
    
    .login-card {
        margin: 10px auto !important;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .ivu-btn,
    .ivu-select,
    .ivu-input,
    a {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* 增大点击区域 */
    .clickable {
        padding: 10px 0 !important;
    }
}

/* 针对具体登录页面的样式增强 */
@media screen and (max-width: 768px) {
    /* 确保登录表单居中显示 */
    .login-page,
    .admin-login {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        min-height: 100vh !important;
    }

    /* 优化背景图片在移动端的显示 */
    [class*="bg"] {
        background-attachment: scroll !important;
    }

    /* 防止键盘弹出时页面布局错乱 */
    .form-container {
        padding-bottom: 20px !important;
    }
}

/* ==================== 图片预览样式 ==================== */

.chat-image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: chatImagePreviewFadeIn 0.25s ease;
    -webkit-user-select: none;
    user-select: none;
}

/* 图片允许选择和长按，以触发系统保存菜单 */
.chat-image-preview-overlay .chat-image-preview-img {
    -webkit-user-select: auto;
    user-select: auto;
    -webkit-touch-callout: default;
}

@keyframes chatImagePreviewFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.chat-image-preview-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
    overflow: visible;
    pointer-events: none;
}

.chat-image-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity 0.15s ease;
    -webkit-user-drag: none;
    will-change: transform;
    /* 允许浏览器原生长按保存菜单 */
    -webkit-touch-callout: default;
    touch-action: pan-x pan-y;
    pointer-events: auto;
}

.chat-image-preview-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000001;
    transition: background 0.2s;
    pointer-events: auto;
}

.chat-image-preview-close:active {
    background: rgba(255, 255, 255, 0.4);
}

.chat-image-preview-save {
    position: fixed;
    top: 16px;
    right: 62px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000000;
    transition: background 0.2s;
}

.chat-image-preview-save:active {
    background: rgba(255, 255, 255, 0.4);
}

.chat-image-preview-counter {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 16px;
    border-radius: 20px;
    z-index: 1000000;
}

.chat-image-preview-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000000;
    transition: background 0.2s;
    line-height: 1;
}

.chat-image-preview-nav:active {
    background: rgba(255, 255, 255, 0.35);
}

.chat-image-preview-prev {
    left: 12px;
}

.chat-image-preview-next {
    right: 12px;
}

/* 长按保存菜单 */
.chat-image-save-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: chatImagePreviewFadeIn 0.2s ease;
}

.chat-image-save-menu {
    background: #fff;
    border-radius: 12px 12px 0 0;
    width: 100%;
    max-width: 500px;
    padding: 8px 0;
    animation: chatImageSaveMenuSlideUp 0.25s ease;
}

@keyframes chatImageSaveMenuSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.chat-image-save-menu-item {
    padding: 16px 24px;
    font-size: 16px;
    color: #333;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.chat-image-save-menu-item:active {
    background: #f5f5f5;
}

.chat-image-save-menu-cancel {
    margin-top: 8px;
    border-top: 8px solid #f5f5f5;
    color: #999;
    font-weight: 500;
}

/* 聊天图片可点击提示 */
.chart_list_item_img {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
}

.chart_list_item_img img {
    -webkit-user-drag: none;
    transition: opacity 0.15s ease;
}

.chart_list_item_img:active img {
    opacity: 0.85;
}

/* 预览界面长按提示 */
.chat-image-preview-longpress-hint {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 14px;
    border-radius: 16px;
    z-index: 1000000;
    transition: opacity 0.5s ease;
    white-space: nowrap;
}

/* 保存加载中 */
.chat-image-save-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 20px 28px;
    border-radius: 10px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    animation: chatImagePreviewFadeIn 0.2s ease;
}

.chat-image-save-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: chatImageSaveSpin 0.8s linear infinite;
}

@keyframes chatImageSaveSpin {
    to { transform: rotate(360deg); }
}

/* 保存提示弹窗 */
.chat-image-save-hint {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: chatImagePreviewFadeIn 0.2s ease;
}

.chat-image-save-hint-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.chat-image-save-hint-text {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.chat-image-save-hint-btn {
    display: inline-block;
    background: linear-gradient(270deg, #1890ff, #3875ea);
    color: #fff;
    border: none;
    padding: 8px 32px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* 预览图片允许原生长按 */
.chat-image-preview-img {
    -webkit-touch-callout: default;
}
