/* 根元素设置动态高度 */
html {
    height: -webkit-fill-available;
    height: stretch;
}

body {
    height: -webkit-fill-available;
    height: stretch;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
}

/* 应用容器使用动态高度 */
.app-container {
    height: -webkit-fill-available;
    height: stretch;
    display: flex;
    position: relative;
}
:root {
    --primary-color: #18A058;
    --background-color: #F7F7F7;
    --card-background: #FFFFFF;
    --text-color: #1D1D1F;
    --user-message-bg: #18A058;
    --system-message-bg: #F2F3F5;
    --sidebar-width: 280px;
    --input-height: 35px;
    --input-border-radius: 24px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

/* ========== 布局 ========== */
.app-container {
    display: flex;
    height: 100vh;
    position: relative;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-background);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 16px;
    transform: translateX(-100%);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== 头部 ========== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    height: 64px;
    background-color: var(--card-background);
    border-bottom: 1px solid #edf2f7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    position: relative;
    z-index: 10;
}

.header::before {
    content: "";
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0.2px;
}

.menu-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: var(--primary-color);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-chat-header-btn,
.new-chat-btn {
    position: static;
    transform: none;
    width: auto;
    height: 36px;
    padding: 0 14px;
    border-radius: 20px;
    background: transparent;
    color: #475569;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
    cursor: pointer;
}

.clear-chat-header-btn {
    margin-right: 4px;
}

.clear-chat-header-btn i,
.new-chat-btn i {
    font-size: 15px;
    color: var(--primary-color);
}

.clear-chat-header-btn:hover,
.new-chat-btn:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.new-chat-btn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.new-chat-btn i {
    color: white;
}

.new-chat-btn:hover {
    background-color: #1fb86b;
    border-color: #1fb86b;
    opacity: 0.95;
}

/* ========== 聊天区域 ========== */
.chat-container {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
    background-color: #ffffff;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    transition: padding-bottom 0.2s ease;
    position: relative;
}

.chat-container:focus-within {
    padding-bottom: 80px;
}

/* 消息样式 */
.message {
    margin: 6px 0;
    padding: 12px 18px;
    border-radius: 24px;
    max-width: 700px;
    width: fit-content;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.3s forwards;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    position: relative;
}

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

