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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --bg: #0f0f23;
    --bg-card: #1a1a2e;
    --bg-hover: #252542;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255,255,255,0.1);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
    padding: 8px 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

/* 主容器 */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 80px 20px 40px;
}

/* 页面切换 */
.section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.section.active {
    display: block;
}

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

/* 首页 Hero */
.hero {
    text-align: center;
    padding: 40px 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 40px;
}

/* 结果卡片 */
.result-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px;
    margin: 32px 0;
    border: 1px solid var(--border);
    text-align: left;
}

.result-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

/* 角色头像容器 */
.avatar-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.type-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.type-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.4);
}

.mbti-type {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 4px;
}

.type-name {
    font-size: 1.5rem;
    color: var(--text);
    margin-top: 8px;
}

.type-desc {
    color: var(--text-muted);
    margin-top: 8px;
    font-size: 0.95rem;
}

/* 结果主体 */
.result-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

@media (max-width: 768px) {
    .result-body {
        grid-template-columns: 1fr;
    }
}

/* 雷达图容器 */
.radar-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 320px;
}

#radarChart {
    max-width: 100%;
    height: auto;
}

.radar-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.radar-labels .label {
    position: absolute;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.radar-labels .label.top { top: 10px; left: 50%; transform: translateX(-50%); }
.radar-labels .label.right { top: 50%; right: 10px; transform: translateY(-50%); }
.radar-labels .label.bottom-right { bottom: 60px; right: 30px; }
.radar-labels .label.bottom-left { bottom: 60px; left: 30px; }
.radar-labels .label.left { top: 50%; left: 10px; transform: translateY(-50%); }

/* 维度分数 */
.dimension-scores {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
}

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

.dim-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 60px;
    text-align: center;
}

.dim-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.dim-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 1s ease;
}

/* 优劣势 */
.strengths-weaknesses {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 600px) {
    .strengths-weaknesses {
        grid-template-columns: 1fr;
    }
}

.strengths, .weaknesses {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
}

.strengths h3 {
    color: var(--success);
    margin-bottom: 12px;
    font-size: 1rem;
}

.weaknesses h3 {
    color: var(--warning);
    margin-bottom: 12px;
    font-size: 1rem;
}

.strengths ul, .weaknesses ul {
    list-style: none;
}

.strengths li, .weaknesses li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.strengths li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
}

.weaknesses li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--warning);
}

/* 行动建议 */
.action-advice {
    margin-bottom: 32px;
}

.action-advice h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.advice-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .advice-cards {
        grid-template-columns: 1fr;
    }
}

.advice-card {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s, background 0.3s;
}

.advice-card:hover {
    transform: translateY(-4px);
    background: var(--bg-hover);
}

.advice-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.advice-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.advice-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 按钮 */
.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-hover);
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
}

/* 欢迎状态 */
.welcome-state {
    text-align: center;
    padding: 60px 20px;
}

.welcome-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.welcome-state h2 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.welcome-state p {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.features {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

/* 测试页面 */
.test-container {
    max-width: 700px;
    margin: 0 auto;
}

.test-header {
    text-align: center;
    margin-bottom: 32px;
}

.test-header h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.test-header p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.btn-back {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* 聊天容器 */
.chat-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--bg);
    flex-shrink: 0;
}

.ai-message .avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.user-message .avatar {
    background: var(--bg-hover);
    order: 2;
}

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

.message-content {
    background: var(--bg);
    padding: 16px;
    border-radius: 16px;
    max-width: 80%;
}

.user-message .message-content {
    background: var(--primary);
}

.message-content p {
    margin-bottom: 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-reply {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.quick-reply:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* 输入区域 */
.input-area {
    display: flex;
    gap: 12px;
}

.input-area input {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-area input:focus {
    border-color: var(--primary);
}

.input-area input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s;
}

.send-btn:hover {
    transform: translateY(-2px);
}

/* 报告页面 */
.report-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 0;
}

.report-container h1 {
    text-align: center;
    margin-bottom: 32px;
}

/* 关于页面 */
.about-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 0;
}

.about-container h1 {
    text-align: center;
    margin-bottom: 32px;
}

.about-content h3 {
    margin: 24px 0 12px;
    color: var(--primary);
}

.about-content ul {
    margin-left: 24px;
    color: var(--text-muted);
}

.about-content li {
    margin-bottom: 8px;
}

.disclaimer {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning);
    padding: 16px;
    border-radius: 0 8px 8px 0;
    margin-top: 24px;
    font-size: 0.9rem;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 32px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    position: relative;
    text-align: center;
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-btn:hover {
    color: var(--text);
}

.share-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 40px;
    border-radius: 16px;
    margin: 20px 0;
}

.share-mbti {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 4px;
}

.share-type {
    font-size: 1.2rem;
    margin-top: 8px;
    opacity: 0.9;
}

.share-quote {
    font-size: 0.9rem;
    margin-top: 16px;
    opacity: 0.8;
    font-style: italic;
}

.share-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* 进阶测试横幅 */
.advanced-test-banner {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    padding: 20px 24px;
    margin: 24px 0;
    animation: slideUp 0.6s ease 0.3s both;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.banner-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.banner-text {
    flex: 1;
    min-width: 200px;
}

.banner-text h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: var(--text);
}

.banner-text p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.btn-advanced {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-advanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* 隐藏进阶测试横幅（进阶测试完成后） */
.advanced-test-banner.completed {
    display: none;
}

/* 打字动画 */
.typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* 结果动画 */
.result-card {
    animation: slideUp 0.6s ease;
}

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

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
