/* =========================================================
   IDE 数字员工（AI 智能客服与意向转化）样式表
   Design System: Yingke Malaysia Navy & Brass Gold
========================================================= */

:root {
    --ide-primary: #0B1220;
    --ide-primary-dark: #04070E;
    /* 抽屉内部是浅色面板（嵌入式客服窗口），不能直接用主题辅色：
       主题辅色是给深色底用的亮色，压在白底上读不出来。
       这里把辅色压暗到能在白底上阅读的版本，但仍然跟随主题。 */
    --ide-accent: color-mix(in srgb, var(--brass) 62%, #06232B);
    --ide-accent-hover: color-mix(in srgb, var(--brass) 46%, #06232B);
    --ide-accent-light: color-mix(in srgb, var(--brass) 10%, #FFFFFF);
    --ide-bg-bubble: #F4F6F9;
    --ide-text-main: #0B1220;
    --ide-text-muted: #6B7280;
    --ide-line: #E5E7EB;
    --ide-success: #10B981;
    --ide-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    --ide-radius: 16px;
}

/* 1. 悬浮入口（手绘图1） */
.ide-launcher {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    /* 跟随主题包，不写死颜色 */
    background: linear-gradient(160deg, var(--brass) 0%, color-mix(in srgb, var(--brass) 68%, #000) 100%);
    color: var(--accent-ink);
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 10px 26px rgba(0, 0, 0, .5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99990;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    user-select: none;
}

.ide-launcher:hover {
    transform: scale(1.06) translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 14px 32px rgba(0, 0, 0, .6);
}

.ide-launcher-glow {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    /* 原来是 2.8s 无限呼吸的霓虹光晕，按「不要满屏霓虹」改成静态柔光：
       只负责把启动器从深色页面上托起来，不做循环动效。 */
    background: radial-gradient(circle, color-mix(in srgb, var(--brass) 24%, transparent) 0%, transparent 70%);
    z-index: -1;
}

.ide-launcher-avatar {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ide-avatar-custom-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background: transparent;
    display: block;
}

/* 颜色继承 .ide-launcher 的 currentColor，跟着主题走 */
.ide-avatar-icon {
    width: 23px;
    height: 23px;
    stroke-width: 2;
}

.ide-launcher-text {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.1px;
    color: currentColor;
    line-height: 1;
    margin-top: 3px;
}

.ide-launcher-badge {
    position: absolute;
    top: 2px;
    right: 2px;
}

.ide-online-dot {
    display: block;
    width: 12px;
    height: 12px;
    background-color: var(--ide-success);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}

/* 悬浮欢迎气泡 */
.ide-welcome-bubble {
    position: absolute;
    bottom: 74px;
    right: 0;
    width: 230px;
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(11, 18, 32, 0.16);
    border: 1px solid rgba(14, 116, 144, 0.25);
    color: var(--ide-text-main);
    animation: ide-fade-in-up 0.4s ease forwards;
    cursor: default;
}

.ide-welcome-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 24px;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-right: 1px solid rgba(14, 116, 144, 0.25);
    border-bottom: 1px solid rgba(14, 116, 144, 0.25);
    transform: rotate(45deg);
}

.ide-welcome-close {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 14px;
    color: #9CA3AF;
    cursor: pointer;
    line-height: 1;
}
.ide-welcome-close:hover { color: var(--ide-text-main); }

.ide-bubble-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ide-primary);
    margin-bottom: 4px;
}

.ide-bubble-desc {
    font-size: 12px;
    color: var(--ide-text-muted);
    line-height: 1.4;
}

/* 2. 交互抽屉主面板（手绘图2） */
.ide-panel {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 400px;
    height: 640px;
    max-height: calc(100vh - 56px);
    background: #ffffff;
    border-radius: var(--ide-radius);
    box-shadow: var(--ide-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99995;
    opacity: 0;
    transform: scale(0.85) translateY(20px);
    pointer-events: none;
    transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(11, 18, 32, 0.08);
}

.ide-panel.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* 顶部 Header */
.ide-header {
    background: linear-gradient(135deg, var(--ide-primary) 0%, #155E75 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ide-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ide-avatar-header {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid var(--ide-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.ide-avatar-header svg {
    width: 22px;
    height: 22px;
}

.ide-header-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--ide-success);
    border: 2px solid var(--ide-primary);
    border-radius: 50%;
}

.ide-header-info {
    display: flex;
    flex-direction: column;
}

.ide-header-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.ide-header-status {
    font-size: 11px;
    color: #CBD5E1;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
}

.ide-status-pulse {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #34D399;
    box-shadow: 0 0 5px #34D399;
}

.ide-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ide-icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #E2E8F0;
    cursor: pointer;
    transition: all 0.2s;
}

.ide-icon-btn svg { width: 16px; height: 16px; }

.ide-icon-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

/* 消息对话区（手绘图2：答） */
.ide-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #F8FAFC;
    scroll-behavior: smooth;
}

.ide-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: ide-fade-in 0.25s ease forwards;
}

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

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

.ide-msg-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}

.ide-msg-bot .ide-msg-bubble {
    background: #ffffff;
    color: var(--ide-text-main);
    border: 1px solid #E2E8F0;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.ide-msg-bot .ide-msg-bubble p {
    margin: 0 0 8px 0;
}
.ide-msg-bot .ide-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ide-msg-bot .ide-msg-bubble ul, .ide-msg-bot .ide-msg-bubble ol {
    margin: 6px 0;
    padding-left: 18px;
}

