/* 小凉PRO人工智能聊天 - 主样式表 */
/* 基础重置和变量 */
:root {
    --primary-color: #4c51bf;
    --secondary-color: #7c3aed;
    --accent-color: #10b981;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --gray-light: #e2e8f0;
    --gray-medium: #64748b;
    --gray-dark: #334155;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Noto Sans SC', sans-serif;
    --sidebar-width: 300px;
}

[data-theme="dark"] {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #10b981;
    --light-color: #0f172a;
    --dark-color: #f1f5f9;
    --gray-light: #1e293b;
    --gray-medium: #475569;
    --gray-dark: #cbd5e1;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .model-selector select {
    background: var(--gray-light);
    color: var(--dark-color);
    border: 1px solid var(--gray-medium);
}

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

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
    transition: var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.main-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 0;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    text-align: center;
    margin-bottom: 1rem;
}

.main-header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.main-header h1 i {
    font-size: 2rem;
}

.main-header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    backdrop-filter: blur(10px);
}

.model-selector label {
    font-weight: 500;
    font-size: 0.95rem;
}

.model-selector select {
    background: white;
    color: var(--dark-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 200px;
    transition: var(--transition);
}

.model-selector select:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.theme-toggle .icon-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.theme-toggle .icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(15deg);
}

/* 头部容器和折叠样式 */
.header-container {
    position: relative;
    height: auto;
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.header-container.collapsed {
    height: 20px;
}

.header-collapse-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.header-collapse-bar:hover {
    opacity: 1;
}

.header-collapse-bar::before {
    content: '';
    width: 40px;
    height: 4px;
    background: white;
    border-radius: 2px;
}

.header-container.collapsed .main-header {
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
}

.header-container:not(.collapsed) .main-header {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s, transform 0.3s;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 8fr var(--sidebar-width);
    gap: 2rem;
    margin-bottom: 2rem;
    position: relative;
}

.main-content.sidebar-hidden {
    grid-template-columns: 1fr;
}

.main-content.sidebar-hidden .sidebar {
    display: none;
}

.chat-container {
    display: flex;
    flex-direction: column;
    background: var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    height: calc(100vh - 100px);
    min-height: 600px;
}

.chat-area {
    flex: 1;
    padding: 0.75rem 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--light-color);
}

.chat-area::-webkit-scrollbar {
    width: 8px;
}

.chat-area::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 4px;
}

.chat-area::-webkit-scrollbar-thumb {
    background: var(--gray-medium);
    border-radius: 4px;
}

.chat-area::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 消息样式 */
.msg {
    display: flex;
    gap: 0.8rem;
    max-width: 98%;
    animation: fadeIn 0.3s ease-out;
}

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

.msg.ai {
    align-self: flex-start;
}

.msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.msg.user .msg-avatar {
    background: linear-gradient(135deg, var(--accent-color), var(--success-color));
}

.msg-content {
    padding: 0.8rem 1rem;
    border-radius: var(--border-radius);
    line-height: 1.6;
    font-size: 0.95rem;
    box-shadow: var(--shadow);
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    white-space: pre-wrap;
}

.msg-content code {
    font-family: monospace;
    background-color: rgba(0,0,0,0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

[data-theme="dark"] .msg-content code {
    background-color: rgba(255,255,255,0.1);
}

.msg-content pre {
    font-family: monospace;
    background-color: rgba(0,0,0,0.05);
    padding: 1em;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    white-space: pre;
}

[data-theme="dark"] .msg-content pre {
    background-color: rgba(255,255,255,0.1);
}

.msg.ai .msg-content {
    background: var(--gray-light);
    color: var(--dark-color);
    border-top-left-radius: 4px;
}

.msg.user .msg-content {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-top-right-radius: 4px;
}

.msg-content img {
    max-width: 100%;
    border-radius: var(--border-radius-sm);
    margin: 0.5rem 0;
}

.welcome-message {
    animation: slideIn 0.5s ease-out;
}

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

/* 输入区域 */
.input-area {
    border-top: 1px solid var(--gray-light);
    padding: 1rem;
    background: var(--light-color);
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#msgInput {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    background: var(--light-color);
    color: var(--dark-color);
    font-family: var(--font-family);
    font-size: 0.95rem;
    resize: none;
    transition: var(--transition);
    min-height: 80px;
    max-height: 200px;
}

#msgInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 81, 191, 0.1);
}

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

.action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-btn.secondary {
    background: var(--gray-light);
    color: var(--dark-color);
}

.action-btn.secondary:hover {
    background: var(--gray-medium);
    color: white;
}

.input-hints {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--gray-medium);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-hints kbd {
    background: var(--gray-light);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

/* 侧边栏 */
.sidebar {
    background: var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: calc(2rem + 150px);
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-light);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-item {
    margin-bottom: 1.25rem;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--dark-color);
    font-weight: 500;
}

.setting-item input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--gray-light);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.setting-item input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--secondary-color);
    transform: scale(1.2);
}

