/* 应用内聊天视图宿主。聊天内容本身仍由 chat-history.html 独立维护。 */
.chat-module-host {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: block;
    overflow: hidden;
    background: #ededed;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(101%, 0, 0);
    will-change: transform, opacity;
}

.chat-module-host.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
    animation: chatModuleEnter .12s ease-out both;
}

.chat-module-host.active.closing {
    animation: chatModuleExit .14s ease both;
    pointer-events: none;
}

.chat-module-frame {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #ededed;
    opacity: 0;
    pointer-events: none;
    transition: opacity .1s ease;
    visibility: hidden;
    z-index: 0;
}

.chat-module-frame.is-current { visibility: visible; opacity: 1; pointer-events: auto; z-index: 1; }

.chat-module-preview {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: none;
    background: #ededed;
}

.chat-module-host.loading .chat-module-frame { opacity: 0; }
.chat-module-host.loading .chat-module-preview { display: block; }

.chat-module-preview-header {
    height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 16px 0;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: center;
    border-bottom: 1px solid #d8d8d8;
    background: #f7f7f7;
}

.chat-module-preview-header svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: #181818;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-module-preview-header span {
    overflow: hidden;
    color: #181818;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-module-preview-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 26px 20px;
}

.chat-module-preview-body span {
    width: 38%;
    height: 38px;
    border-radius: 5px 16px 16px 16px;
    background: rgba(255, 255, 255, .72);
    animation: chatPreviewPulse 1s ease-in-out infinite alternate;
}

.chat-module-preview-body span:nth-child(2) { width: 48%; margin-left: auto; border-radius: 16px 5px 16px 16px; background: rgba(149, 236, 105, .52); animation-delay: -.25s; }
.chat-module-preview-body span:nth-child(3) { width: 30%; animation-delay: -.5s; }

@keyframes chatPreviewPulse {
    from { opacity: .48; }
    to { opacity: .86; }
}

body.chat-module-open {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

@keyframes chatModuleEnter {
    from { opacity: .82; }
    to { opacity: 1; }
}

@keyframes chatModuleExit {
    from { opacity: 1; transform: none; }
    to { opacity: .84; transform: translate3d(8px, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .chat-module-host.active { animation: none; }
    .chat-module-frame { transition: none; }
    .chat-module-preview-body span { animation: none; }
}
