:root {
    --primary-pink: #fdb4ed;
    --deep-pink: #E83E8C;
    --light-pink: #FFF0F5;
    --text-dark: #333;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #FFF5F9;
    height: 100vh;
    color: var(--text-dark);
}

/* 主容器 */
.container {
    width: 100%; max-width: 500px; margin: 0 auto;
    background: white; height: 100vh;
    display: flex; flex-direction: column;
    box-shadow: 0 0 20px rgba(255,77,148,0.15);
    position: relative;
}

/* Header */
.header {
    width: 100%;
    height: auto;           /* 改为自动高度 */
    background: none;
    position: relative;
    overflow: hidden;
}

/* ==================== Banner 轮播 ==================== */
.banner-slider {
    position: relative;
    width: 100%;
    height: auto;           /* 改为自动 */
}

.banner-slider .slides {
    display: flex;
    height: 100%;
    transition: transform 0.6s ease;
}

.banner-slider img {
    width: 100%;
    height: auto;           /* 关键：让高度按比例自适应 */
    display: block;         /* 消除下方间隙 */
    object-fit: contain;    /* 确保显示全貌 */
}

.banner-dots {
    position: absolute;
    bottom: 8px;	/* 向下微调一点，避免遮挡 */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}

.banner-dots span {
    width: 7px;
    height: 7px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    transition: 0.3s;
}

.banner-dots span.active {
    background: #fff;
    width: 20px;
    border-radius: 3px;
}

/* 聊天UI核心修复：给底部导航留空间 */
#chat-ui {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* 适配移动端浏览器工具栏 */
    overflow: hidden;
}

.chat-box, #appoint-panel {
    flex: 1; 
    overflow-y: auto; 
    padding: 15px 15px 20px;  /* 底部只需要留 20px 间距即可，不再需要 120px */
    background: #FFF5F9;
}

/* 消息气泡 */
.msg {
    margin: 10px 0; padding: 11px 15px; border-radius: 20px;
    max-width: 78%; line-height: 1.45; font-size: 15.5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.msg.customer { background: var(--primary-pink); color: white; align-self: flex-end; margin-left: auto; border-bottom-right-radius: 5px; }
.msg.agent { background: white; color: var(--text-dark); align-self: flex-start; border: 1px solid #ffe0ee; border-bottom-left-radius: 5px; }
.msg img { max-width: 220px; border-radius: 14px; margin: 6px 0; display: block; }
.msg small { display: block; font-size: 11px; opacity: 0.75; margin-top: 4px; }

/* 输入区 - 相机图标 + 防溢出 */
#img-input {
    display: none; 
}
.input-area {
    padding: 10px 12px;
    background: white;
    border-top: 1px solid #ffe0ee;
    display: flex;
    gap: 8px;
    align-items: center;
    /* 移除针对 iOS 的 padding-bottom，因为底部的导航栏已经处理了安全区域 */
    padding-bottom: 10px; 
    position: relative;
    z-index: 150;
}
.input-area input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 1.5px solid #ffccdd;
    border-radius: 20px;
    outline: none;
    font-size: 16px;
}
.input-area button {
    padding: 0 24px; height: 46px; background: var(--primary-pink);
    color: white; border: none; border-radius: 30px; font-weight: 600;
}
.input-area label {
    font-size: 26px;
    color: var(--primary-pink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 底部导航栏 */
.bottom-nav {
    /* 1. 去掉固定定位 */
    position: relative; 
    bottom: auto;
    left: auto;
    transform: none;
    
    /* 2. 保持宽度和背景 */
    width: 100%; 
    max-width: 500px; 
    background: white;
    border-top: 1px solid #ffe0ee; 
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -3px 12px rgba(255,77,148,0.18); 
    z-index: 200;
    
    /* 3. 适配 iOS 安全区域 */
    padding: 6px 0 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav > div {
    flex: 1;
    text-align: center;
    padding: 8px 0 4px;
    color: #888;
    font-size: 12.5px;
    transition: all 0.2s;
}

.bottom-nav > div.active {
    color: var(--primary-pink);
    font-weight: 600;
    transform: scale(1.05);
}

/* 群聊弹窗（彻底修复样式） */
#group-selector {
    background: rgba(0,0,0,0.78) !important;
}
#group-selector > div {
    background: white !important;
    width: 88% !important;
    max-width: 340px !important;
    border-radius: 20px !important;
    padding: 24px 20px !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3) !important;
}
#group-selector h3 {
    color: var(--primary-pink) !important;
    text-align: center;
    margin-bottom: 20px !important;
}
.group-item {
    padding: 16px 18px;
    background: #fff9fb;
    margin: 10px 0;
    border-radius: 12px;
    border: 1px solid #ffe0ee;
    font-size: 16px;
    color: #333 !important; /* 强制黑色文字 */
    text-align: left;
    transition: all 0.2s;
}
.group-item:hover {
    background: #FFF0F5;
    color: var(--primary-pink) !important;
    border-color: var(--primary-pink);
}
#group-selector button {
    margin-top: 18px !important;
    background: var(--primary-pink) !important;
    color: white;
    border: none;
    padding: 13px;
    border-radius: 14px;
    width: 100%;
    font-size: 15px;
}


