:root {
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-dark: #7c3aed;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #34d399;
    --danger: #ef4444;
    --danger-light: #f87171;
    --warning: #f59e0b;
    --dark: #0a0a0a;
    --light: #ffffff;
    --bg-dark: #050505;
    --bg-card: rgba(17, 17, 17, 0.7);
    --bg-elevated: rgba(26, 26, 26, 0.8);
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #64748b;
    --border: rgba(30, 41, 59, 0.5);
    --border-light: rgba(51, 65, 85, 0.8);
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-primary: rgba(139, 92, 246, 0.25);
    --glass-blur: 12px;
    
    /* Spacing system */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Static Background */
body {
    background: #0a0a0a;
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    gap: var(--space-lg);
    grid-template-areas: 
        "hero hero side1 side2"
        "hero hero side3 side4"
        "footer footer footer footer";
}

/* Specific Chat Bento Layout */
.chat-bento {
    grid-template-areas: 
        "hero hero hero side1"
        "hero hero hero side2"
        "footer footer footer footer";
    flex: 1;
    min-height: 0;
}

.chat-history-item {
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    max-height: 100%;
}

.chat-history {
    background: transparent !important;
    border: none !important;
    flex: 1;
    margin-bottom: 0 !important;
    padding: var(--space-xl) !important;
    overflow-y: auto;
}

.chat-input-item {
    padding: 0 !important;
}

.chat-input-area {
    background: transparent !important;
    border: none !important;
    padding: var(--space-lg) var(--space-xl) !important;
}

/* Tags */
.tips-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.tag {
    padding: 4px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-muted);
}

.bento-item {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.bento-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--primary-light);
}

.bento-hero { grid-area: hero; }
.bento-side1 { grid-area: side1; }
.bento-side2 { grid-area: side2; }
.bento-side3 { grid-area: side3; }
.bento-side4 { grid-area: side4; }
.bento-footer { grid-area: footer; }


* {
    box-sizing: border-box;
}

html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    height: 100%;
    min-height: 100vh;
    overflow: hidden;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 登录表单样式 */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(16, 185, 129, 0.1), transparent);
    pointer-events: none;
}

.login-form {
    background: var(--bg-card);
    padding: var(--space-2xl);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 0 0 1px var(--border),
        0 20px 50px -12px var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin: auto;
    align-self: center;
    z-index: 1001;
    box-sizing: border-box;
}

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

.login-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--success));
}

.login-form h2 {
    margin-bottom: var(--space-xl);
    color: var(--text-light);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.login-form .input-group {
    margin-bottom: var(--space-lg);
    text-align: left;
    position: relative;
}

.login-form .input-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form .input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    font-size: 15px;
    background: var(--bg-elevated);
    color: var(--text-light);
    transition: all var(--transition-base);
}

.login-form .input-group input:hover {
    border-color: var(--border-light);
}

.login-form .input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--shadow-primary);
    outline: none;
    background: var(--bg-card);
}

.login-form .input-group input::placeholder {
    color: var(--text-dark);
}

.login-form button {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    margin-top: var(--space-sm);
}

.login-form button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px var(--shadow-primary);
}

.login-form button:active {
    transform: translateY(0);
}

.error-message {
    color: var(--danger);
    margin-top: var(--space-md);
    font-weight: 500;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-md);
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 14px;
}

.container {
    background: var(--bg-dark);
    border-radius: 0;
    box-shadow: none;
    border: none;
    width: 100%;
    max-width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--success), var(--primary));
    z-index: 10;
}

/* App Layout */
.app-layout {
    display: flex;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
    transition: width var(--transition-base);
}

.sidebar .logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.nav-item {
    padding: 12px 14px;
    margin-bottom: var(--space-xs);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--bg-elevated);
    color: var(--text-light);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--shadow-primary);
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 16px;
    opacity: 0.9;
}

