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

:root {
    /* 主色调 - 精致黑 */
    --primary-color: #0a0a0a;
    --primary-hover: #1a1a1a;
    --primary-light: #2a2a2a;

    /* 辅助色 */
    --secondary-color: #4a4a4a;
    --secondary-hover: #5a5a5a;

    /* 背景色系统 */
    --background: #ffffff;
    --surface: #f8f9fa;
    --surface-elevated: #ffffff;

    /* 边框色系统 */
    --border: #e8e8e8;
    --border-light: #f0f0f0;
    --border-dark: #d8d8d8;
    --border-focus: #c0c0c0;

    /* 文字色系统 */
    --text: #0a0a0a;
    --text-secondary: #5a5a5a;
    --text-tertiary: #8a8a8a;
    --text-placeholder: #ababab;

    /* 输入框 */
    --input-bg: #fafafa;
    --input-bg-hover: #f5f5f5;
    --input-bg-focus: #ffffff;

    /* 状态色 */
    --error: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --info: #2563eb;

    /* 阴影系统 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.16);

    /* ========== 设计系统 ========== */

    /* 间距系统 - 4px 基础单位 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --space-3xl: 48px;

    /* 按钮高度系统 */
    --btn-height-sm: 32px;
    --btn-height-md: 40px;
    --btn-height-lg: 48px;

    /* 圆角系统 */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* 过渡时长 */
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
}

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

/* ========================================
   HOMEPAGE STYLES (index.html)
   ======================================== */

/* Landing Header */
.landing-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.header-logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-actions-unauth,
.header-actions-auth {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-actions-auth span {
    margin-right: 8px;
    font-weight: 500;
}

/* Landing Sidebar */
.landing-sidebar {
    position: fixed;
    left: 0;
    top: 61px; /* header height */
    height: calc(100vh - 61px);
    width: 280px;
    max-width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow: hidden;
    transition: max-width 0.3s ease;
    z-index: 99;
    display: flex;
    flex-direction: column;
}

.landing-sidebar.hidden {
    display: none;
}

.landing-sidebar.open {
    max-width: 280px;
}

.landing-sidebar:not(.open) {
    max-width: 60px; /* 收起时只显示按钮 */
}

.landing-sidebar:not(.open) .sidebar-header h2,
.landing-sidebar:not(.open) .sidebar-header .btn-icon:not(.sidebar-toggle-btn),
.landing-sidebar:not(.open) .sessions-list {
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    gap: var(--space-sm);
    width: 100%;
    box-sizing: border-box;
}

.sidebar-header h2 {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-header .btn-icon {
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.sidebar-toggle-btn {
    flex-shrink: 0;
}

/* btn-icon styles moved to BUTTONS section */

/* Sessions List */
.sessions-list {
    flex: 1;
    overflow-y: auto;
}

.session-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.session-item:hover {
    background: var(--surface);
}

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

.session-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.session-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.empty-message {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
}

/* Utility */
.hidden {
    display: none !important;
}

.homepage-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-top: 81px; /* Account for fixed header */
}

.hero-container {
    max-width: 900px;
    width: 100%;
    text-align: center;
}

.hero-container h1 {
    font-size: 64px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -2px;
    color: var(--text);
}

.subtitle {
    font-size: 24px;
    margin-bottom: 60px;
    color: var(--secondary-color);
    font-weight: 300;
    letter-spacing: -0.5px;
}

.input-container {
    position: relative;
    margin-bottom: 40px;
}

.main-input {
    width: 100%;
    padding: 28px 32px;
    font-size: 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    transition: all 0.3s;
    cursor: pointer;
    font-weight: 300;
}

.main-input:hover {
    border-color: var(--text-tertiary);
    background: var(--input-bg-focus);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.main-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--input-bg-focus);
}

.placeholder-text {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 20px;
    pointer-events: none;
    transition: all 0.3s;
    font-weight: 300;
}

.main-input:focus + .placeholder-text,
.main-input:not(:placeholder-shown) + .placeholder-text {
    opacity: 0;
}

.examples {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 60px;
}

.example-tag {
    background: var(--surface);
    border: 1.5px solid var(--border);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    font-weight: 500;
}

.example-tag:hover {
    border-color: var(--border-dark);
    background: var(--input-bg-hover);
    transform: translateY(-2px);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.example-tag:active {
    transform: translateY(0);
    box-shadow: none;
}

.features {
    display: flex;
    gap: 48px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 80px;
}

.feature {
    max-width: 240px;
    text-align: center;
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 16px;
    filter: grayscale(100%);
    opacity: 0.5;
}

.feature-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 18px;
    color: var(--text);
}

.feature-desc {
    font-size: 15px;
    color: var(--secondary-color);
    line-height: 1.6;
    font-weight: 300;
}

/* ========================================
   AUTH PAGES (login.html, register.html)
   ======================================== */

.auth-body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: var(--space-3xl);
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 12px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--text);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 36px;
    color: var(--secondary-color);
    font-weight: 400;
    font-size: 16px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333333;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px var(--space-lg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 15px;
    background: var(--input-bg);
    color: var(--text);
    transition: all var(--duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:hover {
    border-color: var(--border-dark);
    background: var(--input-bg-hover);
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.05);
}

.error {
    color: var(--error);
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
    min-height: 20px;
}

.auth-link {
    text-align: center;
    margin-top: 24px;
    color: var(--secondary-color);
    font-size: 14px;
}

.auth-link a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* ========================================
   BUTTONS
   ======================================== */

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 14px var(--space-xl);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all var(--duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}

/* Primary Button */
.btn-primary {
    background: var(--primary-color);
    color: var(--background);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    background: var(--primary-light);
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    background: var(--border);
    color: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Secondary Button */
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--input-bg-hover);
    border-color: var(--border-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary:active {
    background: var(--input-bg);
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Text Button (Link-style) */
.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-lg);
    box-shadow: none;
}

.btn-text:hover {
    color: var(--text);
    background: var(--surface);
}

/* Icon Button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

.btn-icon:hover {
    background: var(--surface);
    color: var(--text);
}

.btn-icon:active {
    background: var(--input-bg);
    transform: scale(0.95);
}

/* Primary Icon Button (with solid background) */
.btn-icon-primary {
    background: var(--primary-color);
    color: var(--background);
}

.btn-icon-primary:hover {
    background: var(--primary-hover);
    color: var(--background);
}

/* Button Sizes */
.btn-small {
    padding: 6px var(--space-lg);
    font-size: 13px;
    border-radius: var(--radius-md);
}

.btn-large {
    padding: 14px var(--space-2xl);
    font-size: 16px;
    border-radius: var(--radius-xl);
}

/* Button Groups */
.btn-group {
    display: inline-flex;
    gap: var(--space-sm);
    align-items: center;
}

/* ========================================
   MAIN APP (app.html)
   ======================================== */

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    text-decoration: none;
    color: inherit;
}

