/* 全局重置 - 极简基础 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacOSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 悬浮机器人图标 */
#floating-robot {
    position: fixed;
    bottom: 310px;
    right: 30px;
    width: 80px;
    background: transparent;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    z-index: 99999;
    box-shadow: none;
    transition: all 0.3s;
}

#robot-icon-img {
    transform: scale(0.8);
    width: 70px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 0;
}

#robot-icon-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
}

#robot-icon-label {
    color: #666;
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
    line-height: 1.1;
    white-space: nowrap;
}

/* 聊天窗口 */
#robot-chat-window {
    position: fixed;
    bottom: 355px;
    right: 30px;
    width: 380px;
    height: 580px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e5e5;
}

#chat-header {
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    color: #333;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#close-chat {
    background: none;
    border: none;
    color: #999;
    font-size: 22px;
    cursor: pointer;
}

/* 消息区 */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
    border-top: none;
}

/* 消息通用样式 */
.message {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.45;
    font-size: 14px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.bot-message {
    background: transparent;
    color: #333;
    box-shadow: none;
    padding: 12px 16px;
    padding-left: 0;
    margin: 12px 0;
    max-width: 80%;
    line-height: 1.45;
    font-size: 14px;
    border-bottom-left-radius: 0;
}

.user-message {
    background: rgba(230, 240, 255, 0.5);
    color: #1a1a1a;
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

/* 输入区 */
#chat-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: transparent;
    border-top: 1px solid #eee;
    gap: 12px;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    outline: none;
}

#user-input:focus {
    border-color: #aaa;
}

#send-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

#send-btn:hover {
    color: #666;
}

#send-btn:disabled {
    color: #d1d5db;
}

/* 预收集表单窗口 */
#pre-chat-window {
    position: fixed;
    bottom: 390px;
    right: 30px;
    width: 380px;
    height: 400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    display: none;
    flex-direction: column;
    border: 1px solid #e5e5e5;
    overflow: hidden;
}

#pre-chat-header {
    background: #f8f9fa;
    color: #333;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 1px solid #e5e5e5;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    gap: 12px;
}

#pre-chat-form {
    flex: 1;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#pre-chat-form input {
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
}

#pre-chat-form button {
    padding: 14px;
    background: #374151;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

/* 手机端优化 - 预收集表单 */
@media (max-width: 767px) {
    #pre-chat-window {
        /* 默认不全屏，只在 .mobile-fullscreen 时全屏 */
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 90vw;
        max-width: 360px;
        height: auto;
        min-height: 400px;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.2);
        background: #ffffff;
        z-index: 999999;
        overflow-y: auto;
        display: none;
    }

    #pre-chat-window.mobile-fullscreen {
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    #pre-chat-header {
        padding: 16px 20px !important;
        font-size: 16px !important;
    }

    #pre-chat-form {
        padding: 20px 16px !important;
        gap: 16px !important;
        flex: 1 !important;
        max-width: 360px !important;
        margin: 0 auto !important;
        width: 90% !important;
    }

    #pre-chat-form input {
        padding: 12px 14px !important;
        font-size: 15px !important;
        height: 48px !important;
        border-radius: 8px !important;
    }

    #pre-chat-form button {
        padding: 14px !important;
        font-size: 16px !important;
        height: 52px !important;
        border-radius: 8px !important;
    }
}

/* 聊天窗口手机端适配 */
@media (max-width: 768px) {
    #robot-chat-window {
        height: 100vh !important;
        max-height: 100vh !important;
        overflow: hidden !important;
    }

    #chat-messages {
        flex: 1;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #chat-input-area {
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: white;
        padding: 12px 16px;
        border-top: 1px solid #eee;
    }
}

/* Typing indicator 动画 */
.typing-indicator::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20%   { content: '.'; }
    40%       { content: '..'; }
    60%       { content: '...'; }
    80%, 100% { content: ''; }
}

.typing-indicator {
    position: relative;
}

.typing-indicator::before {
    content: '•••';
    position: absolute;
    opacity: 0;
    animation: typingDots 1.4s infinite;
}

@keyframes typingDots {
    0%, 80%, 100% { opacity: 0; transform: translateY(0); }
    20% { opacity: 0.4; transform: translateY(-2px); }
    40% { opacity: 0.8; transform: translateY(-4px); }
    60% { opacity: 0.4; transform: translateY(-2px); }
}

/* 其他样式（快捷建议、tooltip、全屏图片/视频等）保持不变 */
.suggestion-list {
    padding: 16px 20px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.suggestion-item {
    padding: 10px 14px;
    margin: 8px 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-item:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}

#close-pre-chat {
    background: none;
    border: none;
    color: #999;
    font-size: 22px;
    font-weight: normal;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

#close-pre-chat:hover {
    color: #333;
}

#close-pre-chat:focus {
    outline: none;
}

/* 强制隐藏横向滚动条 */
#chat-messages {
    overflow-x: hidden !important;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#chat-messages::-webkit-scrollbar:horizontal {
    display: none;
}