.sidebar-footer {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

/* Sidebar Menu Buttons */
.sidebar-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.sidebar-menu-btn {
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.sidebar-menu-btn:hover {
    background: var(--border);
    color: var(--text-light);
}

.menu-btn-icon {
    font-size: 14px;
    flex-shrink: 0;
    opacity: 0.8;
}

.menu-btn-text {
    flex: 1;
}

/* Sidebar Bottom Info */
.sidebar-bottom-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.role-text {
    color: var(--text-muted);
    font-weight: 500;
    padding: 4px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 12px;
}

.logout-link:hover {
    color: var(--danger);
}

/* Settings Panel Modal */
.settings-panel-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
}

.settings-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
}

.settings-panel-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px -12px var(--shadow);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.settings-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-light);
}

.settings-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    padding: 0;
}

.settings-close-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-light);
}

.settings-panel-content {
    overflow-y: auto;
    padding: var(--space-lg);
    flex: 1;
}

.settings-form {
    margin-bottom: var(--space-lg);
}

.settings-form-group {
    margin-bottom: var(--space-lg);
}

.settings-form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-light);
    font-size: 13px;
}

.settings-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-light);
    font-size: 14px;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.settings-form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--shadow-primary);
}

.settings-form-hint {
    display: block;
    margin-top: var(--space-xs);
    font-size: 12px;
    color: var(--text-dark);
}

.settings-btn-submit {
    width: 100%;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-top: var(--space-sm);
}

.settings-btn-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px var(--shadow-primary);
}

.settings-btn-submit:active {
    transform: translateY(0);
}

.settings-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-lg) 0;
}

.settings-message {
    margin-top: var(--space-md);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    text-align: center;
    min-height: 1.5em;
    transition: all var(--transition-base);
}

.settings-message-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.settings-message-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* User Management Styles */
.user-management-section {
    margin-bottom: var(--space-lg);
}

.user-list-container {
    overflow-x: auto;
}

.user-list-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.user-list-table thead {
    background: var(--bg-card);
}

.user-list-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-list-table td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

.user-list-table tbody tr {
    transition: background var(--transition-fast);
}

.user-list-table tbody tr:hover {
    background: var(--bg-card);
}

.user-list-table tbody tr:last-child td {
    border-bottom: none;
}

.user-role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.user-role-badge.role-admin {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-light);
}

.user-role-badge.role-user {
    background: var(--bg-card);
    color: var(--text-muted);
}

.user-action-btn {
    padding: 6px 12px;
    margin: 0;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    white-space: nowrap;
}

.user-action-btn.edit-btn {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-light);
}

.user-action-btn.edit-btn:hover {
    background: rgba(139, 92, 246, 0.25);
}

.user-action-btn.delete-btn {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
}

.user-action-btn.delete-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
}

.user-action-btn.delete-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.user-list-table select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-light);
    font-size: 13px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.user-list-table select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--shadow-primary);
}

/* 下拉选项样式 */
.user-list-table select option,
select option {
    background: var(--bg-card);
    color: var(--text-light);
    padding: 10px;
}

/* 设置面板中的下拉框样式 */
.settings-form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-light);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.settings-form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 3px var(--shadow-primary);
}

.settings-form-group select option {
    background: var(--bg-card);
    color: var(--text-light);
    padding: 12px;
}

.settings-form-group select option:hover,
.settings-form-group select option:checked {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-light);
}

/* Content Area Styles */
.content-area {
    flex: 1;
    padding: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-dark);
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease;
    flex: 1;
    padding: var(--space-xl);
    min-height: 0;
    overflow: auto;
}

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

.view-section.active {
    display: flex;
    flex-direction: column;
}

#view-image-gen {
    overflow-y: auto;
}

#view-chat {
    overflow: hidden;
    height: 100%;
    max-height: 100%;
}

#view-chat.active {
    display: flex;
    flex-direction: column;
}
/* Chat Interface Styles */
.chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
    flex-shrink: 0;
}

.chat-controls .mode-selector {
    margin-bottom: 0;
}