.header-logo h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0;
}

.header-logo:hover h1 {
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#userInfo {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Session Sidebar */
.session-sidebar {
    width: 0;
    min-width: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 10;
    position: relative;
    height: 100%;
    overflow: hidden;
}

.session-sidebar.hidden {
    display: none;
}

.session-sidebar.open {
    width: 280px;
}

.session-sidebar-header {
    display: none; /* /chat 页面不需要 header */
}

.session-sidebar-header h2 {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.session-sidebar-header .btn-icon {
    flex-shrink: 0;
}

/* 首页的 sidebar-header 保持原样 */
.landing-sidebar .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    gap: var(--space-sm);
    width: 100%;
    box-sizing: border-box;
}

/* Chat Area */
.chat-area {
    width: 25%;
    display: flex;
    flex-direction: column;
    background: var(--background);
    min-width: 0;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    background: var(--surface);
}

.current-session-title {
    font-weight: 500;
    color: var(--text);
    font-size: 15px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Icon Buttons */
/* btn-icon styles moved to BUTTONS section */

/* Sessions List */
.sessions-list {
    flex: 1;
    overflow-y: auto;
}

.session-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.session-item:hover {
    background: var(--surface);
}

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

.session-item.active {
    background: var(--primary-color);
    color: white;
}

.session-item-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
}

.session-item-time {
    font-size: 12px;
    opacity: 0.7;
}

/* Messages Section */
.messages-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 50px;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.message-user {
    flex-direction: row-reverse;
}

.message-user .message-bubble {
    background: var(--primary-color);
    color: white;
}

.message-assistant .message-bubble {
    background: var(--background);
    color: var(--text);
    border: 1px solid var(--border);
}

.message-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-avatar svg {
    width: 100%;
    height: 100%;
}

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

.message-content .message-bubble,
.message-content .message-time {
    width: 100%;
}

/* System messages don't have avatar */
.message-system {
    justify-content: center;
}

.message-system .message-bubble {
    background: #fef3c7;
    color: #92400e;
    font-size: 13px;
}

.message-bubble {
    display: inline-block;
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.message-form {
    padding: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-shrink: 0;
}

.textarea-container {
    flex: 1;
    position: relative;
}

.message-form textarea {
    width: 100%;
    padding: var(--space-lg);
    padding-right: 56px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    font-family: inherit;
    min-height: 80px;
    background: var(--input-bg);
    color: var(--text);
    transition: all var(--duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
}

.message-form textarea:hover {
    border-color: var(--border-dark);
    background: var(--input-bg-hover);
}

.message-form textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.05);
}

.send-icon-btn {
    position: absolute;
    right: var(--space-md);
    bottom: var(--space-md);
    background: var(--primary-color);
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--background);
    transition: all var(--duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.send-icon-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.send-icon-btn:active:not(:disabled) {
    transform: scale(1);
    box-shadow: var(--shadow-sm);
}

.send-icon-btn:disabled {
    background: var(--border);
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
    transform: none;
}

/* Preview Area (75%) */
.preview-area {
    width: 75%;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
}

.preview-header {
    padding: 12px 20px;
    background: #1e1e1e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.preview-header h2 {
    font-size: 14px;
    color: #e5e5e5;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.preview-container {
    flex: 1;
    position: relative;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    /* Hide sidebar by default on mobile */
    .session-sidebar {
        position: absolute;
        height: 100%;
        z-index: 20;
    }

    .session-sidebar.hidden {
        transform: translateX(-100%);
    }

    /* Homepage */
    .hero-container h1 {
        font-size: 42px;
    }
    .subtitle {
        font-size: 18px;
    }
    .main-input {
        font-size: 16px;
        padding: 20px 24px;
    }
    .placeholder-text {
        font-size: 16px;
        left: 24px;
    }

    /* Auth Pages */
    .auth-card {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 32px 24px;
    }
}

/* ========================================
   SCROLLBAR STYLES
   ======================================== */

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

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

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

/* ========================================
   MODAL STYLES
   ======================================== */

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: var(--space-3xl);
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--duration-normal);
}