/* === 预约服务卡片 - 最终彻底修复版（按钮100%居中）=== */
.service-card {
    background: white;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: 0 6px 18px rgba(255,77,148,0.12);
    border: 1px solid #ffeef5;
}

.service-img {
    width: 100%;
    /* aspect-ratio: 3 / 4;   强制容器保持 4:3 比例 */
	height: auto;	/* 图片大小自适应，使用800x800像素 */
    overflow: hidden;
    background-color: #f8f8f8; /* 图片加载前的底色 */
}

.service-info {
    padding: 18px 25px 22px;
    /*text-align: center;             保持居中 */
	text-align: left;
}

.service-code {
    display: flex;
    justify-content: space-between;
	align-items: center; /* 确保垂直居中 */
    color: var(--primary-pink);
    font-size: 13px;
    font-weight: bold;
    padding: 0;
	margin: 0 0 8px 0;   /* 明确设置 margin: 上 右 下 左 */
    width: 100%;
}

.service-info .service-desc {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-pink); 
    line-height: 1.6;
    margin: 0 0 18px 0;  /* 明确左边距为 0 */
    text-align: left;
    display: block;
    padding: 0;
    width: 100%;
}

/* ================ 按钮彻底居中修复 ================ */
.service-btn {
    display: block !important;     /* 强制 block */
    width: 86% !important;         /* 宽度适中 */
    margin: 0 auto !important;     /* 水平居中核心 */
    padding: 14px 0 !important;
    background: linear-gradient(135deg, #fdb4ed, #FF75AD);
    color: white !important;
    border: none !important;
    border-radius: 25px !important;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255,77,148,0.28);
    transition: transform 0.2s;
}

.service-btn:active {
    transform: scale(0.96);
}
.service-card h4 { margin: 12px 15px 8px; font-size: 17.5px; color: #333; }
.service-card p { margin: 0 15px 15px; color: #666; font-size: 14px; line-height: 1.5; }
.service-card button {
    width: 100%; margin: 0 15px 15px; padding: 13px;
    background: var(--primary-pink); color: white; border: none;
    border-radius: 12px; font-weight: 600; font-size: 15.5px;
}

/* 登录注册 */
.login-box, .register-box {
    padding: 40px 25px; text-align: center; background: white;
    height: 100vh; display: flex; flex-direction: column; justify-content: center;
}
.login-box h2, .register-box h2 { color: #E83E8C; margin-bottom: 30px; font-size: 26px; }
.login-box input, .register-box input {
    width: 100%; padding: 15px; margin: 10px 0;
    border: 1.5px solid #ffccdd; border-radius: 16px; font-size: 16px;
}
.login-box button, .register-box button {
    width: 100%; padding: 15px; background: var(--primary-pink);
    color: white; border: none; border-radius: 16px; font-size: 17px; font-weight: 600;
}

.empty { color: #ff8eb8; text-align: center; margin: 60px 0; font-style: italic; }
.status.online { color: #4ade80; } .status.offline { color: #f87171; }

/* 状态条容器：Banner下方 */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-bottom: 1px solid #ffe4f0;
}

.status {
    font-size: 14px;
    color: #666;
}

/* 退出按钮美化 */
.logout-btn {
    font-size: 12px;
    color: var(--deep-pink);
    padding: 3px 10px;
    border: 1px solid var(--primary-pink);
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
}

.logout-btn:active {
    background: var(--light-pink);
}


.status-bar {
    padding: 0 !important;
    height: auto !important;
    min-height: 50px;           /* 根据你的图片高度调整 */
    background: transparent !important;
    border-bottom: 1px solid #ffe4f0;
    overflow: hidden;
}

#status-bar-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;          /* 或 contain，根据图片比例选择 */
    border-radius: 0;
}

/* 如果某些 JS 场景需要临时隐藏图片，可保留以下类 */
.status-bar.hidden {
    display: none !important;
}


/* ====================== 支付模拟转圈动画 ====================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 状态条中的标题样式 */
#channel-name {
    color: var(--primary-pink); /* 使用你主页的深粉色 */
    font-size: 16px;         /* 适当字号 */
    font-weight: 700;        /* 加粗更明显 */
    margin-right: 10px;      /* 与后面的状态留出距离 */
    letter-spacing: 1px;     /* 增加一点字间距，更显高级 */
}

/* ==================== 极简图片查看器（仅手势 + 点击退出） ==================== */
.image-viewer {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.96);
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
}

#viewer-img {
    max-width: 100%;
    max-height: 94vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.7);
    object-fit: contain;
    background: #111;
    user-select: none;
}