.new-chat-btn {
    padding: 10px 18px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    height: fit-content;
    background: var(--bg-elevated);
    color: var(--text-light);
    border: 1px solid var(--border);
}

.new-chat-btn:hover {
    background: var(--border);
    border-color: var(--border-light);
}

.chat-history {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    flex: 1;
    overflow-y: auto;
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 0;
}

.message {
    display: flex;
    margin-bottom: 0;
    flex-shrink: 0;
}

.message.user {
    justify-content: flex-end;
}

.message.ai, .message.system {
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.message.ai .message-content {
    background: var(--bg-elevated);
    color: var(--text-light);
    border-bottom-left-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.message.system .message-content {
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    padding: var(--space-sm) 0;
}

.chat-input-area {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    flex-shrink: 0;
    transition: border-color var(--transition-fast);
}

.chat-input-area:focus-within {
    border-color: var(--primary);
}

.chat-file-previews {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    padding-top: var(--space-sm);
    padding-right: var(--space-sm);
}

.chat-file-preview-item {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    flex-shrink: 0;
    margin-top: var(--space-sm);
    margin-right: var(--space-sm);
    overflow: hidden;
}

.chat-file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-file-preview-item .file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 20px;
}

.chat-file-preview-item .remove-file-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    border: 2px solid var(--bg-card);
    border-radius: var(--radius-full);
    width: 18px;
    height: 18px;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10;
}

.chat-file-preview-item .remove-file-btn:hover {
    background: var(--danger-light);
    transform: scale(1.1);
}

.input-wrapper {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    padding: var(--space-sm);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-light);
}

#chatInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 14px;
    resize: none;
    padding: 10px 0;
    max-height: 200px;
    min-height: 44px;
    font-family: inherit;
    overflow-y: auto;
    line-height: 1.5;
}

#chatInput:focus {
    outline: none;
}

#chatInput::placeholder {
    color: var(--text-dark);
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.send-btn:hover {
    background: var(--primary-dark);
}

.send-btn:disabled {
    background: var(--secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

h1 {
    text-align: center;
    color: var(--text-light);
    margin-bottom: var(--space-xl);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.config-section, .control-section {
    margin-bottom: var(--space-xl);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-xl);
    position: relative;
}

.config-section:last-child,
.control-section:last-child {
    border-bottom: none;
}

.input-group {
    margin-bottom: var(--space-lg);
}

.input-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-light);
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    font-size: 14px;
    background: var(--bg-elevated);
    color: var(--text-light);
    transition: all var(--transition-fast);
}

.input-group input:hover {
    border-color: var(--border-light);
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--shadow-primary);
    outline: none;
}

.input-group input::placeholder {
    color: var(--text-dark);
}

.mode-selector {
    margin-bottom: var(--space-lg);
}

.mode-selector label {
    display: block;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: var(--space-md);
    font-size: 14px;
}

.radio-group {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
    position: relative;
    font-size: 13px;
}

.radio-group label:hover {
    border-color: var(--border-light);
    color: var(--text-light);
}

.radio-group input[type="radio"] {
    margin-right: var(--space-sm);
    accent-color: var(--primary);
}

.radio-group input[type="radio"]:checked + label,
.radio-group label:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-light);
}

.reference-image-section {
    margin-bottom: var(--space-lg);
}

.reference-image-section label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-light);
    font-size: 14px;
}

.reference-image-section input[type="file"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
}

.reference-image-section input[type="file"]:hover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.reference-image-section input[type="file"]::file-selector-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-right: var(--space-sm);
    font-weight: 500;
    font-size: 12px;
    transition: all var(--transition-fast);
}

.reference-image-section input[type="file"]::file-selector-button:hover {
    background: var(--primary-dark);
}

.image-previews-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.preview-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 3px;
    background: var(--bg-elevated);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
}

.preview-item .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    border: 2px solid var(--bg-card);
    border-radius: var(--radius-full);
    width: 20px;
    height: 20px;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10;
}

.preview-item .remove-btn::before {
    content: '';
    font-weight: bold;
    position: static;
    width: auto;
    height: auto;
    background: none;
    transition: none;
}

