/* AI命理师页面样式 */
.ai-advisor-layout {
    max-width: 100%;
    /* 确保能撑满 */
    width: 1200px;
    /* 默认宽度 */
    margin: 0 auto;
    padding: 20px;
    display: flex !important;
    /* 强制Flex */
    flex-direction: row !important;
    /* 强制水平排列 */
    gap: 20px;
    /* 显式设置高度，确保占据屏幕大部分 */
    height: 85vh;
    min-height: 600px;
    position: relative;
    z-index: 1000;
    /* 提升层级，防止被星空背景遮挡 */
}

/* 左侧：用户信息面板 */
.user-panel {
    flex: 0 0 300px;
    /* 固定宽度，不伸缩 */
    width: 300px;
    background: rgba(20, 20, 35, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    z-index: 1001;
}

.panel-header {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.panel-header h3 {
    margin: 0;
    color: var(--primary-color, #d4af37);
    font-size: 1.2rem;
}

.user-info-status {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.status-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.status-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.status-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.04em;
}

.feature-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.feature-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--primary-color, #d4af37);
    transform: translateX(5px);
}

.feature-icon {
    font-size: 1.2rem;
}

/* 右侧：聊天主区域 */
.chat-main {
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    background: rgba(15, 15, 25, 0.95);
    /* 加深背景不透明度 */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1001;
    /* 确保内容在容器之上 */
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    /* 增加阴影，使其与背景分离 */
}

.chat-header {
    flex: 0 0 auto;
    /* 不允许压缩 */
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

.chat-title {
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-badge {
    background: linear-gradient(135deg, #d4af37, #f2d06b);
    color: #000;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* 消息气泡 */
.message {
    display: flex;
    gap: 15px;
    max-width: 85%;
    /* animation: fadeIn 0.3s ease; // 暂时禁用动画 */
}

/* 暂时禁用动画定义
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
*/

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.ai {
    align-self: flex-start;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    color: #fff;
    /* 确保头像文字可见 */
    z-index: 10;
}

.ai .avatar {
    background: linear-gradient(135deg, #2b32b2, #1488cc);
    border-color: #1488cc;
}

/* SVG 动态头像：去掉纯色背景，让SVG本身发光 */
.avatar--svg,
.ai .avatar--svg {
    background: transparent;
    border: none;
    padding: 0;
    overflow: visible;
}

/* 聊天标题 SVG 图标对齐 */
.chat-title-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: visible;
}

.user .avatar {
    background: linear-gradient(135deg, #d4af37, #f2d06b);
    border-color: #d4af37;
    color: #000;
}

.message-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    font-size: 0.95rem;
    position: relative;
}

.ai .message-content {
    border-top-left-radius: 2px;
    background: rgba(20, 136, 204, 0.1);
    border: 1px solid rgba(20, 136, 204, 0.2);
}

.user .message-content {
    border-top-right-radius: 2px;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: #fff;
}

/* Markdown样式增强 */
.message-content strong {
    color: #f2d06b;
    font-weight: 600;
}

.message-content h3,
.message-content h4 {
    margin-top: 10px;
    margin-bottom: 5px;
    color: #fff;
    font-size: 1.1em;
}

.message-content ul {
    margin: 5px 0 10px 20px;
    padding: 0;
}

.message-content li {
    margin-bottom: 5px;
}

/* 输入区域 */
.chat-input-area {
    flex: 0 0 auto;
    /* 不允许压缩 */
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 20;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 5px 15px;
    align-items: center;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color, #d4af37);
    background: rgba(255, 255, 255, 0.08);
}

#ai-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px 0;
    font-size: 1rem;
    outline: none;
    resize: none;
    height: auto;
    line-height: 1.5;
    max-height: 100px;
}

#send-btn {
    background: linear-gradient(135deg, #d4af37, #f2d06b);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-end;
}

#send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

#send-btn:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 思考动画 */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ai-advisor-layout {
        flex-direction: column;
        height: calc(100vh - 80px);
        /* 适配移动端高度 */
        padding: 10px;
    }

    .user-panel {
        width: 100%;
        padding: 15px;
        order: -1;
        /* 面板在移动端可以先折叠，暂时展示 */
        display: none;
        /* 移动端暂时隐藏左侧面板，或做成抽屉 */
    }

    .chat-main {
        height: 100%;
    }
}

/* ===== 今日天启卡片 ===== */
.daily-revelation-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(251, 191, 36, 0.06) 100%);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 14px;
    padding: 14px 14px 12px;
    position: relative;
    overflow: hidden;
}

.daily-revelation-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

/* 卡片标题行 */
.dr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.dr-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    background: linear-gradient(90deg, #fbbf24, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dr-date {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.38);
}

/* 星座三要素徽章行 */
.dr-signs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.dr-sign-badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.dr-sign-badge.sun {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.08);
}

.dr-sign-badge.moon {
    color: #c4b5fd;
    border-color: rgba(196, 181, 253, 0.4);
    background: rgba(196, 181, 253, 0.08);
}

.dr-sign-badge.asc {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.4);
    background: rgba(134, 239, 172, 0.08);
}

