/* Apple Style CSS for Picasso Agent */
/* 新版三栏布局 */

:root {
    /* Apple 配色 */
    --apple-blue: #007AFF;
    --apple-green: #34C759;
    --apple-red: #FF3B30;
    --apple-orange: #FF9500;
    --apple-purple: #AF52DE;
    --apple-pink: #FF2D55;
    --apple-teal: #5AC8FA;
    
    /* 灰度 */
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F7;
    --gray-200: #E8E8ED;
    --gray-300: #D2D2D7;
    --gray-400: #AEAEB2;
    --gray-500: #8E8E93;
    --gray-600: #636366;
    --gray-700: #48484A;
    --gray-800: #3A3A3C;
    --gray-900: #1D1D1F;
    
    /* 布局 */
    --sidebar-width: 280px;
    --right-panel-width: 380px;
    --header-height: 60px;
    --border-radius: 12px;
    --border-radius-lg: 20px;
    
    /* 动画 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 三栏布局 ========== */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========== 左侧边栏 - 历史对话 ========== */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 26px;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--apple-purple), var(--apple-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--apple-blue);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.new-chat-btn:hover {
    background: #0066CC;
    transform: translateY(-1px);
}

.new-chat-btn span {
    font-size: 18px;
    font-weight: 300;
}

/* 对话列表 */
.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.conversation-item {
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: var(--gray-100);
}

.conversation-item.active {
    background: var(--apple-blue);
    color: white;
}

.conversation-item.active .conversation-time {
    color: rgba(255, 255, 255, 0.7);
}

.conversation-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-time {
    font-size: 12px;
    color: var(--gray-500);
}

.conversation-delete {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conversation-item {
    position: relative;
}

.conversation-item:hover .conversation-delete {
    opacity: 1;
}

.conversation-delete:hover {
    background: var(--apple-red);
    color: white;
}

.empty-conversations {
    text-align: center;
    padding: 32px 16px;
    color: var(--gray-400);
}

.empty-conversations p {
    font-size: 14px;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
}

.status-dot.online {
    background: var(--apple-green);
    box-shadow: 0 0 8px var(--apple-green);
}

.sidebar-nav {
    display: flex;
    gap: 8px;
}

.nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: none;
    background: var(--gray-100);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
    color: var(--gray-600);
}

.nav-item:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.nav-icon {
    font-size: 16px;
}

/* ========== 中间主内容区 ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.view.active {
    display: flex;
}

.view-header {
    padding: 20px 28px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: relative;
}

.view-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.view-header .subtitle {
    color: var(--gray-500);
    font-size: 14px;
}

.back-btn {
    padding: 8px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

/* 单独使用时绝对定位（任务视图） */
.tasks-view .back-btn {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
}

/* 在 view-header-actions 内时使用 flex 布局 */
.view-header-actions .back-btn {
    position: static;
    transform: none;
}

.back-btn:hover {
    background: var(--gray-100);
}

.view-header-actions {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 12px;
    align-items: center;
}

.refresh-button {
    padding: 8px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.refresh-button:hover {
    background: var(--gray-100);
}

/* 队列指示器 */
.queue-indicator {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--apple-orange);
}

.queue-icon {
    font-size: 18px;
    animation: queuePulse 1.5s infinite;
}

@keyframes queuePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== 对话视图 ========== */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    max-width: 550px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 56px;
    margin-bottom: 14px;
}

.welcome-message h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-message p {
    color: var(--gray-500);
    margin-bottom: 20px;
}

.suggestion-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 380px;
    margin: 0 auto;
}

