/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root { 
    --bg: #f8fafc; 
    --chat-bg: #ffffff; 
    --primary: #4f46e5; 
    --primary-hover: #4338ca;
    --text: #0f172a; 
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #ffffff;
    --sidebar-text: #0f172a;
    --danger: #ef4444;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body { margin: 0; font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: var(--primary); transition: 0.2s; }
a:hover { color: var(--primary-hover); }

/* --- 移动端响应式核心布局 --- */
.layout-chat, .layout-admin { display: flex; height: 100vh; overflow: hidden; position: relative; width: 100%; }

.sidebar { 
    width: 280px; 
    background: var(--sidebar-bg); 
    color: var(--sidebar-text); 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0; 
    border-right: 1px solid var(--border);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
}

.main { flex: 1; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; min-width: 0; }

/* 移动端菜单开关 */
.mobile-toggle { display: none; background: transparent; border: none; font-size: 24px; color: var(--text); cursor: pointer; padding: 10px; }
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 30; opacity: 0; transition: opacity 0.3s; }

@media (max-width: 768px) {
    .sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .mobile-toggle { display: block; }
    .mobile-overlay.open { display: block; opacity: 1; }
    /* 聊天框在手机上不要左右留太多白 */
    .layout-chat .message { max-width: 100%; padding: 0 15px; }
}

/* --- 精美 UI 组件 --- */
.top-nav { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.8); backdrop-filter: blur(12px); z-index: 10; }

.chat-container { flex: 1; padding: 20px 0; overflow-y: auto; scroll-behavior: smooth; }
.message { margin-bottom: 30px; display: flex; gap: 15px; max-width: 800px; margin-left: auto; margin-right: auto; width: 100%; box-sizing: border-box; }
.message.ai { background: transparent; }
.message.ai .content { background: var(--bg); padding: 20px; border-radius: 16px; border-top-left-radius: 4px; box-shadow: var(--shadow-sm); }
.message.user { flex-direction: row-reverse; }
.message.user .content { background: var(--primary); color: white; padding: 15px 20px; border-radius: 16px; border-top-right-radius: 4px; box-shadow: var(--shadow-sm); }
.avatar { font-size: 28px; display: flex; align-items: flex-start; }

/* 侧边栏按钮和列表 */
.sidebar { padding: 20px; }
.new-chat-btn { background: var(--primary); color: white; border: none; padding: 12px; border-radius: 12px; cursor: pointer; font-weight: 500; font-size: 15px; box-shadow: var(--shadow-md); transition: 0.2s; margin-bottom: 25px; }
.new-chat-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.history-list { list-style: none; padding: 0; margin: 0; flex: 1; overflow-y: auto; }
.history-list li a { color: var(--text-muted); padding: 12px 15px; display: block; border-radius: 8px; margin-bottom: 5px; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: 0.2s; }
.history-list li a:hover { background: var(--bg); color: var(--primary); }

/* 输入区域 */
.input-wrapper { background: var(--chat-bg); padding: 20px; position: sticky; bottom: 0; }
.input-area { display: flex; gap: 15px; align-items: flex-end; max-width: 800px; margin: 0 auto; background: white; padding: 10px 15px; border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
textarea { flex: 1; padding: 12px 0; border: none; resize: none; outline: none; font-family: inherit; font-size: 15px; max-height: 150px; background: transparent; }
.send-btn { background: var(--primary); color: white; border: none; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.send-btn:hover { background: var(--primary-hover); transform: scale(1.05); }
#file-upload-label { cursor: pointer; padding: 12px; color: var(--text-muted); transition: 0.2s; display: flex; align-items: center; justify-content: center; }
#file-upload-label:hover { color: var(--primary); }

/* 后台与表单覆盖 */
.admin-card { background: white; padding: 25px; border-radius: 16px; box-shadow: var(--shadow-md); border: 1px solid var(--border); margin-bottom: 25px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: var(--bg); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em; color: var(--text-muted); padding: 15px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 15px; border-bottom: 1px solid var(--border); font-size: 14px; }
.form-group input, .form-group select { padding: 12px 15px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; }