.modal-close:hover {
    color: var(--text);
    background: var(--surface);
}

.modal-close svg {
    width: 24px;
    height: 24px;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-2xl);
    padding: var(--space-xs);
    background: var(--surface);
    border-radius: var(--radius-xl);
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: var(--space-md) var(--space-lg);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all var(--duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-md);
}

.auth-tab:hover {
    color: var(--text);
    background: var(--input-bg-hover);
}

.auth-tab.active {
    color: var(--background);
    background: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.auth-tab.active::after {
    display: none;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content .form-group {
    margin-bottom: 20px;
}

/* Landing Form */
.main-form {
    margin-bottom: 40px;
}

.main-input {
    width: 100%;
    padding: 32px 160px 32px 32px;
    font-size: 20px;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: text;
    font-weight: 400;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    display: block;
}

.main-input:hover {
    border-color: var(--border-dark);
    background: var(--input-bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.main-input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--input-bg-focus);
    transform: translateY(-2px);
    box-shadow: 0 0 0 4px rgba(10, 10, 10, 0.05), var(--shadow-lg);
}

.submit-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    bottom: 10px;
    background: var(--primary-color);
    color: var(--background);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-md) 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-sm);
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.submit-btn:active:not(:disabled) {
    background: var(--primary-light);
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.submit-btn:disabled {
    background: var(--border);
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
    transform: none;
}

.submit-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.submit-btn svg {
    flex-shrink: 0;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ========================================
   AI MESSAGE ENHANCEMENTS
   ======================================== */

/* 思考内容样式 */
.message-reasoning {
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
}

.message-reasoning summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
    user-select: none;
}

.message-reasoning summary:hover {
    color: var(--text);
}

.message-reasoning pre {
    margin: 8px 0 0 0;
    padding: 10px;
    background: var(--input-bg-hover);
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 工具调用样式 */
.message-tools {
    margin-bottom: 10px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
}

.message-tools summary {
    cursor: pointer;
    color: #92400e;
    font-weight: 600;
    user-select: none;
}

.message-tools summary:hover {
    color: #78350f;
}

.message-tools ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    list-style: disc;
}

.message-tools li {
    margin-bottom: 8px;
}

.message-tools li strong {
    color: #92400e;
}

.message-tools pre {
    margin: 4px 0 0 0;
    padding: 10px;
    background: #fef9c3;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 11px;
}

/* 消息气泡中的代码样式 */
.message-bubble pre {
    background: #1a1a1a;
    color: #e5e5e5;
    padding: 14px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    margin: 10px 0;
    border: 1px solid #333;
}

.message-bubble code {
    background: var(--surface);
    color: var(--text);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid var(--border);
}

.message-bubble pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
}

