/*悬浮的绵城小助手*/
.float-mascot {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    width: 110px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s;
}

.float-mascot:hover {
    transform: translateY(-50%) scale(1.05);
}

/*对话框相关样式表*/
.chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
    backdrop-filter: blur(2px);
}

.chat-overlay.active {
    opacity: 1;
    visibility: visible;
}

.chat-window {
    position: fixed;
    right: 140px;
    top: 50%;
    transform: translateY(-50%) scale(0.92);
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 80px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 60, 120, 0.28);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    border: 1px solid rgba(0, 110, 255, 0.18);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}

.chat-header {
    background: linear-gradient(135deg, #0088ff 0%, #0066cc 100%);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.chat-header .chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-title h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.chat-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    opacity: 0.92;
}

.chat-status i {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.12);
    }
}

.chat-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: rotate(90deg);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: linear-gradient(180deg, #f5f9fe 0%, #eef4fb 100%);
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #bcd3ee;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #8ab3da;
}

.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 100%;
    animation: msgFadeIn 0.45s ease;
}

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-msg-bot {
    justify-content: flex-start;
    align-items: flex-start;
}

.chat-msg-user {
    justify-content: flex-end;
    align-items: flex-end;
    /*flex-direction: row-reverse;*/
}

.chat-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    background: #0078D7;
}

.chat-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-msg-content {
    max-width: 78%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.chat-msg-user .chat-msg-content {
    align-items: flex-end;
}

.chat-bubble {
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.7;
    word-wrap: break-word;
    /*white-space: pre-wrap;*/
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.chat-msg-bot .chat-bubble {
    background: #fff;
    color: #333;
    border-top-left-radius: 4px;
    border: 1px solid #e3ecf7;
}

.chat-msg-user .chat-bubble {
    background: linear-gradient(135deg, #3b9dff 0%, #0078d7 100%);
    color: #fff;
    border-top-right-radius: 4px;
}

.chat-msg-time {
    font-size: 11px;
    color: #98a9bd;
    padding: 0 4px;
}

.chat-msg-quick .chat-bubble {
    display: none;
}

.chat-quick-title {
    font-size: 12px;
    color: #6c7e94;
    margin-bottom: 8px;
    padding-left: 4px;
}

.chat-quick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chat-quick-btn {
    padding: 7px 12px;
    background: #fff;
    border: 1.5px solid #b9d4f2;
    border-radius: 18px;
    font-size: 13px;
    color: #0066cc;
    cursor: pointer;
    transition: all 0.25s;
}

.chat-quick-btn:hover {
    background: linear-gradient(135deg, #3b9dff 0%, #0078d7 100%);
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 120, 215, 0.25);
}

.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #e3ecf7;
    flex-shrink: 0;
}

.chat-input textarea {
    flex: 1;
    resize: none;
    border: 1.5px solid #d3e1f2;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    max-height: 120px;
    min-height: 42px;
    overflow-y: auto;
}

.chat-input textarea:focus {
    border-color: #0078d7;
    box-shadow: 0 0 0 3px rgba(0, 120, 215, 0.12);
}

.chat-input textarea::-webkit-scrollbar {
    width: 4px;
}

.chat-input button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b9dff 0%, #0078d7 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s;
    box-shadow: 0 4px 12px rgba(0, 120, 215, 0.25);
}

.chat-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 120, 215, 0.35);
}

.chat-input button:active {
    transform: translateY(0);
}

.chat-input button:disabled {
    background: #bcd3ee;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}


@media (max-width: 1200px) {
    .chat-window {
        right: 120px;
        width: 370px;
        height: 560px;
    }
}

@media (max-width: 992px) {
    .float-mascot {
        width: 90px;
    }

    .chat-window {
        right: auto;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%) scale(0.92);
        width: 92%;
        max-width: 440px;
    }

    .chat-window.active {
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 768px) {

    .float-mascot {
        width: 56px;
        right: 4px;
        top: auto;
        bottom: 20px;
        transform: none;
    }

    .float-mascot:hover {
        transform: scale(1.05);
    }

    .chat-window {
        right: 12px;
        left: 12px;
        top: 50%;
        bottom: auto;
        width: auto;
        height: 78vh;
        max-height: 78vh;
        transform: translateY(-50%) scale(0.92);
    }

    .chat-window.active {
        transform: translateY(-50%) scale(1);
    }

    .chat-header {
        padding: 12px 14px;
    }

    .chat-header .chat-avatar {
        width: 38px;
        height: 38px;
    }

    .chat-title h4 {
        font-size: 15px;
    }

    .chat-messages {
        padding: 16px 12px;
        gap: 14px;
    }

    .chat-msg-avatar {
        width: 32px;
        height: 32px;
    }

    .chat-bubble {
        padding: 9px 12px;
        font-size: 13.5px;
    }

    .chat-quick-btn {
        padding: 6px 10px;
        font-size: 12.5px;
    }

    .chat-input {
        padding: 10px 12px;
        gap: 8px;
    }

    .chat-input button {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 480px) {

    .float-mascot {
        width: 48px;
    }

    .chat-window {
        border-radius: 14px;
    }

    .chat-msg-content {
        max-width: 82%;
    }

    .chat-header .chat-avatar {
        width: 36px;
        height: 36px;
    }

    .chat-title h4 {
        font-size: 14px;
    }

    .chat-status {
        font-size: 11px;
    }

    .chat-close {
        width: 30px;
        height: 30px;
    }

    .chat-quick-list {
        gap: 6px;
    }
}

/* ========== 网页版小助手（新增，不影响原有样式） ========== */

/* 入口按钮：位于原小助手下方 */
.float-mascot.web-mascot {
    top: calc(50% + 150px);
    width: 80px;
}

/* 网页版窗口：复用 chat-window 基础样式，仅调整尺寸 */
.chat-window.web-window {
    width: 480px;
    height: 660px;
}

/* iframe 容器占满窗口剩余空间 */
.web-frame-box {
    flex: 1;
    min-height: 0;
    background: #fff;
}

.web-frame-box iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 1200px) {
    .chat-window.web-window {
        width: 440px;
        height: 600px;
    }
}

@media (max-width: 768px) {
    .float-mascot.web-mascot {
        top: auto;
        bottom: 96px;
        transform: none;
        width: 52px;
    }

    .float-mascot.web-mascot:hover {
        transform: scale(1.05);
    }

    .chat-window.web-window {
        height: 78vh;
        max-width: 90%;
        margin: 0 auto;
    }
}