/* 图片计数器（右下角半透明） */
.viewer-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 14px;
    padding: 5px 14px;
    border-radius: 20px;
    z-index: 10;
    pointer-events: none;   /* 不挡住点击退出 */
    user-select: none;
}

/* ==================== 新增：密码框美化 ==================== */
.password-wrapper {
    position: relative;
    margin: 10px 0;
}
.password-wrapper input {
    width: 100%;
    padding: 15px 45px 15px 15px; /* 给眼睛图标留空间 */
    border: 1.5px solid #ffccdd;
    border-radius: 16px;
    font-size: 16px;
}
.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #999;
    cursor: pointer;
    user-select: none;
}

/* ==================== 简介省略 + 点击展开 ==================== */
.service-desc {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-pink); 
    line-height: 1.6;
    margin: 0 0 18px 0;
    text-align: left;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;           /* 只显示2行 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    position: relative;
    padding-right: 18px;             /* 给省略号留点空间 */
}

.service-desc:hover {
    color: var(--deep-pink);
}

/* 完整简介内容弹窗 */
#full-desc-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

#full-desc-modal > div {
    background: white;
    width: 90%;
    max-width: 420px;
    border-radius: 20px;
    padding: 24px 22px;
    box-shadow: 0 15px 40px rgba(232,62,140,0.3);
    max-height: 78vh;
    overflow-y: auto;
}

#full-desc-modal h3 {
    color: var(--deep-pink);
    margin: 0 0 18px 0;
    text-align: center;
    font-size: 18px;
}

#full-desc-modal .full-text {
    line-height: 1.7;
    font-size: 15.5px;
    color: #333;
    white-space: pre-wrap;
}

/* ====================== 登录/注册切换链接 ====================== */
.switch {
    margin-top: 25px;
    color: #E83E8C;
    font-size: 15px;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
    padding: 8px 16px;
    border-radius: 12px;
    display: inline-block;
}

.switch:hover {
    background: #fff0f5;
    color: #E83E8C;
    transform: scale(1.03);
}

.switch:active {
    transform: scale(0.97);
    background: #fdb4ed;
    color: white;
}

/* ====================== 登录页顶部广告图 ====================== */
.login-ad {
    width: 100%;
    max-width: 420px;
    height: auto;
    margin: 0 auto 28px auto;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(232, 62, 140, 0.18);
    display: block;
    object-fit: cover;
    background: #fff0f5;
}

/* 注册页也复用同一个类，保持一致 */
.register-ad {
    width: 100%;
    max-width: 420px;
    height: auto;
    margin: 0 auto 28px auto;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(232, 62, 140, 0.18);
    display: block;
    object-fit: cover;
}

/* 普通群成员消息（如果需要区分） */
.msg.member {
    background: #f0f0f5;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
}

/* 1. 客服消息气泡容器 */
.msg.agent {
    position: relative;
    background: white;
    color: var(--text-dark);
    align-self: flex-start;
    border: 1px solid #ffe0ee;
    border-bottom-left-radius: 5px;
    
    /* 核心调整 */
    padding: 12px 15px;      
    margin: 10px 10px 25px 60px; /* 左边距稍微加大到 60px，给头像留出呼吸感 */
    min-height: 44px;
}

/* 2. 客服头像 */
.msg.agent::before {
    content: "";
    position: absolute;
    left: -52px;             /* avatar宽度44px，留点空隙 */
    top: 0;                  
    width: 44px;
    height: 44px;
    background: url('/icons/agent-avatar.jpg') center/cover no-repeat;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* 3. 客服名字 - 移动到头像正下方 */
.agent-name {
    position: absolute;
    /* 关键定位逻辑 */
    left: -52px;             /* 与头像的 left 保持一致 */
    width: 44px;             /* 与头像宽度一致，方便居中 */
    top: 48px;               /* 头像高度44px + 4px 间距 */
    
    text-align: center;      /* 文字在 44px 宽度内居中 */
    font-size: 11px;         /* 放在头像下方，字号建议小一点 */
    color: #999;
    font-weight: 400;
    white-space: nowrap;     /* 避免名字换行 */
    
    /* 如果名字太长想让它超出头像宽度居中，可以加下面这两行 */
    /* left: -72px; width: 84px; */ 
}

/* 调整消息内容不要被头像挡住 */
.msg.agent > *:not(.agent-name) {
    margin-left: 0;
}


/* 客服头像下的名称和状态容器 */
.agent-avatar-label {
    position: absolute;
    left: -55px;        /* 对应头像的 left (-52px) 微调居中 */
    top: 48px;          /* 头像高度 44px + 4px 间距 */
    width: 50px;
    text-align: center;
    font-size: 10px;
    color: #999;
    white-space: nowrap;
    line-height: 1.2;
}

/* 状态圆点样式 */
.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 2px;
    vertical-align: middle;
}