.user-message {
    margin-left: auto;
    margin-right: 0;
    background: linear-gradient(135deg, #18A058, #1fb86b);
    color: white;
    border-bottom-right-radius: 6px;
    border-bottom-left-radius: 24px;
    padding-right: 14px;
    padding-bottom: 8px;
    position: relative;
    margin-bottom: 24px;
}

.system-message {
    margin-right: auto;
    margin-left: 0;
    background-color: #f1f4f9;
    color: #1e293b;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 24px;
    padding-bottom: 10px;
}

/* 系统消息只有图片时的样式 */
.system-message:has(.message-image-container):not(:has(.message-text)) {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.message-content-wrapper {
    display: inline-block;
    max-width: 100%;
}

.message-text {
    word-break: break-word;
}

/* 消息操作按钮 */
.message-actions {
    position: absolute;
    right: 8px;
    top: calc(100% - -1px);
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 3px 6px;
    backdrop-filter: blur(5px);
    z-index: 1;
}

.message-action {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
}

.message-action:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* ========== 欢迎消息 ========== */
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: auto 0;
    color: #666;
    font-size: 14px;
    text-align: center;
    padding: 40px 20px;
    max-width: 600px;
}

.welcome-message h1 {
    font-size: 28px;
    margin: 0;
    background: linear-gradient(to right, #666, #18A058);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-message p {
    font-size: 14px;
    color: #666;
    margin-top: 8px;
}

.welcome-message i.fa-palette {
    font-size: 36px;
    color: #18A058;
    margin-bottom: 15px;
}

.preset-action-btn,
.login-prompt-btn {
    padding: 10px 16px;
    border-radius: 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.preset-action-btn:hover,
.login-prompt-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.preset-action-btn i,
.login-prompt-btn i {
    font-size: 14px;
}

/* ========== 图片相关样式（基础样式，尺寸由 image_sizes.css 管理） ========== */
/* 注意：.generated-image 和 .dynamic-placeholder 的尺寸定义已移至 image_sizes.css */
/* 这里只保留非尺寸相关的样式 */

.message-image-container {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.message-image-container .generated-image {
    border-radius: 12px !important;
    display: block;
    transition: transform 0.3s ease;
}

.message-image-container .generated-image:hover {
    transform: scale(1.02);
}

/* 图片占位符基础样式（尺寸在 image_sizes.css 中定义） */
.dynamic-placeholder {
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.dynamic-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.8) 50%, 
        rgba(255, 255, 255, 0) 100%);
    animation: shimmer 2s infinite;
    z-index: 1;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.modern-spinner {
    position: relative;
    width: 50px;
    height: 50px;
    z-index: 2;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top: 3px solid #18A058;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(2) {
    border: 3px solid rgba(24, 160, 88, 0.2);
    animation: spin 1.5s linear infinite reverse;
}

.spinner-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #18A058;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

.loading-text {
    margin-top: 70px;
    text-align: center;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    position: absolute;
    bottom: 20px;
    width: 100%;
    z-index: 2;
}

.loading-dots {
    display: inline-block;
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* 图片操作按钮 */
.image-actions {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    padding: 4px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.image-action {
    background: none;
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.image-action:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* ========== 图片模态框 ========== */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.image-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

/* ========== 输入区域 ========== */
.input-area {
    background: #ffffff;
    border-top: 1px solid #edf2f7;
    padding: 18px 20px 22px;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.input-container {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    position: relative;
}

.input-wrapper {
    flex: 1;
    position: relative;
    min-height: 52px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 32px;
    padding: 10px 120px 10px 22px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(24, 160, 88, 0.15);
}

.input-wrapper.multiline {
    padding: 8px 90px 8px 12px;
}

textarea#prompt {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 15px;
    line-height: 1.5;
    padding: 8px 0;
    margin: 0;
    min-height: calc(var(--input-height) - 16px);
    max-height: 150px;
    overflow-y: auto;
    transition: height 0.2s ease;
    text-align: left;
    box-sizing: border-box;
    color: #1e293b;
}

textarea#prompt::placeholder {
    color: #94a3b8;
    font-size: 15px;
}

.input-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
    background: transparent;
    padding: 4px;
    border-radius: 28px;
    width: auto;
    height: auto;
    z-index: 10;
    pointer-events: auto;
    align-items: center;
    justify-content: center;
}

.input-wrapper.multiline .input-actions,
.input-wrapper:has(textarea[style*="height"]) .input-actions {
    top: 50%;
    transform: translateY(-50%);
}

.action-button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: white;
    color: #475569;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    flex-grow: 0;
    line-height: 1;
    box-sizing: border-box;
}

.action-button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: scale(1.05);
    color: var(--primary-color);
}

.action-button.primary,
.action-button#submitBtn {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.action-button.primary:hover {
    background: #1fb86b;
}

.action-button.active {
    background: #e8f3ed;
    border-color: var(--primary-color);
    color: var(--primary-color);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { outline-color: rgba(24, 160, 88, 0.4); outline-width: 2px; }
    50% { outline-color: rgba(24, 160, 88, 0.1); outline-width: 4px; }
    100% { outline-color: rgba(24, 160, 88, 0.4); outline-width: 2px; }
}

/* 选项菜单 */
.options-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 12px;
    z-index: 100;
    opacity: 0;
    transform: translateY(10px);
    visibility: hidden;
    transition: all 0.2s ease;
    width: 280px;
}

.options-menu.active {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.options-menu h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
}

.preset-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 12px;
}

.preset-btn:hover {
    background: #e0e0e0;
}

.preset-btn i {
    color: var(--primary-color);
}

/* 比例选项 */
.ratio-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.ratio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.ratio-option:hover {
    background: #f5f5f5;
}

.ratio-option.active {
    background: #e6f7ee;
    color: var(--primary-color);
}

.ratio-preview {
    width: 40px;
    height: 40px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.ratio-1-1 {
    aspect-ratio: 1/1;
}

.ratio-3-4 {
    aspect-ratio: 3/4;
}

.ratio-4-3 {
    aspect-ratio: 4/3;
}

.ratio-16-9 {
    aspect-ratio: 16/9;
}

.ratio-9-16 {
    aspect-ratio: 9/16;
}

/* 表单组 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}

.form-group input[type="range"] {
    width: 100%;
    margin-bottom: 4px;
}

.form-group input[type="number"] {
    width: calc(100% - 18px);
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-group small {
    color: #666;
    font-size: 12px;
    display: block;
}

/* ========== 模型选择器 ========== */
.model-selector-wrapper {
    display: inline-block;
    position: relative;
    margin-left: 8px;
    flex: 0 1 auto;
}

.custom-model-selector {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 8px 32px 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    min-width: 180px;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2318A058' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

.custom-model-selector:hover {
    border-color: var(--primary-color);
    background-color: #f1f5f9;
}

.custom-model-selector:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 160, 88, 0.2);
}

