/* ====== 全局重置 ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #ededed;
    color: #333;
    font-size: 15px;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
input { border: none; outline: none; font-family: inherit; }

/* ====== 聊天容器 ====== */
.chat-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 500px;
    margin: 0 auto;
    background: #ededed;
    position: relative;
}

/* ====== 状态栏 ====== */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px 4px;
    background: #ededed;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

.status-time {
    letter-spacing: 0.5px;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-icon {
    width: 18px;
    height: 12px;
    color: #333;
}

.status-icon.wifi {
    width: 16px;
    height: 12px;
}

.battery {
    display: flex;
    align-items: center;
    gap: 1px;
}

.battery-body {
    display: block;
    width: 24px;
    height: 12px;
    border: 1px solid #333;
    border-radius: 3px;
    padding: 1px;
    position: relative;
}

.battery-level {
    display: block;
    width: 80%;
    height: 100%;
    background: #333;
    border-radius: 1px;
}

.battery-cap {
    display: block;
    width: 2px;
    height: 5px;
    background: #333;
    border-radius: 0 1px 1px 0;
}

/* ====== 导航栏 ====== */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px;
    background: #ededed;
    flex-shrink: 0;
    height: 44px;
}

.nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    border-radius: 50%;
    transition: background 0.2s;
}

.nav-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.nav-btn svg {
    width: 24px;
    height: 24px;
}

.nav-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: #333;
}

/* ====== 聊天区域 ====== */
.chat-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 16px;
    -webkit-overflow-scrolling: touch;
}

/* ====== 进入通知 ====== */
.chat-notification {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 8px 0;
    margin-bottom: 8px;
}

/* ====== 猜你想问卡片 ====== */
.welcome-card {
    display: flex;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.welcome-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    min-width: 64px;
    background: #f0fbf4;
    border-right: 1px solid #e8f5ee;
}

.welcome-vertical {
    writing-mode: vertical-rl;
    text-orientation: upright;
    color: #07c160;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 4px;
    line-height: 1.4;
}

.welcome-bulb {
    width: 22px;
    height: 22px;
    color: #07c160;
    margin-top: 10px;
}

.welcome-right {
    flex: 1;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.welcome-hot-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.welcome-hot-link {
    font-size: 14px;
    color: #576b95;
    transition: opacity 0.2s;
}

.welcome-hot-link:active {
    opacity: 0.6;
}

.welcome-dot {
    position: absolute;
    bottom: 8px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #07c160;
    border-radius: 50%;
}

/* ====== 常用功能卡片 ====== */
.function-card {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.function-title {
    font-size: 15px;
    font-weight: 700;
    color: #1890ff;
    margin-bottom: 12px;
}

.function-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.function-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    background: linear-gradient(135deg, #3b7fd9, #2c5fb3);
    border-radius: 10px;
    transition: transform 0.15s, box-shadow 0.15s;
    aspect-ratio: 1;
    min-height: 70px;
}

.function-btn:active {
    transform: scale(0.95);
}

.function-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.function-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
    stroke: #fff;
}

.function-label {
    font-size: 11px;
    color: #fff;
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
}

/* ====== 消息项 ====== */
.msg-item {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
}

.msg-admin {
    flex-direction: row;
}

.msg-user {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #07c160;
}

.msg-avatar svg {
    width: 100%;
    height: 100%;
}

.msg-user .msg-avatar {
    background: #1890ff;
}

.msg-body {
    max-width: 75%;
    margin: 0 10px;
    display: flex;
    flex-direction: column;
}

.msg-user .msg-body {
    align-items: flex-end;
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
}

.msg-name {
    color: #888;
    font-weight: 500;
}

.msg-time {
    color: #bbb;
    font-size: 11px;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 15px;
    word-break: break-all;
    position: relative;
}

.msg-bubble-admin {
    background: #fff;
    color: #333;
    border-top-left-radius: 0;
}

.msg-bubble-user {
    background: #95ec69;
    color: #000;
    border-top-right-radius: 0;
}

.msg-link {
    color: #576b95;
}

.msg-link:active {
    opacity: 0.6;
}

/* ====== 底部输入栏 ====== */
.input-bar {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: #f7f7f7;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
    gap: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.input-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.2s;
}

.input-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.input-btn svg {
    width: 26px;
    height: 26px;
}

.input-text {
    flex: 1;
    height: 36px;
    border-radius: 6px;
    background: #fff;
    padding: 0 12px;
    font-size: 15px;
    border: 1px solid #ddd;
}

.input-text:focus {
    border-color: #07c160;
}

/* ====== 发送按钮状态 ====== */
.input-text.has-content + .input-btn .send-text {
    display: inline;
}

/* ====== 滚动条美化 ====== */
.chat-area::-webkit-scrollbar {
    width: 0;
}

/* ====== 响应式 ====== */
@media (min-width: 501px) {
    body {
        background: #f0f0f0;
    }
    .chat-app {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
}
