/* ========================================
   CSS Variables - 主题配置
   ======================================== */

:root {
    /* 主色调 - 现代渐变紫蓝色 */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-gradient-hover: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    --primary-color: #667eea;
    --primary-hover: #5a67d8;
    --accent-color: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.3);

    /* 背景色 */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;
    --bg-glass: rgba(255, 255, 255, 0.8);

    /* 侧边栏 - 深邃渐变 */
    --sidebar-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(102, 126, 234, 0.2);
    --sidebar-text: #e2e8f0;
    --sidebar-text-muted: #94a3b8;
    --sidebar-border: rgba(255, 255, 255, 0.06);

    /* 文字颜色 */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* 边框 */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: rgba(102, 126, 234, 0.5);

    /* 消息区域 */
    --message-user-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --message-user-text: #ffffff;
    --message-ai-bg: #ffffff;
    --message-ai-text: #1e293b;
    --message-ai-border: #e2e8f0;

    /* 阴影系统 */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.15);
    --shadow-glow-strong: 0 0 30px rgba(102, 126, 234, 0.25);

    /* 输入框 */
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-focus: #667eea;
    --input-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);

    /* 过渡 */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* 圆角 */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
}

/* 暗色主题 */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    --bg-glass: rgba(15, 23, 42, 0.9);

    --sidebar-bg: linear-gradient(180deg, #0a0a14 0%, #0f172a 50%, #1e293b 100%);
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(102, 126, 234, 0.15);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --border-light: #1e293b;

    --message-ai-bg: #1e293b;
    --message-ai-text: #f1f5f9;
    --message-ai-border: #334155;

    --input-bg: #1e293b;
    --input-border: #334155;
    --input-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);

    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.1);
    --shadow-glow-strong: 0 0 30px rgba(102, 126, 234, 0.15);
}

/* ========================================
   Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* AI对话页面需要固定视口，禁止 body 滚动 */
body.page-chat {
    overflow: hidden;
}

.container {
    display: flex;
    height: calc(100vh - 60px);
    width: 100vw;
    margin-top: 60px;
}

/* ========================================
   顶部导航栏
   ======================================== */

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

[data-theme="dark"] .top-navbar {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

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

.sidebar-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.navbar-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-logo svg {
    border-radius: 6px;
}

.navbar-title {
    font-size: 18px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.navbar-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.navbar-login-btn {
    padding: 8px 20px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.navbar-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.navbar-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.navbar-nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.navbar-nav-link.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.navbar-nav-link svg {
    flex-shrink: 0;
}

/* 导航栏积分链接 */
.navbar-credits-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full, 9999px);
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.12), rgba(255, 215, 0, 0.12));
    color: #e8a000;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid rgba(255, 165, 0, 0.2);
}

.navbar-credits-link:hover {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.2), rgba(255, 215, 0, 0.2));
    transform: translateY(-1px);
}

.navbar-credits-link svg {
    flex-shrink: 0;
}

[data-theme="dark"] .navbar-credits-link {
    color: #ffb800;
    border-color: rgba(255, 184, 0, 0.3);
}

.navbar-user-info {
    position: relative;
}

.navbar-avatar-btn {
    width: auto;
    min-width: 36px;
    height: 36px;
    padding: 0 10px 0 0;
    gap: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.navbar-avatar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.navbar-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.navbar-user-id {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 8px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
    font-weight: 600;
}

.navbar-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 100;
}

.navbar-dropdown.show,
.navbar-user-info:hover .navbar-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

[data-theme="dark"] .navbar-dropdown {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
}

.dropdown-user-info {
    padding: 12px 16px;
}

.dropdown-username {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dropdown-item svg {
    flex-shrink: 0;
}

/* ========================================
   侧边栏样式 - 深色现代风格
   ======================================== */

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
    position: relative;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: 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.02'%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");
    pointer-events: none;
    opacity: 0.5;
}

.sidebar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.1), transparent);
}

/* 侧边栏收起状态 */
.sidebar.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar.collapsed * {
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* 新建对话按钮 */
.new-chat-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.new-chat-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4) 0%, rgba(118, 75, 162, 0.4) 100%);
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.new-chat-btn:hover::before {
    opacity: 1;
}