.preview-item .remove-btn:hover {
    background: var(--danger-light);
    transform: scale(1.1);
}

.prompt-section label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-light);
    font-size: 14px;
}

.prompt-section textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    background: var(--bg-elevated);
    color: var(--text-light);
    min-height: 100px;
    transition: all var(--transition-fast);
    line-height: 1.5;
}

.prompt-section textarea:hover {
    border-color: var(--border-light);
}

.prompt-section textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--shadow-primary);
    outline: none;
}

.prompt-section textarea::placeholder {
    color: var(--text-dark);
}

button {
    cursor: pointer;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

/* #generateBtn 旧样式已移除，统一使用 .generate-main-btn 控制 */

.status-message {
    margin: var(--space-lg) 0;
    text-align: center;
    min-height: 24px;
    font-weight: 500;
    font-size: 14px;
}

.status-message.error {
    color: var(--danger);
}

.status-message.success {
    color: var(--success);
}

.status-message.normal {
    color: var(--text-muted);
}

.result-container {
    text-align: center;
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.result-container h2 {
    color: var(--text-light);
    margin-bottom: var(--space-lg);
    font-size: 20px;
    font-weight: 600;
}

.image-wrapper {
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-elevated);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-wrapper::before {
    content: '';
    position: absolute;
    color: var(--text-muted);
    font-size: 14px;
    display: none;
}

.image-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md);
}

.action-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.primary-btn, .secondary-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    min-width: 120px;
}

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

.primary-btn:hover {
    background: var(--success-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.secondary-btn {
    background: var(--bg-elevated);
    color: var(--text-light);
    border: 1px solid var(--border);
}

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

/* Markdown Styles */
.message-content h1, .message-content h2, .message-content h3, .message-content h4, .message-content h5, .message-content h6 {
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
    font-weight: 600;
    line-height: 1.3;
}

.message-content h1 { font-size: 1.4em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.message-content h2 { font-size: 1.2em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.message-content h3 { font-size: 1.1em; }

.message-content p {
    margin-top: 0;
    margin-bottom: var(--space-md);
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content ul, .message-content ol {
    margin-top: 0;
    margin-bottom: var(--space-md);
    padding-left: 1.5em;
}

.message-content li {
    margin-bottom: var(--space-xs);
}

.message-content code {
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    background-color: var(--bg-dark);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.message-content pre {
    background-color: var(--bg-dark);
    padding: var(--space-md);
    overflow: auto;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
}

.message-content pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.85em;
    color: inherit;
    white-space: pre;
}

.message-content blockquote {
    margin: 0 0 var(--space-md);
    padding: 0 1em;
    color: var(--text-muted);
    border-left: 3px solid var(--border);
}

.message-content table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-bottom: var(--space-md);
    width: 100%;
}

.message-content table th, .message-content table td {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
}

.message-content table th {
    background: var(--bg-dark);
    font-weight: 600;
}

.message-content table tr:nth-child(2n) {
    background-color: var(--bg-elevated);
}

.message-content img {
    max-width: 100%;
    border-radius: var(--radius-md);
}

/* Thought Process Styles */
.thought-process {
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-dark);
    overflow: hidden;
}

.thought-process summary {
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: 500;
    user-select: none;
    transition: color var(--transition-fast);
}

.thought-process summary:hover {
    color: var(--text-light);
}

.thought-content {
    padding: var(--space-md);
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 0.9em;
    line-height: 1.6;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* Selection */
::selection {
    background: rgba(139, 92, 246, 0.3);
    color: var(--text-light);
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========== Result-Focused Image Gen Layout ========== */
#view-image-gen {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    height: 100%;
    overflow: hidden;
    padding: var(--space-lg);
}

/* Central Display Area */
.main-display-area {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100%;
    min-height: 0;
}

/* Result Hero Card */
.result-hero-card {
    flex: 1;
    min-height: 0;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Prompt Input Area (Core Area) */
.prompt-input-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: var(--space-sm);
}

.input-glow-wrapper {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4px;
    transition: all var(--transition-base);
    display: block; /* 改为块级，使用绝对定位放置按钮 */
}

.input-glow-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.2);
}

#prompt {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    padding: 16px;
    padding-right: 60px; /* 为右侧的紧凑按钮留出空间 */
    background: transparent;
    border: none !important;
    color: var(--text-light);
    font-family: inherit;
    font-size: 15px;
    resize: none;
    line-height: 1.6;
    display: block;
}

#prompt:focus {
    outline: none;
    box-shadow: none !important;
}

