/* ========================================
   金融大模型对话平台 - 主样式文件
   ======================================== */

/* CSS 变量定义 */
:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --highlight-color: #e94560;
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e9ecef;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    --gradient-accent: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   登录页面样式
   ======================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 50%, #dfe6ed 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 30%, rgba(102, 126, 234, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(118, 75, 162, 0.05) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-2%, -2%) rotate(1deg); }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    margin: 20px;
    display: flex;
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-height: 600px;
}

/* 左侧品牌区域 */
.login-brand {
    flex: 1;
    background: var(--gradient-primary);
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.brand-content {
    position: relative;
    z-index: 1;
    color: var(--text-light);
}

.brand-logo {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
}

.brand-logo i {
    font-size: 48px;
    margin-right: 16px;
}

.brand-logo h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 1px;
}

.brand-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.3;
}

.brand-desc {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 40px;
    line-height: 1.8;
}

.brand-features {
    list-style: none;
}

.brand-features li {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    font-size: 15px;
    opacity: 0.95;
}

.brand-features li i {
    font-size: 20px;
    margin-right: 12px;
    opacity: 0.9;
}

/* 右侧登录表单区域 */
.login-form-wrapper {
    flex: 1;
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    margin-bottom: 40px;
}

.login-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-group-custom {
    position: relative;
}

.input-group-custom i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
    transition: color var(--transition-fast);
}

.input-group-custom input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.input-group-custom input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-group-custom input:focus + i,
.input-group-custom input:focus ~ i {
    color: #667eea;
}

.input-group-custom .toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    left: auto;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.input-group-custom .toggle-password:hover {
    color: var(--text-primary);
}

/* 记住密码和忘记密码 */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.remember-me input {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: #667eea;
    cursor: pointer;
}

.remember-me span {
    font-size: 14px;
    color: var(--text-secondary);
}

.forgot-password {
    font-size: 14px;
    color: #667eea;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.forgot-password:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* 登录按钮 */
.btn-login {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn-login:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login i {
    margin-left: 8px;
    transition: transform var(--transition-fast);
}

.btn-login:hover i {
    transform: translateX(4px);
}

/* 分隔线 */
.divider {
    display: flex;
    align-items: center;
    margin: 32px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    padding: 0 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 第三方登录 */
.social-login {
    display: flex;
    gap: 12px;
}

.btn-social {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-social i {
    margin-right: 8px;
    font-size: 18px;
}

.btn-social:hover {
    background: var(--bg-white);
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* 注册链接 */
.register-link {
    text-align: center;
    margin-top: 32px;
    font-size: 14px;
    color: var(--text-secondary);
}

.register-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.register-link a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* ========================================
   对话页面样式
   ======================================== */

.chat-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
}

/* 顶部导航 */
.chat-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-brand {
    display: flex;
    align-items: center;
}

.header-brand i {
    font-size: 28px;
    color: #667eea;
    margin-right: 12px;
}

.header-brand h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.btn-icon:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.user-avatar:hover {
    transform: scale(1.05);
}

/* 主内容区域 */
.chat-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 侧边栏 */
.chat-sidebar {
    width: 280px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
}

.chat-sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.btn-new-chat {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-new-chat i {
    margin-right: 8px;
}

.btn-new-chat:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.history-section {
    margin-bottom: 20px;
}

.history-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
}

.history-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.history-item:hover {
    background: var(--bg-light);
}

.history-item.active {
    background: rgba(102, 126, 234, 0.1);
}

.history-item i {
    font-size: 16px;
    color: var(--text-secondary);
    margin-right: 12px;
}

.history-item span {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 对话区域 */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* 欢迎界面 */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.welcome-icon i {
    font-size: 36px;
    color: var(--text-light);
}

.welcome-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.welcome-desc {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 40px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 600px;
    width: 100%;
}

.quick-action-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.quick-action-card:hover {
    border-color: #667eea;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-action-card i {
    font-size: 24px;
    color: #667eea;
    margin-bottom: 12px;
}

.quick-action-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.quick-action-card p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 消息样式 */
.message {
    display: flex;
    margin-bottom: 24px;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
}

.message.user .message-avatar {
    background: var(--gradient-primary);
    color: var(--text-light);
}

.message.assistant .message-avatar {
    background: var(--bg-light);
    color: #667eea;
}

.message-content {
    flex: 1;
    max-width: 80%;
}

.message-bubble {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.7;
}

.message.user .message-bubble {
    background: var(--text-primary);
    color: var(--text-light);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-left: 4px;
}

/* 输入区域 */
.chat-input-wrapper {
    padding: 20px 24px;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
}

.chat-input-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.chat-input-box {
    display: flex;
    align-items: flex-end;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    transition: all var(--transition-fast);
}

.chat-input-box:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.chat-input-box textarea {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    max-height: 150px;
    color: var(--text-primary);
}

.chat-input-box textarea:focus {
    outline: none;
}

.chat-input-box textarea::placeholder {
    color: var(--text-secondary);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.btn-attach {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.btn-attach:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--text-primary);
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.btn-send:hover {
    background: #333;
    transform: scale(1.05);
}

.btn-send:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 16px 20px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    margin-right: 4px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 992px) {
    .login-container {
        flex-direction: column;
        max-width: 500px;
    }

    .login-brand {
        padding: 40px 30px;
    }

    .brand-title {
        font-size: 28px;
    }

    .login-form-wrapper {
        padding: 40px 30px;
    }

    .chat-sidebar {
        position: fixed;
        left: 0;
        top: 64px;
        bottom: 0;
        z-index: 99;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .chat-sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
}

@media (max-width: 768px) {
    .login-brand {
        display: none;
    }

    .login-container {
        margin: 16px;
        border-radius: var(--radius-lg);
    }

    .login-form-wrapper {
        padding: 32px 24px;
    }

    .login-header h2 {
        font-size: 24px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .chat-messages {
        padding: 16px;
    }

    .message-content {
        max-width: 90%;
    }

    .chat-input-wrapper {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .social-login {
        flex-direction: column;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-desc {
        font-size: 14px;
    }
}

/* ========================================
   滚动条样式
   ======================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================
   工具类
   ======================================== */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
