/**
 * 聊天框样式 v2.0（适中版）
 * 比原始略大，比紧凑版宽松，登录框精简
 */

*,
::before,
::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #eef1f4;
}

body {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #ffffff;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.06);
}

/* ===== 顶部 ===== */
.top {
    flex-shrink: 0;
    background: #ffffff;
    border-bottom: 1px solid #e8ecf0;
    height: 52px;
    line-height: 52px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    padding: 0 16px;
    letter-spacing: 0.5px;
}
.top .name {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== 聊天区域 ===== */
.mk-chat-box {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 12px 6px 12px;
    background: #f8fafc;
    scroll-behavior: smooth;
}
.mk-chat-box::-webkit-scrollbar {
    width: 5px;
}
.mk-chat-box::-webkit-scrollbar-track {
    background: transparent;
}
.mk-chat-box::-webkit-scrollbar-thumb {
    background: #d0d7de;
    border-radius: 10px;
}
.mk-chat-box::-webkit-scrollbar-thumb:hover {
    background: #b0b8c0;
}

/* ===== 输入区域 ===== */
.write {
    flex-shrink: 0;
    height: 56px;
    width: 100%;
    background: #ffffff;
    border-top: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    padding: 0 12px 0 16px;
    gap: 8px;
}
.write input {
    flex: 1;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #dce1e6;
    border-radius: 20px;
    font-size: 15px;
    background: #f5f7fa;
    transition: all 0.25s ease;
    outline: none;
}
.write input:focus {
    border-color: #4facfe;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.12);
}
.write input::placeholder {
    color: #9aa3ae;
}

.send {
    flex-shrink: 0;
    width: 64px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 20px;
    background: linear-gradient(135deg, #4facfe 0%, #00c6fb 100%);
    color: #fff;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    user-select: none;
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.28);
}
.send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.35);
}
.send:active {
    transform: scale(0.95);
}
.send.disabled {
    background: #cdd5de;
    box-shadow: none;
    pointer-events: none;
}

/* ===== 消息条目 ===== */
.mk-chat-box .msg {
    display: flex;
    align-items: flex-start;
    margin: 6px 0;
    animation: fadeInUp 0.2s ease;
}
.mk-chat-box .right {
    flex-direction: row-reverse;
    margin-left: 56px;
}
.mk-chat-box .left {
    flex-direction: row;
    margin-right: 56px;
}

/* 头像 */
.mk-chat-box img.head {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
    background: #e8ecf0;
}
.mk-chat-box .right img.head {
    margin-left: 8px;
}
.mk-chat-box .left img.head {
    margin-right: 8px;
}

/* 消息主体 */
.mk-chat-box .msg-body {
    max-width: 78%;
    display: flex;
    flex-direction: column;
}
.mk-chat-box .name {
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
    margin: 0 0 2px 0;
    line-height: 1.3;
    padding: 0 4px;
}
.mk-chat-box .right .name {
    text-align: right;
}
.mk-chat-box .left .name {
    text-align: left;
}

/* 气泡 */
.mk-chat-box .content {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.mk-chat-box .right .content {
    background: linear-gradient(135deg, #4facfe 0%, #00c6fb 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}
.mk-chat-box .left .content {
    background: #ffffff;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

/* 尖角 */
.mk-chat-box .right .content::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 14px;
    border-left: 7px solid #4facfe;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}
.mk-chat-box .left .content::after {
    content: '';
    position: absolute;
    left: -6px;
    top: 14px;
    border-right: 7px solid #ffffff;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.mk-chat-box .content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}
.mk-chat-box .content a {
    color: #007bff;
    text-decoration: none;
}
.mk-chat-box .content a:hover {
    text-decoration: underline;
}

/* ===== 系统提示 ===== */
.mk-chat-box .tips {
    text-align: center;
    margin: 14px 0;
    font-size: 13px;
}
.mk-chat-box .tips span {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 30px;
    background: rgba(0, 0, 0, 0.05);
    color: #5a6a7a;
    font-size: 12px;
    letter-spacing: 0.2px;
}
.mk-chat-box .tips .tips-primary { background: #4facfe; color: #fff; }
.mk-chat-box .tips .tips-success { background: #51cf66; color: #fff; }
.mk-chat-box .tips .tips-info { background: #22b8cf; color: #fff; }
.mk-chat-box .tips .tips-warning { background: #fcc419; color: #fff; }
.mk-chat-box .tips .tips-danger { background: #ff6b6b; color: #fff; }

/* ===== 底部 ===== */
.foot {
    flex-shrink: 0;
    text-align: center;
    font-size: 12px;
    color: #8a9aa8;
    padding: 8px 0;
    background: #f8fafc;
    border-top: 1px solid #e8ecf0;
}
.foot a {
    color: #4facfe;
    text-decoration: none;
}
.foot a:hover {
    text-decoration: underline;
}

/* ===== 登录界面（输入框调小） ===== */
.login {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f8fafc;
}
.login input {
    width: 80%;
    max-width: 300px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid #dce1e6;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    background: #ffffff;
    transition: border-color 0.25s;
}
.login input:focus {
    border-color: #4facfe;
}
.login .send {
    width: 80%;
    max-width: 300px;
    height: 36px;
    line-height: 36px;
    border-radius: 18px;
    margin-top: 10px;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.25);
}
.login .send:hover {
    transform: translateY(-1px);
}

/* ===== 动画 ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 移动端适配 ===== */
@media (max-width: 600px) {
    .mk-chat-box .right {
        margin-left: 28px;
    }
    .mk-chat-box .left {
        margin-right: 28px;
    }
    .mk-chat-box .msg-body {
        max-width: 88%;
    }
    .write {
        padding: 0 8px;
        height: 50px;
    }
    .write input {
        font-size: 14px;
        height: 36px;
    }
    .send {
        width: 56px;
        height: 36px;
        line-height: 36px;
        font-size: 14px;
    }
    .mk-chat-box img.head {
        width: 30px;
        height: 30px;
    }
    .mk-chat-box .content {
        font-size: 14px;
        padding: 6px 12px;
    }
    .login input,
    .login .send {
        max-width: 260px;
        height: 34px;
        font-size: 14px;
    }
}