/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --bg-dark: #ffffff;
    --bg-card: #f8f9fa;
    --bg-input: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================== 背景动画 ==================== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: 
        radial-gradient(ellipse at 20% 30%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(118, 75, 162, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(79, 172, 254, 0.06) 0%, transparent 50%);
}

/* 网格背景 */
.background-animation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: 
        linear-gradient(rgba(102, 126, 234, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102, 126, 234, 0.06) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    transform: perspective(500px) rotateX(60deg);
}

@keyframes gridMove {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }
    100% {
        transform: perspective(500px) rotateX(60deg) translateY(50px);
    }
}

/* 发光圆圈 */
.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    animation: floatGlow 25s infinite ease-in-out;
    mix-blend-mode: screen;
}

.circle-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, rgba(102, 126, 234, 0) 70%);
    top: -300px;
    left: -300px;
    animation-delay: 0s;
}

.circle-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(240, 147, 251, 0.12) 0%, rgba(245, 87, 108, 0) 70%);
    bottom: -250px;
    right: -250px;
    animation-delay: 8s;
}

.circle-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.12) 0%, rgba(0, 242, 254, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 16s;
}

@keyframes floatGlow {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.2;
    }
    25% {
        transform: translate(80px, -80px) scale(1.15);
        opacity: 0.3;
    }
    50% {
        transform: translate(-60px, 60px) scale(0.9);
        opacity: 0.25;
    }
    75% {
        transform: translate(100px, 80px) scale(1.1);
        opacity: 0.35;
    }
}

/* 粒子效果 */
.background-animation::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(102, 126, 234, 0.4), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(240, 147, 251, 0.4), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(79, 172, 254, 0.4), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(102, 126, 234, 0.4), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(240, 147, 251, 0.4), transparent),
        radial-gradient(1px 1px at 33% 80%, rgba(79, 172, 254, 0.4), transparent),
        radial-gradient(1px 1px at 15% 90%, rgba(102, 126, 234, 0.4), transparent);
    background-size: 200% 200%;
    background-position: 0% 0%;
    animation: stars 60s ease-in-out infinite;
}

@keyframes stars {
    0%, 100% {
        background-position: 0% 0%;
        opacity: 1;
    }
    25% {
        background-position: 50% 25%;
        opacity: 0.8;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
    75% {
        background-position: 50% 75%;
        opacity: 0.8;
    }
}

/* 光线效果 */
.light-beam {
    position: absolute;
    width: 2px;
    height: 200px;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(102, 126, 234, 0.6) 50%, 
        transparent 100%);
    filter: blur(1px);
    animation: beamMove 15s ease-in-out infinite;
    opacity: 0;
}

.light-1 {
    left: 15%;
    top: -200px;
    animation-delay: 0s;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(102, 126, 234, 0.3) 50%, 
        transparent 100%);
}

.light-2 {
    left: 50%;
    top: -200px;
    animation-delay: 5s;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(240, 147, 251, 0.3) 50%, 
        transparent 100%);
}

.light-3 {
    left: 85%;
    top: -200px;
    animation-delay: 10s;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(79, 172, 254, 0.3) 50%, 
        transparent 100%);
}

@keyframes beamMove {
    0% {
        transform: translateY(0) scaleY(1);
        opacity: 0;
    }
    20% {
        opacity: 0.8;
    }
    80% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(calc(100vh + 200px)) scaleY(1.5);
        opacity: 0;
    }
}

/* 漂浮方块 */
.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(5px);
    animation: floatShape 20s infinite ease-in-out;
}

.shape-1 {
    width: 80px;
    height: 80px;
    left: 10%;
    top: 20%;
    animation-delay: 0s;
    border-radius: 20% 80% 55% 45% / 25% 60% 40% 75%;
}

.shape-2 {
    width: 60px;
    height: 60px;
    right: 15%;
    top: 40%;
    animation-delay: 4s;
    border-radius: 50%;
    background: rgba(240, 147, 251, 0.08);
    border-color: rgba(240, 147, 251, 0.2);
}

.shape-3 {
    width: 100px;
    height: 100px;
    left: 70%;
    bottom: 30%;
    animation-delay: 8s;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: rgba(79, 172, 254, 0.08);
    border-color: rgba(79, 172, 254, 0.2);
}

.shape-4 {
    width: 70px;
    height: 70px;
    left: 25%;
    bottom: 20%;
    animation-delay: 12s;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
}

.shape-5 {
    width: 50px;
    height: 50px;
    right: 30%;
    top: 60%;
    animation-delay: 16s;
    border-radius: 40% 60% 60% 40% / 40% 60% 40% 60%;
    background: rgba(240, 147, 251, 0.08);
    border-color: rgba(240, 147, 251, 0.2);
}

@keyframes floatShape {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(30px, -30px) rotate(90deg);
    }
    50% {
        transform: translate(-20px, 40px) rotate(180deg);
    }
    75% {
        transform: translate(40px, 20px) rotate(270deg);
    }
}