/* AI 状态指示器 */
.ai-status {
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.ai-status.hidden {
    display: none;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--info);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.status-dot.thinking {
    background: #8b5cf6; /* 紫色：思考中 */
}

.status-dot.tool-calling {
    background: #f59e0b; /* 橙色：工具调用中 */
}

.status-dot.error {
    background: var(--error); /* 红色：错误 */
}

/* ========================================
   PROGRESS TRACKING STYLES
   ======================================== */

/* Progress Container */
.progress-container {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar-bg {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--info);
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.progress-bar-fill.thinking {
    background: #8b5cf6; /* 紫色：思考中 */
}

.progress-bar-fill.tool-executing {
    background: #f59e0b; /* 橙色：工具执行中 */
}

.progress-bar-fill.completed {
    background: #059669; /* 绿色：完成 */
}

.progress-bar-fill.failed {
    background: var(--error); /* 红色：失败 */
}

.progress-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

/* Toggle Steps Button */
.toggle-steps-btn {
    margin-top: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.toggle-steps-btn:hover {
    background: var(--input-bg-hover);
    border-color: var(--border-dark);
    color: var(--text);
}

.toggle-steps-btn .arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

/* Execution Steps Container */
.execution-steps {
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px;
}

.execution-steps.hidden {
    display: none;
}

/* Individual Execution Step */
.execution-step {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.execution-step:last-child {
    margin-bottom: 0;
}

.execution-step.active {
    border-color: var(--info);
    box-shadow: 0 0 0 1px var(--info);
}

/* Step Header */
.step-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.step-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-title-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.step-title {
    font-weight: 500;
    color: var(--text);
}

.step-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    font-weight: 400;
}

.step-time {
    font-size: 11px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    margin-top: 2px;
}

/* 思考内容（完整显示，不折叠） */
.step-thinking-content {
    margin-top: 8px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.step-thinking-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
    font-family: inherit;
    line-height: 1.5;
}

/* Step Details (collapsible) */
.step-details {
    margin-top: 8px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.step-details summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    user-select: none;
    margin-bottom: 8px;
}

.step-details summary:hover {
    color: var(--text);
}

.step-details pre {
    margin: 0;
    padding: 8px;
    background: var(--input-bg-hover);
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 11px;
    color: var(--text);
}

/* Step Error */
.step-error {
    margin-top: 8px;
    padding: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: #991b1b;
    font-size: 12px;
}

.step-error strong {
    font-weight: 600;
}

/* ========================================
   STREAMING OUTPUT STYLES
   ======================================== */

/* 流式内容容器 */
.stream-content {
    position: relative;
}

/* 打字机光标动画 */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.typing-cursor {
    display: inline-block;
    color: var(--text);
    font-weight: bold;
    animation: blink 1s infinite;
    margin-left: 2px;
}

/* 流式消息气泡 */
.message-bubble.streaming {
    position: relative;
}

/* 思考过程（流式版本） */
.message-reasoning {
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
}

.message-reasoning summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
    user-select: none;
}

.message-reasoning summary:hover {
    color: var(--text);
}

.message-reasoning pre {
    margin: 8px 0 0 0;
    padding: 10px;
    background: var(--input-bg-hover);
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 工具调用（流式版本） */
.message-tools {
    margin-bottom: 10px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
}

.tool-call {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.tool-call:last-child {
    border-bottom: none;
}

.tool-call.executing {
    animation: pulse 2s infinite;
}

.tool-call.completed {
    animation: none;
}

.tool-status {
    font-size: 14px;
}

.tool-name {
    font-weight: 600;
    color: #92400e;
}

.tool-call pre {
    margin: 4px 0 0 0;
    padding: 8px;
    background: #fef9c3;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 11px;
}