.new-chat-btn:active {
    transform: translateY(0);
}

.new-chat-btn svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-fast);
}

.new-chat-btn:hover svg {
    transform: rotate(90deg);
}

/* 模型选择器 */
.model-selector-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.model-select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.model-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.model-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.model-select option {
    background: #1e293b;
    color: #fff;
    padding: 12px;
}

/* 图片配置选项 */
.image-config-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-sm);
    animation: slideDown 0.25s ease;
}

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

.config-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.config-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xs);
    color: var(--sidebar-text);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.config-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.config-select option {
    background: #1e293b;
    color: #fff;
}

/* 聊天历史 */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    position: relative;
    z-index: 1;
}

.chat-history::-webkit-scrollbar {
    width: 5px;
}

.chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    position: relative;
}

.chat-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary-gradient);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-fast);
}

.chat-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.chat-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text);
}

.chat-item.active::before {
    height: 60%;
}

.chat-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.chat-item:hover svg {
    opacity: 0.9;
}

.chat-item span.chat-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item span.chat-item-time {
    flex-shrink: 0;
    font-size: 11px;
    opacity: 0.4;
    display: none;
}

.chat-item:hover .chat-item-time {
    display: none;
}

.chat-item-actions {
    display: none;
    gap: 2px;
    flex-shrink: 0;
}

.chat-item:hover .chat-item-actions {
    display: flex;
}

.chat-item-action-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    padding: 0;
}

.chat-item-action-btn:hover {
    background: rgba(255,255,255,0.15);
    color: var(--sidebar-text);
}

.chat-item-action-btn[data-action="delete"]:hover {
    color: #ef4444;
}

.chat-history-loading,
.chat-history-empty {
    padding: 20px 14px;
    text-align: center;
    color: var(--sidebar-text-muted);
    font-size: 13px;
    opacity: 0.6;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2));
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.feedback-btn,
.theme-toggle {
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.feedback-btn:hover,
.theme-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.feedback-btn svg,
.theme-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.theme-toggle:hover svg {
    transform: rotate(180deg);
}

/* ========================================
   主内容区
   ======================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

/* 背景装饰 */
.main-content::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(102, 126, 234, 0.03) 0%, transparent 70%);
    pointer-events: none;
    animation: backgroundPulse 15s ease-in-out infinite;
}

@keyframes backgroundPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* ========================================
   欢迎界面 - 现代化设计
   ======================================== */

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    position: relative;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    animation: fadeInUp 0.8s ease;
}

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

.welcome-screen .logo {
    margin-bottom: 32px;
    position: relative;
}

.welcome-screen .logo::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(ellipse at center, rgba(102, 126, 234, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: logoGlow 3s ease-in-out infinite;
    z-index: -1;
}

@keyframes logoGlow {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

.welcome-screen .logo svg {
    width: 88px;
    height: 88px;
    filter: drop-shadow(0 15px 35px rgba(102, 126, 234, 0.35));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(2deg);
    }
    75% {
        transform: translateY(-8px) rotate(-2deg);
    }
}

.welcome-screen h1 {
    font-size: 48px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -1px;
    position: relative;
}

.welcome-screen h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.welcome-screen p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 56px;
    max-width: 420px;
    line-height: 1.7;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 640px;
}