.suggestion-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.suggestion-card:hover {
    border-color: var(--apple-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-icon {
    font-size: 22px;
}

.card-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

/* 消息样式 */
.message {
    max-width: 80%;
    margin-bottom: 14px;
    animation: messageIn 0.3s ease;
}

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

.message.user {
    margin-left: auto;
}

.message.assistant {
    margin-right: auto;
}

.message-content {
    padding: 12px 16px;
    border-radius: var(--border-radius-lg);
    font-size: 14px;
    line-height: 1.6;
}

.message.user .message-content {
    background: var(--apple-blue);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: white;
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 4px;
}

/* 任务卡片 */
.task-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.task-title {
    font-weight: 600;
    font-size: 14px;
}

.task-status {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.task-status.planning {
    background: var(--apple-orange);
    color: white;
}

.task-status.executing {
    background: var(--apple-blue);
    color: white;
}

.task-status.completed {
    background: var(--apple-green);
    color: white;
}

.task-status.error {
    background: var(--apple-red);
    color: white;
}

.task-status.stopped {
    background: var(--apple-orange);
    color: white;
}

.task-status.queued {
    background: var(--gray-500);
    color: white;
}

/* 任务操作按钮 */
.task-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-200);
}

.task-action-btn {
    flex: 1;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.task-action-btn.stop-btn {
    background: rgba(255, 59, 48, 0.1);
    color: var(--apple-red);
}

.task-action-btn.stop-btn:hover {
    background: var(--apple-red);
    color: white;
}

.task-action-btn.continue-btn {
    background: rgba(0, 122, 255, 0.1);
    color: var(--apple-blue);
}

.task-action-btn.continue-btn:hover {
    background: var(--apple-blue);
    color: white;
}

.task-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    background: var(--gray-100);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.task-step .step-text {
    flex: 1;
    padding-top: 2px;
}

.step-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    background: var(--gray-300);
    color: white;
    flex-shrink: 0;
}

.step-icon.pending {
    background: var(--gray-400);
}

.step-icon.running {
    background: var(--apple-blue);
    animation: pulse 1.5s infinite;
}

.step-icon.success {
    background: var(--apple-green);
}

.step-icon.error {
    background: var(--apple-red);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 输入区域 */
.input-area {
    padding: 14px 28px 20px;
    background: white;
    border-top: 1px solid var(--gray-200);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
    padding: 10px 14px;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--apple-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

#message-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    font-family: inherit;
}

#message-input:focus {
    outline: none;
}

#message-input::placeholder {
    color: var(--gray-400);
}

.send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--apple-blue);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.send-button:hover {
    background: #0066CC;
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

.input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 8px;
}

/* ========== 文件上传 ========== */
.upload-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--gray-200);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.upload-button:hover {
    background: var(--gray-300);
    color: var(--gray-800);
}

.uploaded-files {
    background: var(--gray-100);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 10px;
}

.uploaded-files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--gray-600);
}

.clear-uploads-btn {
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: var(--apple-red);
    cursor: pointer;
    font-size: 11px;
    border-radius: 4px;
}

.clear-uploads-btn:hover {
    background: rgba(255, 59, 48, 0.1);
}

.uploaded-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    font-size: 12px;
}

.uploaded-file-item .file-icon {
    font-size: 14px;
}

.uploaded-file-item .file-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uploaded-file-item .file-size {
    color: var(--gray-400);
    font-size: 10px;
}

.remove-file-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: var(--gray-200);
    color: var(--gray-600);
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file-btn:hover {
    background: var(--apple-red);
    color: white;
}

/* ========== 右侧面板 - 浏览器和终端 ========== */
.right-panel {
    width: var(--right-panel-width);
    background: var(--gray-100);
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.browser-panel {
    flex: 1;
    border-bottom: 1px solid var(--gray-200);
}

.terminal-panel {
    flex: 1;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.panel-header.terminal-header-dark {
    background: var(--gray-800);
    border-bottom: 1px solid var(--gray-700);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.terminal-header-dark .panel-title {
    color: var(--apple-green);
}

.panel-icon {
    font-size: 16px;
}

.panel-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-500);
}

.panel-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--apple-red);
}

.panel-status.connected .status-dot {
    background: var(--apple-green);
}

.panel-status.connected .status-label {
    color: var(--apple-green);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ws-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-400);
}

.ws-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--apple-red);
}

.ws-status.connected .status-dot {
    background: var(--apple-green);
}

.ws-status.connected .status-label {
    color: var(--apple-green);
}

.clear-button {
    padding: 6px 10px;
    border: 1px solid var(--gray-600);
    border-radius: 6px;
    background: transparent;
    color: var(--gray-300);
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition-fast);
}

.clear-button:hover {
    background: var(--gray-700);
}

.panel-body {
    flex: 1;
    overflow: hidden;
}

/* 浏览器面板内容 */
.browser-body {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: var(--gray-100);
}

.browser-info {
    background: var(--gray-800);
    padding: 6px 12px;
    border-radius: 6px 6px 0 0;
}