/* 关键行运标签 */
.dr-aspect-tag {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(139, 92, 246, 0.13);
    border-radius: 6px;
    padding: 4px 9px;
    margin-bottom: 8px;
    line-height: 1.5;
    border-left: 2px solid rgba(139, 92, 246, 0.5);
}

.dr-aspect-tag strong {
    color: #c4b5fd;
    font-weight: 600;
}

/* 天启正文 */
.dr-insight {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.65;
    margin-bottom: 11px;
}

/* 追问按钮 */
.dr-ask-btn {
    width: 100%;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(251, 191, 36, 0.12));
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 8px;
    color: #e2d9f3;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    letter-spacing: 0.03em;
}

.dr-ask-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(251, 191, 36, 0.2));
    border-color: rgba(139, 92, 246, 0.7);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
}

/* 加载骨骼屏 */
.dr-skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dr-skeleton-line {
    height: 10px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: drShimmer 1.5s infinite;
}

.dr-skeleton-line.w80 {
    width: 80%;
}

.dr-skeleton-line.w60 {
    width: 60%;
}

.dr-skeleton-line.w90 {
    width: 90%;
}

@keyframes drShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== 话题引导 Chips ===== */
.prompt-chips {
    display: flex;
    gap: 7px;
    padding: 10px 16px 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    /* 隐藏滚动条，保持界面干净 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.prompt-chips::-webkit-scrollbar {
    display: none;
}

.prompt-chip {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.08);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.prompt-chip:hover {
    background: rgba(139, 92, 246, 0.22);
    border-color: rgba(139, 92, 246, 0.6);
    color: #fff;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

.prompt-chip:active {
    transform: scale(0.96);
}

/* 个性化（行运相关）chip 用金色描边 */
.prompt-chip.chip-transit {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.07);
    color: #fde68a;
}

.prompt-chip.chip-transit:hover {
    background: rgba(251, 191, 36, 0.18);
    border-color: rgba(251, 191, 36, 0.7);
    color: #fff;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
}

/* ───── 历史命盘面板 ───── */
.ph-panel {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ph-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.ph-header--toggle {
    cursor: pointer;
    user-select: none;
    border-radius: 10px;
    transition: background 0.18s ease;
}

.ph-header--toggle:hover {
    background: rgba(167, 139, 250, 0.08);
}

.ph-header--toggle.ph-header--open {
    border-radius: 10px 10px 0 0;
}

.ph-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ph-chevron {
    font-size: 0.65rem;
    color: rgba(167, 139, 250, 0.6);
    transition: transform 0.22s ease;
    display: inline-block;
}

.ph-header--open .ph-chevron {
    transform: rotate(90deg);
}

.ph-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(167, 139, 250, 0.9);
    letter-spacing: 0.04em;
}

.ph-count {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 10px;
}

.ph-list {
    display: none;
    max-height: 210px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(167, 139, 250, 0.25) transparent;
}

.ph-list--open {
    display: block;
}

.ph-list::-webkit-scrollbar {
    width: 4px;
}

.ph-list::-webkit-scrollbar-thumb {
    background: rgba(167, 139, 250, 0.25);
    border-radius: 4px;
}

.ph-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.18s ease, opacity 0.3s ease, transform 0.3s ease;
    cursor: default;
}

.ph-item:last-child {
    border-bottom: none;
}

.ph-item:hover {
    background: rgba(167, 139, 250, 0.08);
}

.ph-item--active {
    background: rgba(167, 139, 250, 0.12);
    border-left: 2px solid rgba(167, 139, 250, 0.6);
    padding-left: 10px;
}

.ph-item-info {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.ph-item-name {
    font-size: 0.83rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ph-item-date {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

.ph-current-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 6px;
    background: rgba(167, 139, 250, 0.25);
    color: #c4b5fd;
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 4px;
    font-weight: 400;
}

.ph-delete-btn {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(248, 113, 113, 0.1);
    color: rgba(248, 113, 113, 0.6);
    border-radius: 50%;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    opacity: 0;
}

.ph-item:hover .ph-delete-btn {
    opacity: 1;
}

.ph-delete-btn:hover {
    background: rgba(248, 113, 113, 0.25);
    color: #f87171;
    transform: scale(1.1);
}

.ph-loading {
    display: flex;
    gap: 5px;
    justify-content: center;
    padding: 14px 0;
}

.ph-loading span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.5);
    animation: phDot 1.2s ease-in-out infinite;
}

.ph-loading span:nth-child(2) {
    animation-delay: 0.2s;
}

.ph-loading span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes phDot {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ───── Toast 轻提示 ───── */
.app-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #fff;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    max-width: 320px;
    letter-spacing: 0.02em;
}

.app-toast--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.app-toast--success {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.25), rgba(16, 185, 129, 0.2));
    border: 1px solid rgba(52, 211, 153, 0.35);
}

.app-toast--info {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.25), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(167, 139, 250, 0.35);
}

.app-toast--error {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.25), rgba(239, 68, 68, 0.2));
    border: 1px solid rgba(248, 113, 113, 0.35);
}