/* AI 智能客服 — 独立页面 */
.ai-chat-page.ai-chat-main {
    padding-bottom: 48px;
}

.ai-chat-page .ai-chat-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px 20px;
    margin: 8px 0 16px;
    padding: 18px 20px;
    border-radius: var(--r-md);
    border: 1px solid var(--c-line);
    background: var(--c-bg-soft);
    box-shadow: var(--s-xs);
}

.ai-chat-page-head-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.ai-chat-page-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.15rem;
    color: var(--c-action);
    background: linear-gradient(145deg, rgba(var(--c-action-rgb), 0.18), rgba(var(--c-action-rgb), 0.06));
    border: 1px solid rgba(var(--c-action-rgb), 0.22);
}

.ai-chat-page-title {
    margin: 0 0 6px;
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--c-text);
}

.ai-chat-page-desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--c-text-2);
    line-height: 1.5;
}

.ai-chat-page-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    font-size: 0.875rem;
    font-weight: 600;
}

.ai-chat-page-links a {
    color: var(--c-action);
}

.ai-chat-page-card {
    display: flex;
    flex-direction: column;
    min-height: min(72vh, 640px);
    max-height: min(78vh, 720px);
    border-radius: 16px;
    border: 1px solid var(--c-line-strong);
    background: var(--c-bg-card);
    box-shadow: var(--s-md);
    overflow: hidden;
}

.ai-chat-disclaimer {
    flex-shrink: 0;
    padding: 10px 16px;
    font-size: 0.6875rem;
    color: var(--c-text-3);
    background: var(--c-bg-soft);
    border-bottom: 1px solid var(--c-line);
    line-height: 1.4;
}

.ai-chat-messages {
    flex: 1 1 auto;
    min-height: 280px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}

.ai-chat-msg {
    display: flex;
    max-width: min(92%, 520px);
}

.ai-chat-msg--user {
    align-self: flex-end;
}

.ai-chat-msg--bot {
    align-self: flex-start;
}

.ai-chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
}

.ai-chat-bubble a {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.ai-chat-msg--user .ai-chat-bubble {
    background: var(--c-action);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-chat-msg--user .ai-chat-bubble a {
    color: #fff;
}

.ai-chat-msg--bot .ai-chat-bubble {
    background: var(--c-bg-soft);
    color: var(--c-text);
    border: 1px solid var(--c-line);
    border-bottom-left-radius: 4px;
}

html.io-dark-mode .ai-chat-msg--bot .ai-chat-bubble {
    background: rgba(255, 255, 255, 0.06);
}

.ai-chat-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    height: 1em;
}

.ai-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-text-3);
    animation: ai-chat-dot 1s ease-in-out infinite;
}

.ai-chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ai-chat-dot {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: scale(0.85);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.ai-chat-quick {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
}

.ai-chat-quick-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-action);
    background: rgba(var(--c-action-rgb), 0.08);
    border: 1px solid rgba(var(--c-action-rgb), 0.22);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ai-chat-quick-btn:hover {
    background: rgba(var(--c-action-rgb), 0.14);
    border-color: var(--c-action);
}

.ai-chat-form {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--c-line);
    background: var(--c-bg-card);
}

.ai-chat-input-wrap {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.ai-chat-input {
    width: 100%;
    min-height: 48px;
    max-height: 140px;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--c-text);
    background: var(--c-bg-soft);
    border: 1px solid var(--c-line);
    border-radius: 10px;
    resize: vertical;
    box-sizing: border-box;
}

.ai-chat-input:focus {
    outline: none;
    border-color: var(--c-action);
    box-shadow: 0 0 0 3px rgba(var(--c-action-rgb), 0.15);
}

.ai-chat-send {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 10px;
    color: #fff;
    background: var(--c-action);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.ai-chat-send:hover:not(:disabled) {
    background: var(--c-action-hover);
    transform: translateY(-1px);
}

.ai-chat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ai-chat-foot {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--c-line);
    background: var(--c-bg-soft);
}

.ai-chat-human,
.ai-chat-clear {
    padding: 0;
    border: none;
    background: none;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.ai-chat-human {
    color: var(--c-action);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-human a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-human a:hover {
    text-decoration: underline;
}

.ai-chat-clear {
    color: var(--c-text-2);
}

.ai-chat-clear:hover {
    color: #c62828;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 767px) {
    .ai-chat-page-card {
        min-height: 65vh;
        max-height: none;
    }
}