/* ========== 历史记录 ========== */
.history-section {
    margin-bottom: 15px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
}

.section-header:hover {
    background: #e8e8e8;
}

.section-header .title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.section-header .count {
    font-size: 12px;
    color: #666;
    background: #ddd;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 5px;
}

.section-header .icon {
    transition: transform 0.3s ease;
    color: #666;
}

.section-header .icon.collapsed {
    transform: rotate(-90deg);
}

.section-items {
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.section-items.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.history-item {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    color: #2c3e50;
    border: none;
}

.history-item:hover {
    background-color: #f5f7fa;
}

.history-item.active {
    background-color: #e8f3ed;
    color: var(--primary-color);
    font-weight: 500;
}

.history-item i {
    font-size: 14px;
    color: #94a3b8;
}

.history-item.active i {
    color: var(--primary-color);
}

.history-item.selectable {
    padding-left: 40px;
    position: relative;
}

.history-item.selectable::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 3px;
    transition: all 0.2s;
}

.history-item.selectable.selected::before {
    background: #18A058;
    border-color: #18A058;
}

.history-item.selectable.selected::after {
    content: '✓';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.history-empty {
    color: #999;
    font-size: 13px;
    text-align: center;
    padding: 12px 0;
}

/* 批量操作 */
.batch-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    display: none;
}

.batch-actions.active {
    display: flex;
    gap: 8px;
}

.batch-actions button {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.batch-actions .select-all {
    background: #f0f9f0;
    color: #18A058;
}

.batch-actions .delete-selected {
    background: #fff2f0;
    color: #ff4d4f;
}

.batch-actions button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.batch-mode {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(24, 160, 88, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    backdrop-filter: blur(10px);
}

.batch-mode span {
    font-size: 14px;
    font-weight: 500;
}

.batch-mode button {
    background: white;
    color: #18A058;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.batch-mode button:hover {
    background: #f0f9f0;
    transform: translateY(-1px);
}

/* ========== 用户信息 ========== */
.user-section {
    margin-top: auto;
    padding: 16px;
    background: #f8fafc;
    border-radius: 14px;
    margin-bottom: 16px;
    position: relative;
    min-height: 70px;
    border: 1px solid #edf2f7;
    transition: all 0.2s;
}

.user-section:hover {
    background-color: #f1f5f9;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding-right: 30px;
}

.user-info:hover {
    opacity: 0.9;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--primary-color), #1fb86b);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-uid {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-balance {
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 600;
}

.logout-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.logout-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #ef4444;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.login-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* ========== 积分警告 ========== */
.balance-warning {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 77, 79, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    backdrop-filter: blur(10px);
    animation: slideUp 0.3s ease;
}

.balance-warning button {
    background: white;
    color: #ff4d4f;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ========== 网格视图 ========== */
.grid-view-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    margin: 0 auto;
}

.grid-view-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.grid-view-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.grid-view-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-item-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 8px;
    display: flex;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.grid-view-item:hover .grid-item-actions {
    opacity: 1;
}

.grid-item-action {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.grid-item-action:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-container.grid-view {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ========== 预设词模态框 ========== */
.preset-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.preset-modal.active {
    opacity: 1;
    visibility: visible;
}

.preset-modal-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    -webkit-overflow-scrolling: touch;
}

.preset-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preset-modal-title {
    margin: 0;
    font-size: 18px;
    color: var(--primary-color);
}

.close-preset-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.preset-container {
    display: flex;
    height: 400px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.preset-categories {
    width: 120px;
    background: #f7f7f7;
    overflow-y: auto;
    border-right: 1px solid #eee;
}

.preset-category {
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

.preset-category:hover {
    background: #e6f7ee;
}

.preset-category.active {
    background: var(--primary-color);
    color: white;
}

.preset-items-container {
    flex: 1;
    overflow-y: auto;
}

.preset-items {
    padding: 10px;
}

.preset-item {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    line-height: 1.4;
}

.preset-item:hover {
    background: #f0f0f0;
}

.preset-item.active {
    background: #e6f7ee;
    color: var(--primary-color);
}

.preset-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.preset-modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.preset-modal-btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.preset-modal-btn.secondary {
    background-color: #f0f0f0;
    color: #666;
}

.preset-modal-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 预设词确认模态框 */
.preset-confirm-content {
    padding: 15px;
}

#presetConfirmText {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    font-size: 13px;
    line-height: 1.5;
}

#presetPreviewImage {
    width: 100%;
    height: 200px;
    background: #f5f5f5;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#presetImagePreview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ========== 清空聊天模态框 ========== */
.clear-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.clear-chat-modal.active {
    opacity: 1;
    visibility: visible;
}

.clear-chat-modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.clear-chat-modal.active .clear-chat-modal-content {
    transform: scale(1);
}

.clear-chat-modal-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #1e293b;
    font-weight: 600;
}

.clear-chat-modal-content p {
    margin: 0 0 24px 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.clear-chat-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.clear-chat-modal-buttons .limit-modal-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.clear-chat-modal-buttons .get-key {
    background-color: #f1f5f9;
    color: #475569;
}

.clear-chat-modal-buttons .get-key:hover {
    background-color: #e2e8f0;
    transform: translateY(-1px);
}

.clear-chat-modal-buttons .confirm {
    background-color: #18A058;
    color: white;
}

.clear-chat-modal-buttons .confirm:hover {
    background-color: #1fb86b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 160, 88, 0.3);
}

/* 移动端适配 */
@media (max-width: 480px) {
    .clear-chat-modal-content {
        padding: 20px;
        width: 85%;
    }
    
    .clear-chat-modal-buttons {
        gap: 8px;
    }
    
    .clear-chat-modal-buttons .limit-modal-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* ========== 退出确认弹窗 ========== */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.confirm-modal.active {
    opacity: 1;
    visibility: visible;
}

.confirm-modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.confirm-modal-content h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
}

.confirm-modal-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.confirm-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-modal-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    flex: 1;
}

.confirm-modal-btn.cancel {
    background-color: #f0f0f0;
    color: #666;
}

.confirm-modal-btn.confirm {
    background-color: #ff4d4f;
    color: white;
}

.confirm-modal-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ========== 上传模态框 ========== */
#uploadModal .preset-modal-content {
    max-height: 80vh;
    overflow-y: auto;
}

#imageUploadArea,
#multiImageUploadArea {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

#imageUploadArea:hover,
#multiImageUploadArea:hover {
    border-color: #18A058;
    background-color: #f0f9f0;
}

