/* ============================================
   基础样式
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    overflow: hidden;
}

.page {
    display: none;
    width: 100%; height: 100%;
    position: fixed; top: 0; left: 0;
    overflow: auto;
}

.page.active { display: flex; }

.hidden { display: none !important; }

/* ============================================
   封面页
   ============================================ */
#page-cover {
    position: relative;
    align-items: center;
    justify-content: center;
}

.cover__bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('https://images.unsplash.com/photo-1517502884422-41eaead166d4?auto=format&fit=crop&w=1920') center/cover no-repeat;
    z-index: 0;
}

.cover__overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.60) 100%);
    z-index: 1;
}

.cover__content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 720px;
    padding: 0 24px;
}

.cover__lines {
    margin-bottom: 2rem;
}

.cover__line {
    font-size: 1.45rem;
    font-weight: 500;
    color: #e2e8f0;
    line-height: 2.2;
    letter-spacing: 1px;
    text-shadow: 0 0 16px rgba(255,255,255,0.12);
}

.cover__meta {
    font-size: 0.75rem;
    color: #64748b;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.cover__btn {
    background: #f59e0b;
    color: #0f172a;
    border: none;
    padding: 16px 56px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.35), 0 4px 15px rgba(0,0,0,0.3);
    letter-spacing: 2px;
}

.cover__btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.55), 0 8px 25px rgba(0,0,0,0.4);
    background: #fbbf24;
}

/* Stagger fade-in animations */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    animation: fadeInUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 介绍信弹窗 */
.cover__modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.cover__modal.active { display: flex; }

.cover__letter {
    background: #fff;
    color: #333;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 16px;
    padding: 32px;
    overflow-y: auto;
    animation: scaleIn 0.4s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.cover__letter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.cover__letter-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: #333;
}

.cover__letter-sender {
    font-weight: 700;
    font-size: 1.1rem;
}

.cover__letter-date {
    font-size: 0.85rem;
    color: #999;
    margin-left: auto;
}

.cover__letter-body {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #444;
}

.cover__letter-body p {
    margin-bottom: 12px;
    text-indent: 2em;
}

.cover__letter-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    color: #0d8a4f;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
}

.cover__letter-footer:hover {
    color: #0a6b3d;
}

/* ============================================
   资料页 — 头像选择与昵称输入
   ============================================ */
#page-profile {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    align-items: center;
    justify-content: center;
}

.profile__container {
    width: 100%;
    max-width: 480px;
    padding: 48px 32px;
    text-align: center;
    color: #fff;
}

.profile__title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile__subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 40px;
}

.profile__label {
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    margin-bottom: 16px;
    text-align: left;
}

.profile__avatar-section {
    margin-bottom: 32px;
}

.profile__avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.profile__avatar-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    background: rgba(255,255,255,0.08);
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s;
    user-select: none;
}

.profile__avatar-option:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}

.profile__avatar-option.selected {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

.profile__name-section {
    margin-bottom: 40px;
}

.profile__name-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    outline: none;
    transition: border-color 0.25s;
    box-sizing: border-box;
}

.profile__name-input::placeholder {
    color: rgba(255,255,255,0.35);
}

.profile__name-input:focus {
    border-color: #f59e0b;
}

.profile__btn {
    width: 100%;
    padding: 16px;
    font-size: 1.05rem;
}

/* ============================================
   聊天页 — 桌面微信风格（参考图）
   ============================================ */
#page-chat {
    background: #fff;
}

.chat__container {
    display: flex;
    width: 100%; height: 100%;
}

/* ---------- 左侧边栏 ---------- */
.chat__sidebar {
    width: 300px;
    background: #d4d4d4;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px 16px;
    gap: 20px;
}

.chat__dept-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.chat__dept-item:hover {
    background: rgba(0,0,0,0.06);
}

.chat__dept-item.active {
    background: rgba(0,0,0,0.1);
}

.chat__dept-item.locked {
    opacity: 0.35;
    cursor: default;
}

.chat__dept-item.locked:hover {
    background: transparent;
}

/* 圆形黑色头像 */
.chat__dept-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.chat__dept-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

/* 红点通知 */
.chat__dept-badge {
    position: absolute;
    top: 8px; left: 50px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #ff3b30;
    border: 2px solid #d4d4d4;
    z-index: 2;
}

/* 联系人信息 */
.chat__dept-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat__dept-name {
    font-weight: 700;
    font-size: 1rem;
    color: #000;
}

/* 两行灰色占位线 */
.chat__dept-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat__dept-line {
    height: 8px;
    border-radius: 4px;
    background: #aaa;
}

.chat__dept-line--short {
    width: 60%;
}

/* ---------- 右侧聊天区 ---------- */
.chat__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
}

/* 信件卡片 */
.chat__letter {
    margin: 20px 24px 0;
    padding: 24px 28px;
    background: #d4d4d4;
    border-radius: 16px;
    max-height: 35vh;
    overflow-y: auto;
}

.chat__letter.hidden {
    display: none;
}

.chat__letter-body {
    font-size: 0.95rem;
    line-height: 1.9;
    color: #333;
}