.suggestion-btn {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.suggestion-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.suggestion-btn::after {
    content: '✨';
    font-size: 18px;
    transition: transform var(--transition-bounce);
}

.suggestion-btn:nth-child(2)::after {
    content: '📝';
}

.suggestion-btn:nth-child(3)::after {
    content: '💻';
}

.suggestion-btn:nth-child(4)::after {
    content: '📄';
}

.suggestion-btn span,
.suggestion-btn {
    position: relative;
    z-index: 1;
}

.suggestion-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.suggestion-btn:hover::before {
    opacity: 0.05;
}

.suggestion-btn:hover::after {
    transform: scale(1.2) rotate(10deg);
}

.suggestion-btn:active {
    transform: translateY(-2px);
}

/* ========================================
   消息样式 - 现代气泡设计
   ======================================== */

.message {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    animation: messageSlideIn 0.4s ease;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.message-avatar:hover {
    transform: scale(1.1);
}

.message.user .message-avatar {
    background: var(--primary-gradient);
    color: #fff;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .message.assistant .message-avatar {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-color: #475569;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.message-role {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.message-text {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-primary);
    background: var(--message-ai-bg);
    padding: 18px 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--message-ai-border);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.message.user .message-text {
    background: var(--message-user-bg);
    color: var(--message-user-text);
    border: none;
    box-shadow: var(--shadow-md), 0 4px 20px rgba(102, 126, 234, 0.2);
}

.message-text p {
    margin-bottom: 14px;
}

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

.message-text pre {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 18px;
    overflow-x: auto;
    margin: 14px 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', monospace;
    font-size: 13px;
    border: 1px solid var(--border-color);
    position: relative;
}

.message-text pre::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 14px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 16px 0 0 #f59e0b, 32px 0 0 #22c55e;
}

.message.user .message-text pre {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.message-text code {
    background: var(--bg-tertiary);
    padding: 3px 8px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', monospace;
    font-size: 13px;
    border: 1px solid var(--border-light);
}

.message.user .message-text code {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.message-text pre code {
    background: none;
    padding: 0;
    border: none;
}

/* 消息图片样式 */
.message-image-container {
    margin-bottom: 12px;
    max-width: 100%;
}

.message-image {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    object-fit: contain;
    background: var(--bg-tertiary);
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* 用户消息中的图片 */
.message.user .message-image-container {
    display: flex;
    justify-content: flex-end;
}

.message.user .message-image {
    max-height: 300px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* AI消息中的生成图片 */
.message.assistant .message-image {
    max-height: 450px;
    border: 1px solid var(--border-color);
}

/* 多图片布局 */
.message-content .message-image-container + .message-image-container {
    margin-top: 8px;
}

/* 图片加载状态 */
.message-image[src=""] {
    min-height: 200px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 响应式图片 */
@media (max-width: 768px) {
    .message-image {
        max-height: 300px;
    }

    .message.assistant .message-image {
        max-height: 350px;
    }

    .message.user .message-image {
        max-height: 200px;
    }
}

/* ========================================
   输入区域 - 现代化设计
   ======================================== */

.input-container {
    padding: 20px 24px 28px;
    background: linear-gradient(180deg, transparent 0%, var(--bg-primary) 30%);
    position: relative;
}

.input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 900px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.image-preview-container {
    margin-bottom: 16px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.image-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.image-preview-item {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.image-preview-item:hover {
    transform: scale(1.05);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    opacity: 0;
}

.image-preview-item:hover .image-preview-remove {
    opacity: 1;
}

.image-preview-remove:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 16px 20px;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: var(--radius-2xl);
    transition: all var(--transition-fast);
    box-shadow: var(--input-shadow);
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.input-wrapper::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-2xl);
    background: var(--primary-gradient);
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: transparent;
    box-shadow: var(--shadow-md), var(--shadow-glow-strong);
}

.input-wrapper:focus-within::before {
    opacity: 1;
}

.image-upload-btn {
    padding: 11px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.image-upload-btn:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
    transform: scale(1.08);
}

.image-upload-btn:active {
    transform: scale(0.95);
}

.image-upload-btn svg {
    width: 20px;
    height: 20px;
}

#messageInput {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    max-height: 200px;
    overflow-y: auto;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

#messageInput:focus {
    outline: none;
}

.send-btn {
    padding: 12px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-full);
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.4;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.send-btn:not(:disabled) {
    opacity: 1;
}

.send-btn:not(:disabled):hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.send-btn:not(:disabled):active {
    transform: scale(0.95);
}

.send-btn:disabled {
    cursor: not-allowed;
}

.send-btn svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-fast);
}

.send-btn:not(:disabled):hover svg {
    transform: translateX(2px) translateY(-2px);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 8px 0;
    font-size: 12px;
    color: var(--text-muted);
    max-width: 900px;
    margin: 0 auto;
}

.char-count {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.disclaimer {
    opacity: 0.7;
}


/* ========================================
   反馈弹窗
   ======================================== */

.feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.feedback-modal.active {
    opacity: 1;
    visibility: visible;
}

.feedback-modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl), 0 0 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(30px);
    transition: all var(--transition-normal);
}

.feedback-modal.active .feedback-modal-content {
    transform: scale(1) translateY(0);
}

.feedback-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 26px 30px;
    border-bottom: 1px solid var(--border-color);
}

.feedback-modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.feedback-close-btn {
    padding: 10px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.feedback-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.feedback-form {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.feedback-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feedback-form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.feedback-form-group .required {
    color: #ef4444;
}

.feedback-form-group input,
.feedback-form-group textarea {
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.feedback-form-group input:focus,
.feedback-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.feedback-form-group input::placeholder,
.feedback-form-group textarea::placeholder {
    color: var(--text-muted);
}

.feedback-char-count {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
    font-weight: 500;
}

.feedback-attachment-upload {
    margin-top: 8px;
}

.feedback-upload-btn {
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.feedback-upload-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.feedback-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.feedback-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 10px;
}

.feedback-cancel-btn,
.feedback-submit-btn {
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.feedback-cancel-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.feedback-cancel-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.feedback-submit-btn {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
}

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

.feedback-submit-btn:active {
    transform: translateY(0);
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 200;
        transition: left var(--transition-normal);
    }

    .sidebar.open {
        left: 0;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }

    .welcome-screen h1 {
        font-size: 36px;
    }

    .welcome-screen p {
        font-size: 16px;
    }

    .input-wrapper {
        padding: 14px 16px;
        border-radius: var(--radius-xl);
    }

    .feedback-modal-content {
        width: 95%;
        max-height: 85vh;
        border-radius: var(--radius-lg);
    }

    .auth-buttons {
        flex-direction: column;
    }

    .message {
        gap: 12px;
    }

    .message-avatar {
        width: 36px;
        height: 36px;
    }

    .message-text {
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .welcome-screen h1 {
        font-size: 28px;
    }

    .welcome-screen .logo svg {
        width: 64px;
        height: 64px;
    }

    .suggestion-btn {
        padding: 16px 18px;
        font-size: 13px;
    }

    .input-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* ========================================
   加载动画
   ======================================== */

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 0;
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background: var(--primary-gradient);
    border-radius: 50%;
    animation: typingBounce 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 typingBounce {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-12px) scale(1.1);
        opacity: 1;
    }
}

/* ========================================
   Spinner 加载动画
   ======================================== */

.spinner {
    animation: rotate 1.2s linear infinite;
}

.spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ========================================
   Toast 通知
   ======================================== */

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 22px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 14px;
    animation: toastSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 420px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toast-close {
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: var(--radius-xs);
}

.toast-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ========================================
   滚动条美化
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    border: 1px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-tertiary);
}

/* 子页面（图文生图、图生视频）body 滚动条更明显 */
body:not(.page-chat)::-webkit-scrollbar {
    width: 10px;
}

body:not(.page-chat)::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

body:not(.page-chat)::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

body:not(.page-chat)::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   选择文本样式
   ======================================== */

::selection {
    background: rgba(102, 126, 234, 0.25);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.25);
    color: var(--text-primary);
}

/* ========================================
   焦点状态优化
   ======================================== */

:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ========================================
   图片灯箱
   ======================================== */

.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.image-lightbox.show {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    box-sizing: border-box;
}

.lightbox-content img {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: lightboxZoomIn 0.3s ease-out;
}

@keyframes lightboxZoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
}