/* 防止内容溢出 */
.bot-message img,
.bot-message video,
.bot-message div {
    max-width: 100% !important;
    width: 100%;
    box-sizing: border-box;
}

.message {
    word-break: break-all;
    overflow-wrap: break-word;
}

/* 建议项 + tooltip */
.suggestion-entry {
    position: relative;
    cursor: pointer;
    transition: color 0.15s ease;
}

.suggestion-entry:hover {
    color: #3b82f6 !important;
}

/* tooltip */
.suggestion-entry::after {
    content: attr(data-fulltext);
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 12px;
    background: #ffffff;
    color: #1f2937;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    hyphens: auto;
    max-width: 300px;
    min-width: 280px;
    width: 260px;
    max-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
    z-index: 10000;
    text-align: left;
}

.suggestion-entry.overflown:hover::after {
    opacity: 1;
    visibility: visible;
}

.suggestion-entry::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.suggestion-entry.overflown:hover::before {
    opacity: 1;
    visibility: visible;
}

/* 全屏图片放大 Modal - 整个网页级别 */
.image-fullscreen-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;                  /* 确保盖过所有内容，包括你的聊天窗口 */
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(6px);       /* 可选：现代磨砂效果，兼容性好 */
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    overflow: hidden;                  /* 防止放大后溢出可见 */
}

.image-fullscreen-modal.active {
    display: flex;
}

.modal-image-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    overflow: hidden;
    touch-action: none;  /* 防止移动端冲突 */
}

.modal-image-container.dragging {
    cursor: grabbing;
}
.modal-image {
    max-width: 92vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    transform-origin: center center;
}
/* 放大后允许突破边界 */
.modal-image.zoomed {
    max-width: none;
    max-height: none;
}
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.modal-close:hover {
    transform: scale(1.15);
}

.modal-close svg {
    transition: all 0.2s ease;
}

.modal-close:hover svg circle {
    fill: rgba(255,255,255,0.2); /* hover 时背景变亮 */
}

/* 加载中提示（可选） */
.modal-image.loading::before {
    content: "加载中...";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
}
/* 视频样式 - 聊天框内显示 */
.bot-message video {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
    background: #000;
    cursor: pointer;           /* 提示可交互 */
}

/* 全屏视频 modal（复用图片 modal 的结构，但分开） */
#video-fullscreen-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0,0,0,0.95);
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#video-fullscreen-modal.active {
    display: flex;
}

.video-modal-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal-container video {
    max-width: 96vw;
    max-height: 96vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.modal-video-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 50px;
    cursor: pointer;
    z-index: 10;
}
@media (max-width: 768px) {
    #robot-chat-window {
        height: 100vh !important;
        max-height: 100vh !important;
        overflow: hidden !important;
    }

    #chat-messages {
        flex: 1;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;  /* iOS 流畅滚动 */
    }

    #chat-input-area {
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: white;
        padding: 12px 16px;
        border-top: 1px solid #eee;
    }
}
/* Typing indicator 动画 */
.typing-indicator::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20%   { content: '.'; }
    40%       { content: '..'; }
    60%       { content: '...'; }
    80%, 100% { content: ''; }
}

/* 或者更高级的三个点跳动（可选） */
.typing-indicator {
    position: relative;
}
.typing-indicator::before {
    content: '•••';
    position: absolute;
    opacity: 0;
    animation: typingDots 1.4s infinite;
}
@keyframes typingDots {
    0%, 80%, 100% { opacity: 0; transform: translateY(0); }
    20% { opacity: 0.4; transform: translateY(-2px); }
    40% { opacity: 0.8; transform: translateY(-4px); }
    60% { opacity: 0.4; transform: translateY(-2px); }
}
/* Yes 按钮专用类 - 最高优先级覆盖全局背景干扰 + 补回边框 */
.yes-solve-button {
    background-color: #ecfdf5 !important;     /* 默认浅绿填充 */
    background: #ecfdf5 !important;           /* 双重保险 */
    border: 2px solid #10b981 !important;     /* 补回绿色边框 */
    color: #065f46 !important;                /* 文字深绿 */
    border-radius: 10px !important;
    transition: all 0.2s ease !important;

	    /* 调整内边距来改变按钮大小 */
    padding-top: 9px !important;      /* 上内边距减小 */
    padding-bottom: 9px !important;   /* 下内边距减小 */
    /* 保持左右内边距不变 */
    padding-left: 16px !important;
    padding-right: 16px !important;
}

/* hover 状态 - 背景变深绿，边框不变 */
.yes-solve-button:hover {
    background-color: #d1fae5 !important;
    background: #d1fae5 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2) !important; /* 加点阴影，更立体 */
}

/* 确保 SVG 勾颜色（绿色） */
.yes-solve-button svg {
    fill: #10b981 !important;
}
@media (max-width: 767px) {
    .rating-star {
        font-size: 28px !important;   /* 手机端星星大小，建议 26px~32px */
        margin: 0 6px !important;     /* 间距加大，看起来更舒服 */
    }
}