.setting-item span {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-medium);
    font-weight: 500;
}

.model-info p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--dark-color);
    background: var(--gray-light);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--accent-color);
}

.session-info p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.session-info span {
    font-weight: 500;
    color: var(--primary-color);
}

/* 页脚 */
.main-footer {
    background: var(--gray-light);
    color: var(--dark-color);
    padding: 2rem 0;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section p, .footer-section li {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--gray-medium);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin: 0.5rem 0;
    padding-left: 1rem;
    position: relative;
}

.footer-section ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    color: var(--gray-medium);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--light-color);
    color: var(--dark-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-light);
}

.modal-header h2 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-modal {
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--gray-medium);
    transition: var(--transition);
    line-height: 1;
}

.close-modal:hover {
    color: var(--danger-color);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--gray-light);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-item label {
    font-weight: 500;
    color: var(--secondary-color);
}

/* 浮动控制按钮 */
.floating-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 100;
}

.floating-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.floating-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 响应式设计 - 媒体查询 */

/* 平板设备 (768px - 1023px) */
@media (max-width: 1023px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .sidebar {
        position: static;
        order: 2;
        max-height: none;
    }
    
    .chat-container {
        height: calc(100vh - 180px);
        order: 1;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .model-selector {
        justify-content: center;
    }
    
    .model-selector select {
        flex: 1;
        min-width: 0;
    }
    
    .main-header h1 {
        font-size: 1.8rem;
    }
}

/* 手机设备 (最大767px) */
@media (max-width: 767px) {
    .container {
        padding: 0 15px;
    }
    
    .main-header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
    
    .main-header h1 {
        font-size: 1.5rem;
    }
    
    .main-header .subtitle {
        font-size: 0.9rem;
    }
    
    .header-controls {
        padding: 0 1rem;
    }
    
    .model-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .model-selector label {
        text-align: center;
    }
    
    .main-content {
        gap: 1rem;
    }
    
    .sidebar {
        display: none;
    }
    
    .chat-container {
        height: calc(100vh - 140px);
        min-height: 500px;
    }
    
    .chat-area {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .msg {
    max-width: 98%;
    }
    
    .msg-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .msg-content {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .input-area {
        padding: 1rem;
    }
    
    #msgInput {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .action-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
    
    .sidebar {
        padding: 1rem;
    }
    
    .sidebar-section h3 {
        font-size: 1rem;
    }
    
    .floating-controls {
        bottom: 1rem;
        right: 1rem;
    }
    
    .floating-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* 超大桌面设备 (最小1400px) */
@media (min-width: 1400px) {
    .container {
        max-width: 1800px;
    }
    
    .main-content {
        grid-template-columns: 8fr 350px;
    }
}

/* 打印样式 */
@media print {
    .floating-controls,
    .sidebar,
    .input-area,
    .footer-bottom {
        display: none !important;
    }
    
    .chat-area {
        overflow: visible !important;
        height: auto !important;
    }
    
    .main-header {
        box-shadow: none !important;
    }
}

/* 模态框样式补充 */
.modal-body {
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: var(--gray-medium);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* 移动设备上的折叠头部调整 */
@media (max-width: 767px) {
    .header-container.collapsed {
        height: 30px;
    }
    .header-collapse-bar {
        height: 30px;
    }
}