/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1e3a8a;
    --primary-2: #2563eb;
    --primary-3: #3b82f6;
    --accent: #f59e0b;
    --accent-2: #f97316;
    --bg: #eef2f7;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
}

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(1000px 500px at 15% -10%, rgba(59, 130, 246, .16), transparent 60%),
        radial-gradient(800px 400px at 100% 0%, rgba(245, 158, 11, .12), transparent 55%),
        var(--bg);
    color: var(--text);
    overflow: hidden;
}

/* ============ 全屏布局 ============ */
.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============ 顶部横幅 ============ */
.banner-wrap {
    flex-shrink: 0;
    background: #0f2557;
}

.banner-img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
}

/* ============ 聊天区域 ============ */
.chat-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
}

.chat-card {
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(30, 58, 138, .16);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    border: 1px solid rgba(30, 58, 138, .08);
}

.chat-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    background: linear-gradient(90deg, #f8fafc, #eef4ff);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.cs-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
    background: #dbeafe;
}

.cs-name { font-size: 16px; font-weight: 700; color: var(--primary); }

.cs-status {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #34d399;
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.head-right { margin-left: auto; }
.head-icon { color: var(--accent); font-size: 18px; }

/* ============ 消息区 ============ */
.chat-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background:
        radial-gradient(600px 300px at 90% 0%, rgba(59, 130, 246, .07), transparent 60%),
        linear-gradient(180deg, #fbfdff, #f3f7fc);
}

.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.msg { display: flex; gap: 10px; max-width: 76%; animation: slideUp .35s ease; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg.cs { align-self: flex-start; }

.msg .m-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
    border: 2px solid #fff; box-shadow: 0 2px 8px rgba(30, 58, 138, .2);
    background: #dbeafe;
}

.msg .m-body { display: flex; flex-direction: column; gap: 6px; }

.msg .m-name { font-size: 11.5px; color: var(--muted); }

.bubble {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px 14px 14px 4px;
    padding: 13px 17px;
    font-size: 15px;
    line-height: 1.75;
    box-shadow: 0 2px 8px rgba(30, 58, 138, .06);
}

/* 消息内按钮 */
.bubble-actions {
    margin-top: 13px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .2s;
}

.action-btn:hover { transform: translateY(-2px); }
.action-btn:active { transform: scale(.97); }
.action-btn:disabled { opacity: .5; cursor: default; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 6px 16px rgba(249, 115, 22, .35);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 10px 22px rgba(249, 115, 22, .45);
}

.btn-ghost {
    background: #fff;
    color: var(--muted);
    border: 1.5px solid var(--line);
}

.btn-ghost:hover:not(:disabled) { border-color: #f87171; color: #ef4444; }

.btn-cta {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-2), var(--primary-3));
    color: #fff;
    font-size: 15.5px;
    padding: 14px 18px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}

.btn-cta:hover:not(:disabled) { box-shadow: 0 12px 26px rgba(37, 99, 235, .45); }

.btn-cta-ghost {
    background: #fff;
    color: var(--primary-2);
    border: 2px solid var(--primary-3);
    box-shadow: none;
}

.btn-cta-ghost:hover:not(:disabled) {
    box-shadow: 0 8px 18px rgba(37, 99, 235, .2);
    background: #eef4ff;
}

.cta-hint {
    font-size: 11.5px;
    color: var(--muted);
    text-align: center;
    margin-top: 6px;
}

/* 输入中 */
.typing { display: flex; gap: 10px; align-items: flex-end; }

.typing .bubble {
    padding: 15px 20px;
    display: flex;
    gap: 5px;
}

.typing .bubble i {
    width: 7px; height: 7px; border-radius: 50%;
    background: #9ca3af;
    animation: bounce 1.3s infinite;
}

.typing .bubble i:nth-child(2) { animation-delay: .2s; }
.typing .bubble i:nth-child(3) { animation-delay: .4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* 响应式 */
@media (max-width: 640px) {
    .banner-img { height: 150px; }
    .chat-wrap { padding: 8px; }
    .msg { max-width: 92%; }
    .chat-body { padding: 16px; }
}