#imageUploadArea i,
#multiImageUploadArea i {
    font-size: 48px;
    color: #18A058;
    margin-bottom: 10px;
}

#imageUploadArea p,
#multiImageUploadArea p {
    color: #666;
    margin: 0;
}

#imageUploadArea p:last-child,
#multiImageUploadArea p:last-child {
    color: #999;
    font-size: 12px;
    margin: 5px 0 0;
}

#switchToMultiMode,
#switchToSingleMode {
    color: #18A058;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 20px;
    background: #f5f5f5;
    transition: all 0.3s ease;
}

#switchToSingleMode {
    color: #666;
}

#switchToMultiMode:hover,
#switchToSingleMode:hover {
    background: #e8e8e8;
    transform: translateY(-2px);
}

#multiImageGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.multi-image-grid-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

.multi-image-grid-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.multi-image-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.multi-image-grid-item button {
    transition: all 0.3s ease;
}

.multi-image-grid-item button:hover {
    background: rgba(255, 0, 0, 0.8);
    transform: scale(1.1);
}

#singleImagePreview {
    display: none;
}

#previewImage {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

#previewImage:hover {
    transform: scale(1.02);
}

#removeSingleImageBtn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* ========== 浮动按钮 ========== */
.scroll-to-bottom-btn,
.floating-grid-btn,
.floating-preview-btn {
    position: fixed;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 30px;
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 200;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.9);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.scroll-to-bottom-btn.visible,
.floating-grid-btn.visible,
.floating-preview-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-bottom-btn:hover,
.floating-grid-btn:hover,
.floating-preview-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(24, 160, 88, 0.2);
}

.floating-preview-btn {
    bottom: 120px;
}

.floating-grid-btn {
    bottom: 70px;
}

.floating-grid-btn.hidden-by-input {
    display: none !important;
}

.scroll-to-bottom-btn {
    bottom: 20px;
}

