/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    overflow: hidden;
}

/* 主容器 */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部导航栏 */
.top-header {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.header-left .logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #6366f1, #a21caf);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 2px 8px rgba(99,102,241,0.12);
    transition: background 0.3s;
}

body.dark-mode .logo-icon {
    background: linear-gradient(135deg, #a21caf, #f472b6);
    color: #fff;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #64748b;
    font-size: 14px;
}

.header-item:hover {
    background-color: #f1f5f9;
    color: #334155;
}

.header-item.profile {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #e2e8f0;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.header-item.profile:hover {
    background-color: #f1f5f9;
    transform: scale(1.05);
}

.header-item i {
    font-size: 16px;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    position: relative;
}

/* 左侧全局导航栏 */
.global-nav {
    width: 80px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 8px;
}

.nav-item {
    width: 56px;
    height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
    gap: 4px;
}

.nav-item.active {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
}

.nav-item:hover:not(.active) {
    background-color: #f1f5f9;
    color: #334155;
}

.nav-item i {
    font-size: 20px;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
}

/* 左侧聊天管理面板 */
.chat-sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: width 0.3s ease;
}

.chat-sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.new-chat-btn {
    flex: 1;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.search-btn {
    width: 44px;
    height: 44px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.search-btn:hover {
    background-color: #f1f5f9;
    color: #334155;
}

.sidebar-tabs {
    padding: 0 20px;
    display: flex;
    border-bottom: 1px solid #f1f5f9;
}

.tab {
    flex: 1;
    padding: 16px 0;
    text-align: center;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab.active {
    color: #1d4ed8;
    border-bottom-color: #3b82f6;
    font-weight: 500;
}

.tab:hover:not(.active) {
    color: #334155;
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.5;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-link {
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #334155;
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    color: #64748b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: #f8fafc;
    color: #334155;
}

.sidebar-toggle-fixed {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    color: #64748b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.sidebar-toggle-fixed:hover {
    background-color: #f8fafc;
    color: #334155;
}

/* 右侧主内容区 */
.main-panel {
    flex: 1;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.empty-chat-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.empty-icon {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.empty-icon i {
    font-size: 48px;
    color: #3b82f6;
}

.empty-chat-state h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.empty-chat-state p {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 32px;
    line-height: 1.5;
}

.start-chat-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.start-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

/* 聊天界面样式 */

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
}

.welcome-message h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.welcome-message p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

.chat-input-area {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 12px;
    transition: all 0.2s;
}

.input-container:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.attach-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s;
}

.attach-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #1e293b;
    background: transparent;
    padding: 8px 0;
}

.chat-input::placeholder {
    color: #94a3b8;
}

.send-btn {
    width: 32px;
    height: 32px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    margin-top: 8px;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    font-size: 12px;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #d1d5db;
}

.clear-btn i {
    font-size: 10px;
}

.input-hint {
    font-size: 12px;
    color: #94a3b8;
}

/* 深色模式下的聊天界面 */

.dark-mode .chat-messages {
    background: #0f172a;
}

.dark-mode .welcome-message h3 {
    color: #f1f5f9;
}

.dark-mode .welcome-message p {
    color: #94a3b8;
}

.dark-mode .chat-input-area {
    background: #1e293b;
    border-top-color: #334155;
}

.dark-mode .input-container {
    background: #374151;
    border-color: #4b5563;
}

.dark-mode .input-container:focus-within {
    border-color: #3b82f6;
}

.dark-mode .attach-btn {
    color: #94a3b8;
}

.dark-mode .attach-btn:hover {
    background: #4b5563;
    color: #f1f5f9;
}

.dark-mode .chat-input {
    color: #f9fafb;
}

.dark-mode .chat-input::placeholder {
    color: #6b7280;
}

.dark-mode .input-hint {
    color: #6b7280;
}

.dark-mode .clear-btn {
    background: #374151;
    border-color: #4b5563;
    color: #94a3b8;
}

.dark-mode .clear-btn:hover {
    background: #4b5563;
    color: #f1f5f9;
    border-color: #6b7280;
}


/* 右侧浮动图标 */
.floating-icons {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.floating-icon {
    width: 48px;
    height: 48px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.floating-icon:hover {
    background-color: #f8fafc;
    color: #334155;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.floating-icon i {
    font-size: 18px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 240px;
    }
    
    .global-nav {
        width: 60px;
    }
    
    .nav-item span {
        display: none;
    }
    
    .floating-icons {
        right: 10px;
    }
    
    .floating-icon {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .header-right .header-item span {
        display: none;
    }
    
    .chat-sidebar {
        position: absolute;
        left: -280px;
        z-index: 999;
        transition: left 0.3s;
    }
    
    .chat-sidebar.open {
        left: 0;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.empty-chat-state {
    animation: fadeIn 0.6s ease-out;
}

/* 深色模式支持 */
body.dark-mode {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
}

.dark-mode .top-header,
.dark-mode .global-nav,
.dark-mode .chat-sidebar {
    background: #1e293b !important;
    border-color: #334155 !important;
}

.dark-mode .main-panel {
    background: #0f172a !important;
}

.dark-mode .header-item,
.dark-mode .nav-item,
.dark-mode .tab {
    color: #94a3b8 !important;
}

.dark-mode .header-item:hover,
.dark-mode .nav-item:hover,
.dark-mode .tab:hover {
    color: #f1f5f9 !important;
    background-color: #334155 !important;
}

.dark-mode .empty-state,
.dark-mode .footer-link {
    color: #64748b !important;
}

.dark-mode .empty-state i {
    color: #64748b !important;
}

.dark-mode .logo-text {
    color: #f1f5f9 !important;
}

.dark-mode .new-chat-btn {
    background: linear-gradient(135deg, #1e40af, #1e3a8a) !important;
}

.dark-mode .start-chat-btn {
    background: linear-gradient(135deg, #1e40af, #1e3a8a) !important;
}

.dark-mode .floating-icon {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

.dark-mode .floating-icon:hover {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

.dark-mode .sidebar-toggle,
.dark-mode .sidebar-toggle-fixed {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

.dark-mode .sidebar-toggle:hover,
.dark-mode .sidebar-toggle-fixed:hover {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

.dark-mode .welcome-message {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
}

.dark-mode .welcome-message h3 {
    color: #f1f5f9 !important;
}

.dark-mode .welcome-message p {
    color: #94a3b8 !important;
}

.dark-mode .input-container {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
}

.dark-mode .chat-input {
    color: #f1f5f9 !important;
    background: transparent !important;
}

.dark-mode .chat-input::placeholder {
    color: #64748b !important;
}

.dark-mode .send-btn {
    background: #1e40af !important;
}

.dark-mode .send-btn:hover {
    background: #1e3a8a !important;
}

.dark-mode .history-item {
    color: #f1f5f9 !important;
    border-bottom-color: #334155 !important;
}

.dark-mode .history-item:hover {
    background-color: #334155 !important;
}

.dark-mode .history-title {
    color: #f1f5f9 !important;
}

.dark-mode .history-time {
    color: #94a3b8 !important;
}

.dark-mode .assistant-item {
    color: #f1f5f9 !important;
    border-bottom-color: #334155 !important;
}

.dark-mode .assistant-item:hover {
    background-color: #334155 !important;
}

.dark-mode .assistant-name {
    color: #f1f5f9 !important;
}

.dark-mode .assistant-desc {
    color: #94a3b8 !important;
}

.dark-mode .empty-chat-state h2 {
    color: #f1f5f9 !important;
}

.dark-mode .empty-chat-state p {
    color: #94a3b8 !important;
}

.dark-mode .empty-icon {
    background: linear-gradient(135deg, #1e293b, #334155) !important;
}

.dark-mode .empty-icon i {
    color: #3b82f6 !important;
}

/* 系统偏好深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0f172a;
        color: #f1f5f9;
    }
    
    .top-header,
    .global-nav,
    .chat-sidebar {
        background: #1e293b;
        border-color: #334155;
    }
    
    .main-panel {
        background: #0f172a;
    }
    
    .header-item,
    .nav-item,
    .tab {
        color: #94a3b8;
    }
    
    .header-item:hover,
    .nav-item:hover,
    .tab:hover {
        color: #f1f5f9;
        background-color: #334155;
    }
    
    .empty-state,
    .footer-link {
        color: #64748b;
    }
}
