/**
 * 主样式文件 - CSS 变量和全局样式
 */

/* ========== CSS 变量 ========== */
:root {
    /* 颜色 - 深色主题 */
    --bg-primary: #1a1a1a;
    --bg-secondary: #141414;
    --bg-tertiary: #242424;
    --bg-hover: #2a2a2a;
    --bg-active: #333333;

    /* 文本颜色 */
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    /* 强调色 */
    --accent-color: #6366f1;
    --accent-hover: #818cf8;
    --accent-light: rgba(99, 102, 241, 0.1);

    /* 状态颜色 */
    --success-color: #22c55e;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    /* 边框 */
    --border-color: #2a2a2a;
    --border-light: #333333;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* 布局 */
    --sidebar-width: 280px;
    --header-height: 56px;
    --input-height: 56px;
}

/* ========== 全局重置 ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-full);
}

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

/* ========== 应用容器 ========== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========== 通用按钮样式 ========== */
button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    outline: none;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* 主要按钮 */
.btn-primary {
    background: var(--accent-color);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: background var(--transition-fast);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

/* 次要按钮 */
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

/* 图标按钮 */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ========== 输入框样式 ========== */
input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-color);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    opacity: 0;
    transition: all var(--transition-normal);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    background: var(--success-color);
    color: white;
}

.toast-error {
    background: var(--error-color);
    color: white;
}

.toast-info {
    background: var(--info-color);
    color: white;
}

/* ========== 响应式断点 ========== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }
}
