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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* 内容包装器：左右分栏布局 */
.content-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* 左侧主内容区域 */
.left-panel {
    flex: 1;
    min-width: 0;
    padding-right: 30px;
    border-right: 2px solid #e9ecef;
}

/* 右侧历史记录区域 */
.right-panel {
    width: 380px;
    flex-shrink: 0;
    padding-left: 0;
}

/* 右侧面板的历史记录样式调整 */
.right-panel .history-section {
    margin-top: 0;
    position: sticky;
    top: 20px;
}

.right-panel .section-title {
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.right-panel .history-list {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

/* 自定义滚动条样式 */
.right-panel .history-list::-webkit-scrollbar {
    width: 6px;
}

.right-panel .history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.right-panel .history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.right-panel .history-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 右侧面板的历史项样式调整 */
.right-panel .history-item {
    padding: 12px;
    margin-bottom: 12px;
}

.right-panel .history-preview {
    flex-direction: column;
    align-items: flex-start;
}

.right-panel .preview-image {
    width: 100%;
    height: 150px;
    margin-bottom: 8px;
}

.input-section {
    margin-bottom: 40px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 0.95rem;
}

.model-selection {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.model-select {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s;
    cursor: pointer;
}

.model-select:focus {
    outline: none;
    border-color: #667eea;
}

.model-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 0.9rem;
}

.info-label {
    color: #666;
    font-weight: 500;
}

.info-value {
    color: #667eea;
    font-weight: 600;
}

.model-description {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 0 6px 6px 0;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}

.prompt-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s;
}

.prompt-input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-width: 200px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loader {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.result-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #333;
}

.result-container {
    min-height: 300px;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fafafa;
}

.placeholder {
    text-align: center;
    color: #999;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.placeholder p {
    font-size: 1.1rem;
}

.result-image {
    text-align: center;
    width: 100%;
}

.result-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

.image-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 10px 24px;
}

.btn-success {
    background: #28a745;
    color: white;
    padding: 10px 24px;
}

.btn-secondary:hover,
.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 历史记录区域（原样式保留，用于兼容） */
.history-section {
    /* margin-top: 40px;  已移除，因为移到了右侧面板 */
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

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

.btn-date {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-date:hover {
    background: #f5f5f5;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
}

.history-list {
    display: grid;
    gap: 16px;
    max-height: 600px;
    overflow-y: auto;
    padding: 4px;
}

.history-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.history-item:hover {
    transform: translateX(4px);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.history-model {
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-badge {
    font-size: 0.8rem;
    padding: 4px 8px;
    background: #667eea;
    color: white;
    border-radius: 4px;
}

.history-time {
    color: #999;
    font-size: 0.9rem;
}

.history-prompt {
    color: #555;
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-preview {
    display: flex;
    gap: 12px;
    align-items: center;
}

.preview-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.history-empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1rem;
}

/* 图片元数据样式 */
.image-metadata {
    margin-top: 12px;
    padding: 10px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    font-size: 13px;
}

.metadata-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.metadata-label {
    color: #666;
    font-weight: 500;
}

.metadata-value {
    color: #333;
    font-weight: 600;
}

.metadata-loading {
    color: #999;
    font-style: italic;
    text-align: center;
}

.metadata-error {
    color: #dc3545;
    font-size: 12px;
    text-align: center;
}

/* 历史记录的紧凑型元数据 */
.history-image-metadata {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.02);
    border-radius: 4px;
}

.metadata-info-sm {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: #666;
}

.metadata-item-sm {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: rgba(0,0,0,0.05);
    border-radius: 3px;
}

.metadata-loading-sm {
    color: #999;
    font-size: 11px;
    font-style: italic;
}

@media (max-width: 1024px) {
    .content-wrapper {
        flex-direction: column;
    }

    .left-panel {
        padding-right: 0;
        border-right: none;
        border-bottom: 2px solid #e9ecef;
        padding-bottom: 30px;
        margin-bottom: 30px;
    }

    .right-panel {
        width: 100%;
    }

    .right-panel .history-section {
        position: static;
    }

    .right-panel .history-list {
        max-height: 600px;
    }

    .right-panel .history-preview {
        flex-direction: row;
        align-items: center;
    }

    .right-panel .preview-image {
        width: 120px;
        height: 120px;
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .model-selection {
        flex-direction: column;
        align-items: stretch;
    }

    .model-select {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .image-actions {
        flex-direction: column;
    }
}