.browser-url {
    color: var(--gray-300);
    font-size: 11px;
    font-family: 'SF Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browser-frame {
    flex: 1;
    background: white;
    border: 1px solid var(--gray-300);
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.browser-placeholder {
    text-align: center;
    padding: 24px;
    color: var(--gray-400);
}

.placeholder-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

.browser-placeholder p {
    font-size: 12px;
}

#browser-screenshot {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

/* 终端面板内容 */
.terminal-body {
    background: var(--gray-900);
}

.terminal-output {
    height: 100%;
    overflow-y: auto;
    padding: 12px 14px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: var(--gray-200);
}

.terminal-welcome {
    color: var(--gray-500);
    text-align: center;
    padding: 20px;
}

.terminal-welcome pre {
    color: var(--apple-green);
    font-size: 10px;
    margin-bottom: 10px;
}

.terminal-welcome p {
    font-size: 11px;
}

/* 日志条目样式 */
.log-entry {
    margin-bottom: 2px;
    animation: logIn 0.2s ease;
}

@keyframes logIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry .timestamp {
    color: var(--gray-500);
    margin-right: 8px;
}

.log-entry.info {
    color: var(--gray-300);
}

.log-entry.step {
    color: var(--apple-blue);
    font-weight: 500;
    margin-top: 6px;
}

.log-entry.tool {
    color: var(--apple-purple);
}

.log-entry.params {
    color: var(--gray-400);
    padding-left: 12px;
    white-space: pre-wrap;
}

.log-entry.success {
    color: var(--apple-green);
}

.log-entry.error {
    color: var(--apple-red);
}

.log-entry.warning {
    color: var(--apple-orange);
}

.log-entry.result {
    color: var(--apple-teal);
    padding-left: 12px;
    word-break: break-all;
}

/* ========== 任务视图 ========== */
.tasks-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.tasks-list {
    max-width: 700px;
}

/* ========== 文件视图 ========== */
.files-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.file-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px;
    border: 1px solid var(--gray-200);
    cursor: default;
    transition: all var(--transition-fast);
    text-align: center;
}

.file-card:hover {
    border-color: var(--apple-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.file-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    word-break: break-all;
}

.file-size {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 4px;
}

.file-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-200);
}

.file-action-btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all var(--transition-fast);
}

.file-action-btn.preview-btn {
    background: var(--apple-blue);
    color: white;
}

.file-action-btn.preview-btn:hover {
    background: #0066d6;
}

.file-action-btn.download-btn {
    background: var(--gray-200);
    color: var(--gray-700);
}

.file-action-btn.download-btn:hover {
    background: var(--gray-300);
}

.file-action-btn.delete-btn {
    background: rgba(255, 59, 48, 0.1);
    color: var(--apple-red);
}

.file-action-btn.delete-btn:hover {
    background: var(--apple-red);
    color: white;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 14px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 4px;
}

.empty-hint {
    font-size: 13px;
    color: var(--gray-400);
}

/* ========== 弹窗 ========== */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active,
.modal.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 550px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-500);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

/* ========== 文件预览弹窗 ========== */
.preview-modal .preview-content {
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    color: var(--gray-500);
    font-size: 14px;
}

.preview-text {
    width: 100%;
    height: 100%;
    padding: 16px;
    margin: 0;
    font-family: 'SF Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    background: var(--gray-100);
}

.preview-image {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
}

.preview-pdf {
    width: 100%;
    height: 65vh;
    border: none;
}

.preview-word {
    width: 100%;
    padding: 32px;
    overflow: auto;
    max-height: 65vh;
    background: white;
}

.word-content {
    max-width: 650px;
    margin: 0 auto;
    font-size: 14px;
    line-height: 1.8;
    color: var(--gray-800);
}

.word-content p {
    margin-bottom: 1em;
}

.preview-excel {
    width: 100%;
    overflow: auto;
    max-height: 65vh;
}

.preview-excel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.preview-excel th,
.preview-excel td {
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    text-align: left;
}

.preview-excel th {
    background: var(--gray-100);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.preview-excel tr:hover {
    background: var(--gray-50);
}

.preview-unsupported {
    text-align: center;
    padding: 40px;
}

.preview-unsupported span {
    font-size: 56px;
    display: block;
    margin-bottom: 14px;
}

.preview-unsupported p {
    color: var(--gray-500);
    margin-bottom: 16px;
}

.download-btn-large {
    padding: 10px 20px;
    background: var(--apple-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.download-btn-large:hover {
    background: #0066d6;
}

.preview-error {
    color: var(--apple-red);
    padding: 16px;
}

/* ========== 加载动画 ========== */
.loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--apple-blue);
    animation: loadingDot 1.4s infinite ease-in-out both;
}

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

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

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

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

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
    .right-panel {
        width: 320px;
    }
}

@media (max-width: 900px) {
    .right-panel {
        display: none;
    }
    
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 700px) {
    .sidebar {
        position: fixed;
        left: -100%;
        z-index: 100;
        height: 100%;
        transition: left var(--transition-normal);
        width: 280px;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .suggestion-cards {
        grid-template-columns: 1fr;
    }
    
    .message {
        max-width: 90%;
    }
}
