/* ---------------- 聊天容器 ---------------- */
.wp-ajax-chat-container {
    width: 100%;
    max-width: 400px;
    margin: 10px auto;
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 80vh;
    border-radius: 14px;

    /* ✅ 修改 */
    background: #111;
    border: 2px solid #444;

    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

/* ---------------- 消息区 ---------------- */
.wp-ajax-chat-box {
    padding: 14px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;

    /* ✅ 修改 */
    background: linear-gradient(180deg,#0f0f0f 0%,#1a1a1a 100%);

    scroll-behavior: smooth;
}

/* ---------------- 消息气泡 ---------------- */
.chat-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    position: relative;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.chat-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

/* ✅ 对方气泡（改为深灰高对比） */
.bubble-left {
    background: #2a2a2a;
    color: #f1f1f1;
    align-self: flex-start;
    border-radius: 18px 18px 18px 6px;
    border: 1px solid #3a3a3a;
}

/* ✅ 我的气泡（稍微提亮） */
.bubble-right {
    background: linear-gradient(135deg,#2b9cff,#00c6ff);
    color: #fff;
    align-self: flex-end;
    border-radius: 18px 18px 6px 18px;
}

/* ---------------- 用户名和时间 ---------------- */
.chat-name {
    font-size: 12px;

    /* ✅ 修改 */
    color: rgba(255,255,255,0.6);

    margin-bottom: 4px;
}

.bubble-right .chat-name {
    color: rgba(255,255,255,0.9);
}

.chat-time {
    font-size: 11px;

    /* ✅ 修改 */
    color: rgba(255,255,255,0.4);

    margin-top: 6px;
    text-align: right;
}

.bubble-right .chat-time {
    color: rgba(255,255,255,0.75);
}

/* ---------------- 消息内容 ---------------- */
.chat-message-content {
    white-space: pre-wrap;
}

/* ---------------- 图片消息 ---------------- */
.chat-img {
    max-width: 180px;
    border-radius: 12px;
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-img:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* ---------------- 输入区 ---------------- */
.wp-ajax-chat-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #333;

    /* ✅ 修改 */
    background: #111;
}

.wp-ajax-chat-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;

    /* ✅ 修改 */
    border: 1px solid #333;
    background: #1a1a1a;
    color: #fff;

    font-size: 16px;
    outline: none;
}

.wp-ajax-chat-input:focus {
    border-color: #2b9cff;
}

.wp-ajax-chat-send,
.wp-ajax-chat-upload {
    width: 100%;
    padding: 12px;
    border-radius: 14px;
    font-size: 16px;
    border: none;
    cursor: pointer;
}

.wp-ajax-chat-send {
    background: #2b9cff;
    color: #fff;
}

.wp-ajax-chat-upload {
    background: #4CAF50;
    color: #fff;
}

.wp-ajax-chat-send:hover,
.wp-ajax-chat-upload:hover {
    filter: brightness(1.05);
}

.wp-ajax-chat-send:active {
    transform: translateY(1px);
}

.wp-ajax-chat-send[disabled] {
    opacity: 0.6;
    cursor: default;
}

/* ---------------- 手机端优化 ---------------- */
@media (max-width:600px) {
    .wp-ajax-chat-container {
        height: calc(100vh - 70px);
        border-radius: 0;
    }
    .chat-bubble { font-size: 15px; }
}

@media (max-width:420px) {
    .wp-ajax-chat-container {
        height: calc(100vh - 56px);
    }
    .chat-bubble { font-size: 14px; }
}

/* ---------------- Lightbox ---------------- */
.chat-lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
}

.chat-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 14px;
    box-shadow: 0 0 30px rgba(0,0,0,0.7);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.5); opacity:0; }
    to { transform: scale(1); opacity:1; }
}