/* ========== 临时消息 ========== */
.temporary-message {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    white-space: nowrap;
    animation: fadeOut 0.5s ease 1s forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ========== 范围输入样式 ========== */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #18A058;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #18A058;
    cursor: pointer;
    border: none;
}

/* ========== 响应式设计 ========== */
@media (max-width: 767px) {
    .chat-container:focus-within {
        padding-bottom: 100px;
    }
    
    .options-menu {
        width: 220px;
    }
    
    .ratio-option {
        padding: 6px;
    }
    
    .chat-container {
        padding-bottom: 70px;
    }
    
    .input-area {
        padding-bottom: 20px;
    }
    
    textarea {
        text-align: left;
    }
    
    .scroll-to-bottom-btn {
        left: 20px;
        right: auto;
        bottom: 80px;
    }
    
    .floating-preview-btn {
        right: 20px;
        bottom: 80px;
    }
    
    .grid-view-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 8px;
        padding: 8px;
    }
}

@media (min-width: 768px) {
    .app-container {
        max-width: 800px;
        margin: 0 auto;
        height: 90vh;
        margin-top: 5vh;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar {
        position: relative;
        transform: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .menu-btn {
        display: none;
    }
    
    .close-sidebar {
        display: none;
    }
    
    .chat-container {
        border-radius: 12px 12px 0 0;
        padding-bottom: 12px;
    }
    
    .message {
        max-width: 75%;
    }
    
    .scroll-to-bottom-btn {
        left: calc(50% - 400px + 20px);
        right: auto;
    }
    
    .floating-preview-btn {
        right: calc(50% - 400px + 20px);
        bottom: 80px;
    }
}

@media (min-width: 1024px) {
    .app-container {
        display: flex;
        max-width: none;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        background-color: var(--background-color);
    }
    
    .sidebar {
        position: relative;
        width: 280px;
        height: 100vh;
        transform: none !important;
        box-shadow: none;
        border-right: 1px solid rgba(0, 0, 0, 0.06);
        background-color: #ffffff;
        z-index: 100;
        overflow-y: auto;
        padding: 20px 16px;
        display: flex;
        flex-direction: column;
    }
    
    .sidebar-overlay,
    .menu-btn,
    .close-sidebar {
        display: none !important;
    }
    
    .sidebar-header {
        padding: 0 4px 16px 4px;
        margin-bottom: 8px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .sidebar-header h3 {
        font-size: 15px;
        font-weight: 600;
        color: #1f1f1f;
        letter-spacing: 0.3px;
        margin: 0;
    }
    
    .sidebar-content {
        flex: 1;
        overflow-y: auto;
        margin-right: -4px;
        padding-right: 4px;
    }
    
    .header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 32px;
        height: 64px;
        background-color: #ffffff;
        border-bottom: 1px solid #edf2f7;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
        position: relative;
        z-index: 10;
    }
    
    .header::before {
        content: "Artify绘图";
        font-size: 16px;
        font-weight: 600;
        color: #0f172a;
        letter-spacing: 0.2px;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
        font-weight: 500;
        color: #1e293b;
    }
    
    .header-left i {
        font-size: 20px;
        color: var(--primary-color);
    }
    
    .model-selector-wrapper {
        margin: 0 auto 0 24px;
        flex: 0 1 auto;
    }
    
    .header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .clear-chat-header-btn,
    .new-chat-btn {
        position: static;
        transform: none;
        width: auto;
        height: 36px;
        padding: 0 14px;
        border-radius: 20px;
        background: transparent;
        color: #475569;
        font-size: 14px;
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        border: 1px solid #e2e8f0;
        transition: all 0.2s;
    }
    
    .chat-container .message {
        max-width: 700px;
        width: fit-content;
        margin-left: auto;
        margin-right: auto;
    }
    
    .chat-container .user-message {
        margin-left: auto;
        margin-right: 0;
    }
    
    .chat-container .system-message {
        margin-right: auto;
        margin-left: 0;
    }
    
    .system-message:has(.message-image-container) {
        max-width: 700px;
    }
    
    .welcome-message {
        margin: auto;
        max-width: 600px;
    }
    
    .welcome-message h1 {
        font-size: 28px;
    }
    
    .input-area {
        background: #ffffff;
        border-top: 1px solid #edf2f7;
        padding: 18px 20px 22px;
        display: flex;
        justify-content: center;
    }
    
    .input-container {
        width: 100%;
        max-width: 860px;
        margin: 0 auto;
    }
    
    .grid-view-container {
        max-width: 1000px;
        margin: 0 auto;
        padding: 20px;
    }
    
    .scroll-to-bottom-btn,
    .floating-grid-btn,
    .floating-preview-btn {
        position: fixed;
        right: 28px;
        width: 44px;
        height: 44px;
        border-radius: 30px;
        background: white;
        color: #1e293b;
        border: 1px solid #e2e8f0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
        z-index: 200;
        backdrop-filter: blur(8px);
        background: rgba(255, 255, 255, 0.9);
    }
    
    .floating-preview-btn {
        bottom: 120px;
    }
    
    .floating-grid-btn {
        bottom: 70px;
    }
    
    .scroll-to-bottom-btn {
        bottom: 20px;
    }
    
    .batch-mode {
        left: auto;
        right: 28px;
        bottom: 180px;
        transform: none;
        background: white;
        color: #1e293b;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    }
}

@media (max-width: 480px) {
    .grid-view-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 6px;
        padding: 6px;
    }
}

/* ========== 隐藏元素 ========== */
.mode-switcher,
.chat-message,
.user-chat,
.system-chat,
.expired-image-message,
.view-toggle-container {
    display: none;
}

/* ========== 工具类 ========== */
button,
a,
div {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

button:focus,
button:active,
a:focus,
a:active,
div:focus,
div:active {
    outline: none;
    box-shadow: none;
}

/* 历史记录项包装器 */
.history-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
    position: relative;
}

.history-item-wrapper:hover {
    background-color: #f5f7fa;
}

.history-item-wrapper.active {
    background-color: #e8f3ed;
}

.history-item-wrapper.selectable {
    padding-left: 40px;
    position: relative;
}

.history-item-wrapper.selectable::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 3px;
    transition: all 0.2s;
    z-index: 2;
}

.history-item-wrapper.selectable.selected::before {
    background: #18A058;
    border-color: #18A058;
}

.history-item-wrapper.selectable.selected::after {
    content: '✓';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
}

.history-item-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 4px 0;
}