.generate-main-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    margin: 0 !important; /* 强制消除可能的 margin */
}

.generate-main-btn span:first-child {
    font-size: 20px;
}

.generate-main-btn .btn-shortcut {
    display: none; /* 按钮太小时隐藏文字提示 */
}

.generate-main-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 15px var(--shadow-primary);
}

/* Result Display */
.result-display {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-display img {
    max-width: 100%;
    max-height: calc(100% - 20px);
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Result Actions - 绝对定位在底部 */
.result-actions {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-md);
    z-index: 10;
}

/* Glassmorphism Buttons */
.result-actions button {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-actions button::before {
    font-size: 16px;
}

#previewBtn::before {
    content: '👁️';
}

#downloadBtn::before {
    content: '💾';
}

.result-actions button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
}

.result-actions button:active {
    transform: translateY(0);
}

/* Placeholder */
.result-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.4;
    background: linear-gradient(135deg, var(--primary), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Inspiration Bar */
.inspiration-bar {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 8px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.inspiration-text {
    flex: 1;
}

.inspiration-refresh-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    opacity: 0.6;
}

.inspiration-refresh-btn:hover {
    background: var(--bg-elevated);
    opacity: 1;
    transform: rotate(180deg);
}

/* Control Sidebar */
.control-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    padding-right: 4px;
}

.control-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
}

.control-card h3 {
    margin: 0 0 16px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Mode Toggle Group (Radio) */
.mode-toggle-group {
    display: flex;
    gap: 8px;
}

.mode-radio {
    flex: 1;
    cursor: pointer;
}

.mode-radio input {
    display: none;
}

.mode-card {
    padding: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-base);
}

.mode-radio input:checked + .mode-card {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.15);
}

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

.mode-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.mode-radio input:checked + .mode-card .mode-name {
    color: var(--text-light);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: rgba(255, 255, 255, 0.02);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.upload-icon {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.upload-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.compact-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

/* ========== Compact Chat Layout ========== */
#view-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-card);
}

.chat-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.model-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.model-btn {
    padding: 6px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.model-btn.active,
.model-btn:has(input:checked) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.new-chat-btn {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
}

.new-chat-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-light);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-dark);
}

/* Compact Input Area */
.chat-input-compact {
    padding: 12px 24px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.file-previews {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    overflow-x: auto;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attach-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 18px;
}

.attach-btn:hover {
    background: var(--border);
    color: var(--text-light);
}

#chatInput {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
}

#chatInput:focus {
    outline: none;
    border-color: var(--primary);
}

.send-btn {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--primary-dark);
}

.chat-status {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    min-height: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-areas: 
            "hero hero"
            "side1 side2"
            "side3 side4"
            "footer footer";
    }
}

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "hero"
            "side1"
            "side2"
            "side3"
            "side4"
            "footer";
    }
    
    .sidebar {
        width: 200px;
        padding: var(--space-md);
    }
    
    .view-section {
        padding: var(--space-lg);
    }
    
    .login-form {
        padding: var(--space-xl);
        margin: auto;
        align-self: center;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .primary-btn, .secondary-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: var(--space-md);
    }
    
    .nav-links {
        display: flex;
        gap: var(--space-sm);
        overflow-x: auto;
    }
    
    .nav-item {
        white-space: nowrap;
    }
    
    .sidebar-footer {
        display: none;
    }
}