.lightbox-prev,
.lightbox-next {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-counter {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

@media (max-width: 768px) {
    .lightbox-content img {
        max-width: 95%;
        max-height: 80vh;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .lightbox-nav {
        bottom: 10px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* ============================================
   客服悬浮按钮 & 二维码弹窗
   ============================================ */
.cs-float-btn {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    z-index: 900;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.cs-float-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.55);
}
.cs-float-btn svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}

/* 弹窗遮罩 */
.cs-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}
.cs-modal.active {
    display: flex;
}

/* 弹窗内容 */
.cs-modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl, 20px);
    padding: 32px 28px 24px;
    width: 320px;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: csModalIn 0.3s ease;
}
@keyframes csModalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* 关闭按钮 */
.cs-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bg-tertiary, #f1f5f9);
    border-radius: 50%;
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.cs-modal-close:hover {
    background: var(--border-color, #e2e8f0);
    color: var(--text-primary);
}

/* 二维码图片 */
.cs-modal-qr {
    width: 220px;
    height: 220px;
    object-fit: contain;
    border-radius: var(--radius-md, 12px);
    margin: 8px auto 16px;
    display: block;
}

/* 提示文字 */
.cs-modal-tip {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.cs-modal-tip strong {
    color: var(--text-primary);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .cs-float-btn {
        right: 16px;
        bottom: 16px;
        width: 46px;
        height: 46px;
    }
    .cs-float-btn svg {
        width: 22px;
        height: 22px;
    }
    .cs-modal-content {
        width: 280px;
        padding: 28px 20px 20px;
    }
    .cs-modal-qr {
        width: 180px;
        height: 180px;
    }
}

/* ============================================
   用户信息 & 修改密码弹窗
   ============================================ */
.profile-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.profile-modal-overlay.active {
    display: flex;
}

.profile-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 440px;
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: profileModalIn 0.3s ease;
}

@keyframes profileModalIn {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px;
    border-bottom: 1px solid var(--border-color);
}

.profile-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.profile-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    line-height: 1;
}