.history-item-content i {
    font-size: 14px;
    color: #94a3b8;
    flex-shrink: 0;
}

.history-item-wrapper.active .history-item-content i {
    color: var(--primary-color);
}

.history-title {
    font-size: 13px;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-wrapper.active .history-title {
    color: var(--primary-color);
    font-weight: 500;
}

/* 历史记录删除按钮 */
.history-delete-btn {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 4px;
    opacity: 0;
}

.history-item-wrapper:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    background-color: #ff4d4f;
    color: white;
    transform: scale(1.1);
}

/* 批量选择模式下隐藏删除按钮 */
.history-item-wrapper.selectable .history-delete-btn {
    display: none;
}

/* 确保批量选择模式下不影响样式 */
.history-item-wrapper.selectable .history-item-content {
    margin-left: 0;
}

/* 移动端适配 */
@media (max-width: 767px) {
    .history-delete-btn {
        opacity: 1;
        background-color: #f0f0f0;
    }
    
    .history-item-wrapper {
        padding: 8px 6px 8px 10px;
    }
}

/* 桌面端适配 */
@media (min-width: 1024px) {
    .history-item-wrapper {
        padding: 8px 6px 8px 12px;
    }
    
    .history-item-wrapper:hover {
        background-color: #f5f7fa;
    }
}

/* 添加上传模态框相关样式 */

/* 上传区域拖拽效果 */
#uploadArea.drag-over,
#uploadAreaMulti.drag-over {
    border-color: #18A058 !important;
    background-color: #f0f9f0 !important;
}

/* 预览容器样式 */
#singlePreviewContainer {
    margin-bottom: 20px;
}

.preview-wrapper {
    position: relative;
    width: 100%;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.preview-wrapper .preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-wrapper .remove-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 2;
}

.preview-wrapper .remove-image-btn:hover {
    background: #ff4d4f;
    transform: scale(1.1);
}

.preview-wrapper.empty-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    cursor: pointer;
    transition: all 0.3s;
}

.preview-wrapper.empty-slot:hover {
    border-color: #18A058;
    background-color: #f0f9f0;
}

.preview-wrapper.empty-slot i {
    font-size: 24px;
    color: #999;
    margin-bottom: 5px;
}

.preview-wrapper.empty-slot span {
    font-size: 12px;
    color: #999;
}

/* 多图预览网格 */
#multiPreviewContainer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