.ide-msg-bot .ide-msg-bubble li {
    margin-bottom: 4px;
}

.ide-msg-bot .ide-msg-bubble a {
    color: #1D4ED8;
    text-decoration: underline;
    font-weight: 500;
}

.ide-msg-user .ide-msg-bubble {
    background: var(--ide-primary);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 3px 10px rgba(11, 18, 32, 0.18);
}

/* 推荐网站网址卡片（手绘图2标注：URL: 网站） */
.ide-url-cards {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ide-url-card {
    background: #FFFFFF;
    border: 1px solid #D6E4F0;
    border-left: 3.5px solid var(--ide-accent);
    border-radius: 8px;
    padding: 10px 12px;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.ide-url-card:hover {
    background: var(--ide-accent-light);
    border-color: var(--ide-accent);
    transform: translateX(2px);
}

.ide-url-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ide-url-tag {
    font-size: 10px;
    font-weight: 700;
    color: var(--ide-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.ide-url-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ide-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ide-url-path {
    font-size: 11px;
    color: #64748B;
    margin-top: 2px;
}

.ide-url-arrow {
    margin-left: 8px;
    color: var(--ide-accent);
    flex-shrink: 0;
}

/* 快捷提问标签 Chips */
.ide-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #E2E8F0;
}

.ide-chip {
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 11.5px;
    color: var(--ide-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.ide-chip:hover {
    background: #E2E8F0;
    border-color: var(--ide-accent);
    color: var(--ide-primary-dark);
}

/* 意向转化快捷栏（手绘图2标注：预约 & 留资） */
.ide-conversion-bar {
    background: #ffffff;
    border-top: 1px solid var(--ide-line);
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.02);
}

.ide-cta-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.ide-cta-btn svg {
    width: 15px;
    height: 15px;
}

/* 预约咨询：金色突出操作 */
.ide-cta-appt {
    background: linear-gradient(135deg, #0E7490 0%, #155E75 100%);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(14, 116, 144, 0.28);
}

.ide-cta-appt:hover {
    background: linear-gradient(135deg, #0E7490 0%, #155E75 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(14, 116, 144, 0.36);
}

/* 留资待触达：深蓝边框商务操作 */
.ide-cta-lead {
    background: #FFFFFF;
    color: var(--ide-primary);
    border: 1.5px solid var(--ide-primary);
}

.ide-cta-lead:hover {
    background: rgba(11, 18, 32, 0.05);
    transform: translateY(-1px);
}

/* 内嵌表单遮罩层与卡片 */
.ide-form-overlay {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 18, 32, 0.4);
    backdrop-filter: blur(2px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.ide-form-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.ide-form-card {
    background: #ffffff;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
    max-height: 85%;
    overflow-y: auto;
    animation: ide-slide-up 0.3s ease;
}

.ide-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ide-line);
}

.ide-form-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ide-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ide-form-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #94A3B8;
    cursor: pointer;
    line-height: 1;
}

.ide-form-group {
    margin-bottom: 12px;
}

.ide-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.ide-form-group label .req {
    color: #EF4444;
}

.ide-radio-group {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.ide-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    cursor: pointer;
}

.ide-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ide-form-group input, .ide-form-group textarea, .ide-form-group select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--ide-text-main);
    background: #F8FAFC;
    transition: all 0.2s;
}

.ide-form-group input:focus, .ide-form-group textarea:focus, .ide-form-group select:focus {
    outline: none;
    border-color: var(--ide-accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.15);
}

.ide-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--ide-line);
}

.ide-btn-cancel {
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    color: #475569;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
}

.ide-btn-submit {
    background: var(--ide-primary);
    border: none;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ide-btn-submit:hover {
    background: #0E7490;
}

/* 底部输入栏（手绘图2：问 & 向上发送按钮） */
.ide-footer {
    background: #ffffff;
    padding: 10px 14px 12px 14px;
    border-top: 1px solid #EDF2F7;
}

.ide-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #F1F5F9;
    border: 1.5px solid #E2E8F0;
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    transition: all 0.2s;
}

.ide-input-wrapper:focus-within {
    border-color: var(--ide-accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.15);
}

.ide-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    color: var(--ide-text-main);
    resize: none;
    max-height: 80px;
    line-height: 1.4;
    outline: none;
    padding: 4px 0;
}

/* 手绘图中的圆形向上箭头发送按钮 (↑) */
.ide-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ide-primary);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
}

.ide-send-btn svg {
    width: 16px;
    height: 16px;
}

.ide-send-btn:hover {
    background: var(--ide-accent);
    transform: scale(1.08);
}

.ide-send-btn:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
    transform: none;
}

.ide-footer-tips {
    font-size: 10.5px;
    color: #94A3B8;
    text-align: center;
    margin-top: 6px;
}

/* 打字机中等待动效 */
.ide-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.ide-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94A3B8;
    animation: ide-typing-bounce 1.4s infinite ease-in-out both;
}

.ide-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ide-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ide-typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes ide-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ide-fade-in-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ide-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* 移动端适配 */
@media (max-width: 480px) {
    .ide-launcher {
        bottom: 18px;
        right: 18px;
        width: 54px;
        height: 54px;
    }
    .ide-welcome-bubble {
        right: -10px;
        width: 200px;
    }
    .ide-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}
