/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    position: relative;
}

/* 水印样式 */
body::before {
    content: 'YcGod';
    position: fixed;
    top: 20%;
    left: 90%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 8rem;
    font-weight: bold;
    color: rgba(64, 64, 64, 0.1);
    z-index: 11;
    pointer-events: none;
    user-select: none;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.app-header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 8px;
}

.app-header p {
    color: #718096;
    font-size: 1.1rem;
}

/* 页面底部样式 */
.app-footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
    margin-top: auto;
    position: relative;
    z-index: 10;
}

.app-footer p {
    color: #718096;
    font-size: 0.9rem;
    margin: 0;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 10;
}

/* 左侧参数面板 (20%) */
.params-panel {
    width: 20%;
    min-width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    height: fit-content;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.panel-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.panel-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.panel-section h3 {
    font-size: 1.1rem;
    color: #2d3748;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-range {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f7fafc;
}

.upload-area:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.upload-area i {
    font-size: 2rem;
    color: #a0aec0;
    margin-bottom: 10px;
}

.upload-area p {
    color: #718096;
    margin: 0;
}

.upload-preview {
    position: relative;
    margin-top: 10px;
}

.upload-preview img {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.btn-remove {
    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;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 按钮样式 */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

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

.button-group {
    display: flex;
    gap: 8px;
}

.button-group.vertical {
    flex-direction: column;
}

/* 右侧图片展示区域 (80%) */
.gallery-panel {
    width: 80%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

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

.gallery-header h3 {
    font-size: 1.2rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gallery-stats {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #718096;
}

/* 图片网格 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    min-height: 400px;
}

/* 图片卡片 */
.image-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    position: relative;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.image-card-content {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-card:hover .image-card-overlay {
    opacity: 1;
}

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

.image-card-actions .btn {
    padding: 8px;
    font-size: 12px;
}

/* 图片状态 */
.image-status {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.status-pending {
    background: #ed8936;
}

.status-generating {
    background: #4299e1;
}

.status-success {
    background: #48bb78;
}

.status-error {
    background: #f56565;
}

/* 加载状态 */
.image-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f7fafc;
    color: #718096;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

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

/* 错误状态 */
.image-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #fed7d7;
    color: #c53030;
    text-align: center;
    padding: 16px;
}

.image-error i {
    font-size: 2rem;
    margin-bottom: 8px;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #a0aec0;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-state h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    margin: 2% auto;
    max-width: 80vw;
    max-height: 85vh;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal img {
    width: 100%;
    height: auto;
    max-height: calc(85vh - 120px);
    object-fit: contain;
    display: block;
}

.modal-actions {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* 消息提示 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #48bb78;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.toast.error {
    border-left-color: #f56565;
}

.toast.warning {
    border-left-color: #ed8936;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .params-panel,
    .gallery-panel {
        width: 100%;
    }
    
    .params-panel {
        min-width: auto;
    }
    
    /* 中等屏幕模态框调整 */
    .modal-content {
        max-width: 85vw;
        max-height: 88vh;
    }
    
    .modal img {
        max-height: calc(88vh - 110px);
    }
}

@media (max-width: 768px) {
    .app-header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 10px;
        gap: 10px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .gallery-stats {
        flex-wrap: wrap;
    }
    
    /* 移动端模态框调整 */
    .modal-content {
        margin: 1% auto;
        max-width: 95vw;
        max-height: 90vh;
    }
    
    .modal img {
        max-height: calc(90vh - 100px);
    }
    
    .modal-actions {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin: 16px;
        justify-content: center;
    }
}