/* 模式切换标签 */
.mode-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.mode-tab:hover {
    color: #18A058;
    background-color: #f9f9f9;
}

.mode-tab.active {
    border-bottom-color: #18A058;
    color: #18A058;
    font-weight: 500;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .preview-wrapper {
        height: 80px;
    }
    
    .preview-wrapper.empty-slot i {
        font-size: 20px;
    }
    
    .preview-wrapper.empty-slot span {
        font-size: 10px;
    }
    
    #multiPreviewContainer {
        gap: 6px;
    }
}

/* 移动端输入框优化 */
@media (max-width: 767px) {
    .chat-container:focus-within {
        padding-bottom: 100px;
    }
    
    .chat-container {
        transition: padding-bottom 0.2s ease;
    }
    
    .chat-container .message:last-child {
        margin-bottom: 10px;
    }
}

/* ========== 尺寸选择弹窗移动端适配 ========== */
.size-modal .size-modal-content {
    background: white;
    border-radius: 20px;
    padding: 20px;
    width: 90%;
    max-width: 380px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.size-modal.active .size-modal-content {
    transform: scale(1);
}

/* 移动端适配 */
@media (max-width: 767px) {
    .size-modal .size-modal-content {
        width: 92%;
        padding: 16px;
        border-radius: 16px;
    }
    
    .size-modal-header {
        margin-bottom: 12px;
    }
    
    .size-modal-title {
        font-size: 16px;
    }
    
    .close-size-modal {
        font-size: 20px;
    }
    
    .ratio-category-title {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .ratio-category-items {
        gap: 10px;
    }
    
    .ratio-option {
        padding: 6px 10px;
    }
    
    .ratio-preview {
        width: 32px;
        height: 32px;
    }
    
    .ratio-option span {
        font-size: 13px;
    }
}

/* 极小屏幕适配 */
@media (max-width: 480px) {
    .size-modal .size-modal-content {
        width: 95%;
        padding: 14px;
    }
    
    .ratio-category-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .ratio-option {
        padding: 5px 8px;
    }
    
    .ratio-preview {
        width: 28px;
        height: 28px;
    }
    
    .ratio-option span {
        font-size: 12px;
    }
}

/* 尺寸弹窗中的模型信息显示 */
.size-modal-model-info {
    margin: 12px 0 16px 0;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.model-info-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}

.model-info-badge i {
    color: var(--primary-color);
    font-size: 14px;
}

.model-info-badge strong {
    color: var(--text-color);
    font-weight: 600;
}

.model-price-badge {
    background: #e6f7ee;
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

@media (max-width: 480px) {
    .size-modal-model-info {
        margin: 8px 0 12px 0;
        padding: 8px 10px;
    }
    
    .model-info-badge {
        font-size: 12px;
    }
    
    .model-price-badge {
        font-size: 11px;
        padding: 2px 6px;
    }
}

/* ========== 积分不足弹窗样式 ========== */
.insufficient-balance-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.insufficient-balance-modal.active {
    opacity: 1;
    visibility: visible;
}

.insufficient-balance-content {
    background: white;
    border-radius: 24px;
    padding: 28px 24px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.insufficient-balance-modal.active .insufficient-balance-content {
    transform: scale(1);
}

.modal-icon {
    margin-bottom: 16px;
}

.insufficient-balance-content h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.insufficient-balance-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

.insufficient-balance-content .modal-tip {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 24px;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-btn {
    padding: 12px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn.sponsor-btn {
    background: linear-gradient(135deg, #18A058, #1fb86b);
    color: white;
    box-shadow: 0 2px 8px rgba(24, 160, 88, 0.3);
}

.modal-btn.sponsor-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 160, 88, 0.4);
}

.modal-btn.invite-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.modal-btn.invite-btn:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.modal-btn.cancel-btn {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
}

.modal-btn.cancel-btn:hover {
    background: #f8fafc;
    color: #64748b;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .insufficient-balance-content {
        padding: 24px 20px;
        max-width: 300px;
    }
    
    .modal-icon i {
        font-size: 40px !important;
    }
    
    .insufficient-balance-content h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .insufficient-balance-content p {
        font-size: 13px;
    }
    
    .modal-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* ========== 模型选择器禁用状态样式 ========== */
#modelSelector:disabled,
#uploadImageBtn:disabled,
#optionsButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#submitBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#submitBtn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ========== 移动端安全区域适配 ========== */
@supports (padding: max(0px)) {
    .input-area {
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }
    
    .chat-container {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
    
    .chat-container:focus-within {
        padding-bottom: max(80px, calc(env(safe-area-inset-bottom) + 80px));
    }
    
    .temporary-message {
        bottom: max(110px, calc(env(safe-area-inset-bottom) + 110px));
    }
    
    .scroll-to-bottom-btn {
        bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
    }
    
    .floating-preview-btn {
        bottom: max(120px, calc(env(safe-area-inset-bottom) + 120px));
    }
    
    .floating-grid-btn {
        bottom: max(70px, calc(env(safe-area-inset-bottom) + 70px));
    }
    
    .balance-warning {
        bottom: max(100px, calc(env(safe-area-inset-bottom) + 100px));
    }
    
    .batch-mode {
        bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
    }
}

/* 移动端输入框优化 - 增强版 */
@media (max-width: 767px) {
    html {
        height: -webkit-fill-available;
    }
    
    body {
        height: -webkit-fill-available;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
    }
    
    .app-container {
        height: -webkit-fill-available;
        display: flex;
        flex-direction: column;
    }
    
    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: 100%;
    }
    
    .chat-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }
    
    .input-area {
        position: relative;
        background: #ffffff;
        border-top: 1px solid #edf2f7;
        padding: 12px 16px;
        flex-shrink: 0;
        z-index: 20;
    }
    
    .keyboard-visible .chat-container {
        transition: padding-bottom 0.2s ease;
    }
    
    .input-wrapper:focus-within {
        border-color: var(--primary-color);
        background: #ffffff;
        box-shadow: 0 0 0 3px rgba(24, 160, 88, 0.15);
    }
    
    .input-container {
        width: 100%;
        max-width: 100%;
    }
    
    .keyboard-visible .chat-container {
        scroll-behavior: auto;
    }
    
    input, textarea {
        font-size: 16px !important;
    }
    
    .size-modal-content,
    .preset-modal-content,
    .confirm-modal-content,
    .insufficient-balance-content {
        margin-bottom: env(safe-area-inset-bottom);
    }
}

/* 桌面端保持原有样式 */
@media (min-width: 768px) {
    .chat-container:focus-within {
        padding-bottom: 12px;
    }
}

/* iOS 状态栏和底部栏颜色适配 */
@supports (padding: env(safe-area-inset-top)) {
    .header {
        padding-top: env(safe-area-inset-top);
        padding-top: constant(safe-area-inset-top);
    }
    
    .sidebar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .sidebar-logo {
        margin-top: env(safe-area-inset-top);
    }
}

/* 深色模式下的输入框背景（可选） */
@media (prefers-color-scheme: dark) {
    .input-area {
        background-color: #1a1a1a;
        border-top-color: #333;
    }
    
    .input-wrapper {
        background-color: #2a2a2a;
        border-color: #444;
    }
    
    .input-wrapper:focus-within {
        background-color: #333;
    }
    
    textarea#prompt {
        color: #fff;
    }
    
    textarea#prompt::placeholder {
        color: #888;
    }
}
@media (min-width: 1024px) {
    /* 侧边栏 - 移除多余内边距 */
    .sidebar {
        width: 280px;
        height: 100vh;
        background-color: #ffffff;
        border-right: 1px solid rgba(0, 0, 0, 0.06);
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        padding: 0; /* 关键：移除侧边栏的内边距 */
    }
    
    /* 侧边栏头部 - 与主内容头部高度一致 */
    .sidebar-header {
        height: 64px; /* 与 .header 高度一致 */
        padding: 0 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #f0f0f0;
        flex-shrink: 0;
        margin: 0;
        box-sizing: border-box;
    }
    
    .sidebar-header h3 {
        font-size: 16px;
        font-weight: 600;
        color: #1f1f1f;
        margin: 0;
        line-height: 1;
    }
    
    /* 主内容区域 */
    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: 100vh;
    }
    
    /* 头部 - 高度与侧边栏头部一致 */
    .header {
        height: 64px;
        background-color: white;
        border-bottom: 1px solid #edf2f7;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 24px;
        flex-shrink: 0;
        margin: 0;
        box-sizing: border-box;
    }
    
    .header::before {
        content: "Artify绘图";
        font-size: 16px;
        font-weight: 600;
        color: #0f172a;
        line-height: 1;
    }
    
    /* 确保两个区域都从顶部开始 */
    .sidebar,
    .main-content {
        margin-top: 0;
        margin-bottom: 0;
    }
}