.status-dot.online {
    background-color: #4cd964; /* 绿色 */
    box-shadow: 0 0 4px rgba(76, 217, 100, 0.5);
}

.status-dot.offline {
    background-color: #ff3b30; /* 红色 */
}

/* 确保消息容器有足够的底部间距，防止名字重叠 */
.msg.agent {
    margin-bottom: 35px !important; /* 增加下边距给名字留位置 */
}


/* 头像基础样式 */
.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
    top: 0;
}

/* 消息气泡为头像留出位置 */
.msg.has-avatar {
    position: relative;
    padding-left: 45px; /* 非本人消息头像在左侧 */
}

/* 如果是本人消息且有头像（可选） */
.msg.customer.has-avatar {
    padding-left: 15px;
    padding-right: 45px;
}
.msg.customer.has-avatar .user-avatar {
    right: 0; /* 本人头像在右侧 */
}

.msg.member.has-avatar .user-avatar {
    left: 0; /* 其他成员头像在左侧 */
}


/* ==================== 入驻规则 & 表单模态框 ==================== */
#settle-modal, #settle-form-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}

#settle-modal > div, #settle-form-modal > div {
    background: white;
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 15px 40px rgba(232,62,140,0.35);
}

.settle-header {
    padding: 20px 22px 15px;
    text-align: center;
    border-bottom: 1px solid #ffe0ee;
}
.settle-header h3 {
    color: var(--deep-pink);
    margin: 0;
    font-size: 19px;
}

.settle-content {
    padding: 22px;
    line-height: 1.75;
    font-size: 15.5px;
    color: #333;
}

.settle-content ol {
    padding-left: 22px;
}

.settle-footer {
    padding: 15px 22px 22px;
    text-align: center;
}

.settle-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #fdb4ed, #FF75AD);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

/* 表单样式 */
.settle-form-group {
    margin-bottom: 16px;
}
.settle-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14.5px;
    color: #555;
    font-weight: 500;
}
.settle-form-group input,
.settle-form-group select,
.settle-form-group textarea {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid #ffccdd;
    border-radius: 12px;
    font-size: 16px;
    box-sizing: border-box;
}
.settle-form-group textarea {
    min-height: 110px;
    resize: vertical;
}

/* ====================== 影音专区 ====================== */
#video-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #FFF5F9;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.video-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(255,77,148,0.15);
    transition: transform 0.2s;
}

.video-card:hover {
    transform: scale(1.03);
}

.video-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.video-info {
    padding: 12px 10px;
}

.video-info h4 {
    font-size: 14.5px;
    line-height: 1.4;
    margin: 0 0 6px 0;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-play-btn {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    background: linear-gradient(135deg, #fdb4ed, #FF75AD);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
}

/* 全屏视频播放器模态框 */
#video-player-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: 2147483647;
    display: none;
    flex-direction: column;
}

#video-player-modal .modal-header {
    padding: 12px 15px;
    /* 核心修改：适配 iOS 安全区域，防止被刘海遮挡 */
    padding-top: calc(12px + env(safe-area-inset-top)); 
    background: rgba(0,0,0,0.8);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    height: auto;
}

#video-player-modal .modal-header button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    padding: 10px 10px; /* 增大内边距以扩大点击面积 */
    margin-right: -10px; /* 抵消内边距带来的偏移 */
    display: flex;
    align-items: center;
    justify-content: center;
}

#video-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    position: relative;
}

#video-container video {
    max-width: 100%;
    max-height: 100%;
}

#loading-spinner {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    display: none;
}


/* 验证码/注册弹窗增强 */
.verify-modal {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 2px solid var(--primary-pink); /* 增加品牌色外框，增强视觉边界 */
}

.verify-input-group {
    margin: 15px 0;
    position: relative;
}

.verify-input-group input {
    width: 100%;
    height: 50px;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 0 15px;
    font-size: 18px; /* 至少16px防止iOS自动缩放，安卓上更易读 */
    background: #f9f9f9;
    color: #333;
    transition: all 0.3s;
}

/* 焦点状态极其重要：让用户知道自己在填哪里 */
.verify-input-group input:focus {
    border-color: var(--deep-pink);
    background: #fff;
    box-shadow: 0 0 8px rgba(232, 62, 140, 0.2);
    outline: none;
}

.verify-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}