/* ==================== 主容器 ==================== */
.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

/* ==================== 顶部导航栏 ==================== */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 2px 8px rgba(102, 126, 234, 0.3));
}

.logo-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.model-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.token-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(118, 75, 162, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(118, 75, 162, 0.3);
    font-weight: 500;
}

.token-icon {
    width: 20px;
    height: 20px;
    color: #a78bfa;
}

/* ==================== 聊天区域 ==================== */
.chat-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(102, 126, 234, 0.15);
    box-shadow: var(--shadow-lg);
}

/* ==================== 欢迎屏幕 ==================== */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

.welcome-content {
    text-align: center;
    max-width: 900px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    animation: bounce 2s infinite;
}

.welcome-icon svg {
    width: 100%;
    height: 100%;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.welcome-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 15px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 50px;
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.feature-card {
    background: rgba(102, 126, 234, 0.06);
    padding: 30px 20px;
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    transition: all 0.3s ease;
    cursor: default;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(102, 126, 234, 0.1);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

.example-questions {
    margin-top: 30px;
}

.example-title {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.example-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.example-btn {
    padding: 12px 24px;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.example-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

/* ==================== 消息列表 ==================== */
.messages {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

.message {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
    box-shadow: var(--shadow-md);
}

.message.user .message-avatar {
    background: var(--primary-gradient);
}

.message.ai .message-avatar {
    background: var(--success-gradient);
}

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--primary-gradient);
    border-bottom-right-radius: 4px;
}

.message.ai .message-content {
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-bottom-left-radius: 4px;
}

.message-text {
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.message-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-tokens {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(167, 139, 250, 0.2);
    border-radius: 6px;
}

/* ==================== 加载动画 ==================== */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 30px;
    margin: 0 30px 20px;
    background: rgba(102, 126, 234, 0.06);
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.loading-dots {
    display: flex;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-gradient);
    border-radius: 50%;
    animation: loadingBounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==================== 输入区域 ==================== */
.input-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.action-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.08);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.message-input {
    flex: 1;
    padding: 14px 20px;
    background: rgba(102, 126, 234, 0.04);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    transition: all 0.3s ease;
}

.message-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    height: 48px;
    padding: 0 24px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-icon {
    width: 18px;
    height: 18px;
}

.input-footer {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tips {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.tip-icon {
    width: 16px;
    height: 16px;
}

.api-source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.api-source a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.api-source a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.api-icon {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

/* ==================== Toast 通知 ==================== */
.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    color: var(--text-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(102, 126, 234, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    font-size: 14px;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        gap: 10px;
    }

    .header {
        padding: 15px 20px;
        border-radius: 15px;
    }

    .logo {
        gap: 10px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
    }

    .logo-text {
        font-size: 20px;
    }

    .logo-subtitle {
        font-size: 10px;
    }

    .header-info {
        gap: 10px;
    }

    .model-badge,
    .token-display {
        padding: 6px 12px;
        font-size: 13px;
    }

    .welcome-title {
        font-size: 32px;
    }

    .welcome-subtitle {
        font-size: 16px;
    }

    .feature-cards {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .feature-card {
        padding: 20px 15px;
    }

    .feature-icon {
        font-size: 32px;
    }

    .messages {
        padding: 20px 15px;
    }

    .message-content {
        max-width: 85%;
    }

    .input-container {
        padding: 15px;
        border-radius: 15px;
    }

    .send-text {
        display: none;
    }

    .send-btn {
        width: 48px;
        padding: 0;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .header-info {
        width: 100%;
        justify-content: space-between;
    }

    .logo-text-wrapper {
        gap: 0;
    }

    .logo-subtitle {
        font-size: 9px;
    }

    .welcome-icon {
        width: 80px;
        height: 80px;
    }

    .feature-cards {
        grid-template-columns: 1fr;
    }

    .example-list {
        flex-direction: column;
    }

    .example-btn {
        width: 100%;
    }
}

/* 移动端背景优化 */
@media (max-width: 768px) {
    /* 简化网格动画 */
    .background-animation::before {
        opacity: 0.5;
        animation-duration: 30s;
    }
    
    /* 减小光圈尺寸 */
    .circle-1 {
        width: 400px;
        height: 400px;
    }
    
    .circle-2 {
        width: 350px;
        height: 350px;
    }
    
    .circle-3 {
        width: 300px;
        height: 300px;
    }
    
    /* 隐藏部分漂浮形状以提升性能 */
    .shape-4,
    .shape-5 {
        display: none;
    }
    
    /* 减少光线效果 */
    .light-3 {
        display: none;
    }
}

/* 禁用动画选项（用户偏好设置） */
@media (prefers-reduced-motion: reduce) {
    .background-animation::before,
    .circle,
    .light-beam,
    .shape,
    .background-animation::after {
        animation: none !important;
    }
    
    .circle {
        opacity: 0.1;
    }
}