.profile-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.profile-modal-body {
    padding: 24px 26px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.profile-bonus-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.1), rgba(255, 215, 0, 0.1));
    border: 1px solid rgba(255, 165, 0, 0.25);
    color: #b8860b;
    font-size: 13px;
    line-height: 1.5;
}

.profile-bonus-banner svg {
    flex-shrink: 0;
    color: #e8a000;
}

.profile-bonus-banner strong {
    color: #d4880f;
    font-weight: 700;
}

[data-theme="dark"] .profile-bonus-banner {
    color: #f0c040;
    border-color: rgba(255, 184, 0, 0.3);
}

[data-theme="dark"] .profile-bonus-banner strong {
    color: #ffd700;
}

.profile-bonus-banner.claimed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(52, 211, 153, 0.08));
    border-color: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.profile-bonus-banner.claimed svg {
    color: #10b981;
}

[data-theme="dark"] .profile-bonus-banner.claimed {
    color: #34d399;
}

.profile-required {
    color: #ef4444;
    font-weight: 400;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.profile-field input {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
}

.profile-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: var(--input-bg);
}

.profile-field input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

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

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrap input {
    padding-right: 44px;
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.password-toggle-btn:hover {
    color: var(--text-primary);
}

.password-hint {
    font-size: 13px;
    color: var(--primary-color);
    margin: 0;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: var(--radius-xs);
    line-height: 1.5;
}

.profile-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 8px;
}

.profile-btn-cancel,
.profile-btn-save {
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.profile-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.profile-btn-cancel:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.profile-btn-save {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
}

.profile-btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.profile-btn-save:active {
    transform: translateY(0);
}

.profile-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 480px) {
    .profile-modal {
        width: 95vw;
    }
    .profile-modal-body {
        padding: 20px 18px;
    }
    .profile-modal-header {
        padding: 18px;
    }
}

/* ============================================
   底部功能提示
   ============================================ */
.page-footer-tip {
    text-align: center;
    padding: 32px 24px;
    margin-top: auto;
}

.footer-tip-content {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 50px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.footer-tip-content:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(139, 92, 246, 0.12) 100%);
    border-color: rgba(102, 126, 234, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.footer-tip-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border-radius: 50%;
    color: white;
    font-size: 12px;
}

.footer-tip-text {
    font-weight: 500;
}

.footer-tip-text span {
    color: var(--primary-color);
    font-weight: 600;
}

@media (max-width: 768px) {
    .page-footer-tip {
        padding: 24px 16px;
    }

    .footer-tip-content {
        padding: 12px 18px;
        font-size: 13px;
    }
}