.chat__letter-body p {
    margin-bottom: 12px;
    text-indent: 2em;
}

/* 消息区域 */
.chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 系统消息 */
.chat__bubble--system {
    align-self: center;
    background: #e5e5e5;
    color: #888;
    font-size: 0.8rem;
    padding: 6px 16px;
    border-radius: 12px;
    margin: 4px 0;
}

/* 消息行 */
.chat__row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 80%;
}

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

/* 消息头像 */
.chat__msg-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    overflow: hidden;
}

.chat__msg-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

/* 消息内容区 */
.chat__msg-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat__row--user .chat__msg-content {
    align-items: flex-end;
}

/* 名字+日期 */
.chat__msg-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.chat__row--user .chat__msg-meta {
    flex-direction: row-reverse;
}

.chat__msg-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #000;
}

.chat__msg-date {
    font-size: 0.75rem;
    color: #999;
}

/* 气泡 */
.chat__bubble {
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
    background: #d4d4d4;
    word-break: break-word;
    animation: msgFadeIn 0.3s ease;
}

.chat__row--user .chat__bubble {
    background: #000;
    color: #fff;
}

/* ---------- 底部输入区 ---------- */
.chat__footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.chat__input-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat__input-wrap {
    flex: 1;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 0 16px;
    display: flex;
    align-items: center;
}

.chat__input {
    width: 100%;
    padding: 12px 0;
    border: none;
    outline: none;
    font-size: 0.95rem;
    background: transparent;
}

.chat__send {
    padding: 12px 28px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.chat__send:hover {
    opacity: 0.85;
}

.chat__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 底部提示条 */
.chat__footer-tip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 12px;
    color: #666;
    font-size: 0.9rem;
}

.chat__footer-tip.hidden {
    display: none;
}

.chat__next-btn {
    padding: 8px 20px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.chat__next-btn:hover {
    opacity: 0.85;
}

.chat__next-btn.hidden {
    display: none;
}

/* ---------- 动画 ---------- */
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ============================================
   策略页
   ============================================ */
#page-strategy {
    background: #f8f9fa;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.strategy__container {
    width: 100%;
    max-width: 1200px;
}

.strategy__title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
    text-align: center;
    margin-bottom: 8px;
}

.strategy__subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
}

.strategy__body {
    display: flex;
    gap: 32px;
    height: 70vh;
}

.strategy__cards {
    width: 35%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.strategy__card {
    background: #fff;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.strategy__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.strategy__card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.strategy__card-header {
    margin-bottom: 8px;
}

.strategy__card-dept {
    font-size: 0.75rem;
    color: #0d8a4f;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.strategy__card-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.strategy__card-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.strategy__summary {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 16px;
    font-size: 0.95rem;
    color: #1a1a2e;
    line-height: 1.6;
}

.strategy__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
    color: #666;
}

.strategy__generate-btn {
    margin-top: auto;
    padding: 16px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #0a192f;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.strategy__generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.5);
}

.strategy__generate-btn:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

.strategy__result {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow-y: auto;
}

.strategy__result-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    text-align: center;
}

.strategy__result-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.strategy__chart-container {
    height: 300px;
    margin-bottom: 24px;
}

.strategy__analysis {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #444;
}

.strategy__analysis h4 {
    margin-bottom: 12px;
    color: #1a1a2e;
}

.strategy__action {
    justify-content: center;
    margin-top: 32px;
}

/* ============================================
   结果页
   ============================================ */
#page-result {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.result__container {
    width: 100%;
    max-width: 1000px;
    text-align: center;
}

.result__title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.result__subtitle {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 48px;
}

/* 横向滑动卡片 */
.result__carousel-wrapper {
    position: relative;
    margin-bottom: 48px;
}

.result__carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 20px 0;
    scrollbar-width: none;
}

.result__carousel::-webkit-scrollbar {
    display: none;
}

.result__card {
    flex: 0 0 280px;
    height: 420px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.result__card:hover {
    transform: translateY(-4px);
}

.result__card-content {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #333;
}

.result__card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 12px;
}

.result__card-text {
    font-size: 0.9rem;
    line-height: 1.7;
    color: #333;
    flex: 1;
    overflow-y: auto;
}

.result__card-img {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.result__card-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.result__carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.result__carousel-arrow:hover {
    background: rgba(255,255,255,0.4);
}

.result__carousel-arrow--left { left: -20px; }
.result__carousel-arrow--right { right: -20px; }

/* 产品展示区 */
.result__products {
    margin-bottom: 40px;
}

.result__products h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.result__product-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.result__product-item {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px;
    width: 200px;
}

.result__product-img {
    width: 100%;
    height: 160px;
    background: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
}

.result__product-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.result__product-item p {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.result__restart {
    padding: 14px 40px;
    background: transparent;
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.result__restart:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.6);
}

/* ============================================
   动画
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
    .chat__sidebar {
        width: 200px;
    }
    .cover__title {
        font-size: 2rem;
    }
    .strategy__body {
        flex-direction: column;
        height: auto;
    }
    .strategy__cards {
        width: 100%;
    }
    .result__card {
        flex: 0 0 240px;
        height: 300px;
    }
}
