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

/* Toast 提示样式 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 16px 24px;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  min-width: 200px;
  max-width: 400px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-icon {
  font-size: 20px;
  font-weight: bold;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: #333333;
}

/* 成功样式 */
.toast-success {
  border: 2px solid #4CAF50;
}

.toast-success .toast-icon {
  color: #4CAF50;
}

/* 错误样式 */
.toast-error {
  border: 2px solid #f44336;
}

.toast-error .toast-icon {
  color: #f44336;
}

/* 信息样式 */
.toast-info {
  border: 2px solid #2196F3;
}

.toast-info .toast-icon {
  color: #2196F3;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #ffffff;
  min-height: 100vh;
  color: #000000;
}

.container {
  display: flex;
  height: 100vh;
  background: #ffffff;
}

/* 左侧控制面板 */
.control-panel {
  width: 30%;
  min-width: 320px;
  background: #fafafa;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  border-right: 1px solid #e5e5e5;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e5e5;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.panel-header h1 {
  font-size: 20px;
  font-weight: 500;
  color: #000000;
  letter-spacing: -0.5px;
}

/* 上传区域 */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-area {
  border: 1px dashed #d0d0d0;
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
}

.upload-area:hover {
  border-color: #000000;
  background: #fafafa;
}

.upload-area.dragover {
  border-color: #000000;
  background: #f5f5f5;
  border-style: solid;
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: #000000;
  margin-bottom: 12px;
}

.upload-hint {
  font-size: 13px;
  color: #808080;
  margin-top: 8px;
}

/* 已上传图片预览 */
.uploaded-images {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.uploaded-image {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 4px;
  overflow: hidden;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
}

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

.uploaded-image .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #000000;
  border: 1px solid #000000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.uploaded-image .remove-btn:hover {
  background: #000000;
  color: #ffffff;
}

/* 提示词输入 */
.prompt-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-section label {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
}

.prompt-section textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
  transition: border-color 0.2s ease;
  background: #ffffff;
}

.prompt-section textarea:focus {
  outline: none;
  border-color: #000000;
}

/* 操作按钮 */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

.primary-btn, .secondary-btn {
  padding: 14px 24px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.primary-btn {
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
}

.primary-btn:hover {
  background: #333333;
  border-color: #333333;
}

.primary-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.primary-btn:disabled:hover {
  background: #000000;
  border-color: #000000;
}

.secondary-btn {
  background: #ffffff;
  color: #000000;
  border: 1px solid #d0d0d0;
}

.secondary-btn:hover {
  background: #fafafa;
  border-color: #000000;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* 右侧展示面板 */
.display-panel {
  flex: 1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: auto;
}

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

/* 空状态 */
.empty-state {
  text-align: center;
}

.empty-icon {
  width: 100px;
  height: 100px;
  color: #d0d0d0;
  margin-bottom: 24px;
}

.empty-state p {
  font-size: 16px;
  color: #808080;
}

/* 加载状态 */
.loading-state {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 2px solid #f0f0f0;
  border-top-color: #000000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}

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

.loading-state p {
  font-size: 15px;
  color: #808080;
  margin: 8px 0;
}

.countdown {
  font-size: 14px;
  color: #a0a0a0;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* 图片结果 */
.image-result {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

#resultImage {
  max-width: 90%;
  max-height: 75%;
  border-radius: 2px;
  object-fit: contain;
  border: 1px solid #e0e0e0;
}

.image-info {
  display: flex;
  align-items: center;
  gap: 24px;
}

.generation-time {
  font-size: 14px;
  color: #808080;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.download-btn {
  padding: 12px 32px;
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: #333333;
  border-color: #333333;
}

/* API 密钥帮助区域 */
.api-key-help {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
}

.api-link {
  color: #4285f4;
  text-decoration: none;
  transition: opacity 0.2s;
}

.api-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* API 密钥验证状态指示器 */
.api-key-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  user-select: none;
}

.api-key-status svg {
  width: 16px;
  height: 16px;
}

.api-key-status span {
  line-height: 16px;
}

.api-key-status.validating {
  color: #999;
}

.api-key-status.validating .icon-spin {
  animation: spin 1s linear infinite;
}

.api-key-status.valid {
  color: #4CAF50;
}

.api-key-status.invalid {
  color: #f44336;
}

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

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

.modal.show {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 500;
  color: #000000;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #808080;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: #f5f5f5;
  color: #000000;
}

.modal-body {
  padding: 24px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #000000;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s ease;
  background: #ffffff;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' 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: 20px;
  padding-right: 40px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #000000;
}

.modal-footer {
  padding: 24px;
  border-top: 1px solid #e5e5e5;
  display: flex;
  justify-content: flex-end;
}

/* 模型管理样式 */
.model-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 8px;
}

.model-item:hover {
  background: #f9f9f9;
}

.model-name {
  flex: 1;
  font-size: 14px;
  color: #333;
}

.model-name.editing {
  padding: 4px 8px;
  border: 1px solid #000;
  border-radius: 4px;
  background: #fff;
  outline: none;
}

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

.model-actions button {
  padding: 4px 8px;
  font-size: 12px;
  background: #f5f5f5;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.model-actions button:hover {
  background: #e8e8e8;
  border-color: #b0b0b0;
}

.model-actions button.delete-btn {
  color: #d32f2f;
}

.model-actions button.delete-btn:hover {
  background: #ffebee;
  border-color: #d32f2f;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  .control-panel {
    width: 100%;
    min-width: auto;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid #e5e5e5;
  }
  
  .display-panel {
    min-height: 50vh;
  }
}