/* 电商工具页面样式 */

.et-hero {
  text-align: center;
  padding: 40px 20px 20px;
  background: linear-gradient(135deg, var(--brand, #71DC68) 0%, var(--brand-weak, #78FB60) 100%);
  color: var(--brand-ink, #14331B);
}

.et-hero h1 {
  font-size: 2.5rem;
  margin: 0 0 10px;
}

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

.et-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.et-category {
  margin-bottom: 40px;
}

.et-cat-title {
  font-size: 1.5rem;
  color: #333;
  border-bottom: 2px solid var(--brand, #71DC68);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.et-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.et-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

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

/* Coming-soon 卡片 */
.et-card-coming-soon {
  opacity: 0.55;
  pointer-events: none;
  filter: grayscale(0.4);
}
.et-card-coming-soon:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.et-card-coming-soon .et-card-btn {
  background: #aaa;
  cursor: not-allowed;
}
.et-badge {
  position: absolute;
  top: 12px;
  right: -28px;
  background: #ff9500;
  color: white;
  font-size: 0.7rem;
  padding: 3px 32px;
  font-weight: 600;
  transform: rotate(35deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  letter-spacing: 1px;
  z-index: 2;
}

.et-card-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 12px;
}

.et-card-title {
  font-size: 1.25rem;
  color: #333;
  margin: 0 0 8px;
  text-align: center;
}

.et-card-desc {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
  margin: 0 0 16px;
  flex-grow: 1;
}

.et-card-price {
  background: #f0f4ff;
  color: var(--brand-strong, #5BC85A);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 16px;
  font-weight: 500;
}

.et-card-btn {
  background: linear-gradient(135deg, var(--brand, #71DC68) 0%, var(--brand-weak, #78FB60) 100%);
  color: var(--brand-ink, #14331B);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.et-card-btn:hover {
  opacity: 0.9;
}

/* Modal */
.et-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: 1000;
}
.et-modal[hidden] {
  display: none;
}

.et-modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.et-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.et-modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.et-modal-close:hover {
  color: #333;
}

.et-modal-body {
  padding: 24px;
}

.et-upload-area {
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.et-upload-area:hover,
.et-upload-area.dragover {
  border-color: var(--brand, #71DC68);
  background: #f0f4ff;
}

/* 错误提示框 */
.et-error-box {
  background: #fff3f3;
  border: 1px solid #ffcdd2;
  border-left: 4px solid #f44336;
  color: #c62828;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.et-upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.et-upload-text {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 8px;
}

.et-upload-hint {
  font-size: 0.85rem;
  color: #999;
}

.et-preview {
  position: relative;
  text-align: center;
  margin: 20px 0;
  cursor: pointer;
}

.et-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: inline-block;
}

.et-preview-tip {
  font-size: 0.78rem;
  color: #999;
  margin-top: 6px;
}

.et-rect-canvas {
  position: absolute;
  cursor: crosshair;
  border-radius: 8px;
}

/* 去水印 mask 画布 — 半透明叠加在预览图上 */
.et-mask-canvas {
  position: absolute;
  cursor: crosshair;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  pointer-events: auto;
  opacity: 0.85;
}

.et-mask-clear-btn {
  font-size: 0.8rem;
  padding: 4px 12px;
  margin-top: 4px;
}

/* checkbox 选项样式 */
.et-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand, #71DC68);
}

/* 自定义尺寸输入框 */
.et-option input[type="number"] {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  min-width: 0;
}
.et-option input[type="number"]:focus {
  outline: none;
  border-color: var(--brand, #71DC68);
}

.et-option input[type="color"] {
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
}

.et-rect-hint {
  flex: 1;
  font-size: 0.85rem;
  color: #777;
  line-height: 1.5;
}

.et-rect-status {
  font-size: 0.85rem;
  color: var(--brand-strong, #5BC85A);
  font-weight: 600;
  margin-top: 6px;
}

.et-tool-options {
  margin: 20px 0;
}

/* Bug 8: 缺失的 .et-option 样式 */
.et-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.et-option label {
  min-width: 80px;
  font-weight: 500;
  color: #555;
  padding-top: 8px;
  flex-shrink: 0;
}
.et-option select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  min-width: 0;
}
.et-option select:focus {
  outline: none;
  border-color: var(--brand, #71DC68);
}
.et-option textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-width: 0;
}
.et-option textarea:focus {
  outline: none;
  border-color: var(--brand, #71DC68);
}

/* 多张结果图列表 */
.et-result-list {
  margin-top: 12px;
}
.et-download-mini {
  margin: 4px 0;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.et-actions {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}

.et-btn-primary {
  background: linear-gradient(135deg, var(--brand, #71DC68) 0%, var(--brand-weak, #78FB60) 100%);
  color: var(--brand-ink, #14331B);
  border: none;
  padding: 12px 32px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  flex: 1;
}

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

.et-btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

.et-progress {
  margin: 20px 0;
  text-align: center;
}

.et-progress-bar {
  background: #eee;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.et-progress-fill {
  background: linear-gradient(90deg, var(--brand, #71DC68) 0%, var(--brand-weak, #78FB60) 100%);
  height: 100%;
  width: 0%;
  transition: width 0.3s;
}

.et-progress-text {
  color: #666;
  font-size: 0.9rem;
}

.et-result {
  text-align: center;
  margin: 20px 0;
}

.et-result h3 {
  color: #28a745;
  margin-bottom: 16px;
}

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

.et-download-btn {
  display: inline-block;
  background: #28a745;
  color: white;
  padding: 12px 32px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 1rem;
}

.et-download-btn:hover {
  background: #218838;
}

.et-footer {
  text-align: center;
  padding: 20px;
  background: #f8f9fa;
  color: #666;
  font-size: 0.9rem;
}

.et-footer p {
  margin: 5px 0;
}

#creditsRemaining {
  color: var(--brand-strong, #5BC85A);
  font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
  .et-hero {
    padding: 24px 14px 14px;
  }
  .et-hero h1 { font-size: 1.6rem; }
  .et-sub { font-size: 0.95rem; }
  .et-main {
    padding: 14px;
  }
  .et-category { margin-bottom: 24px; }
  .et-cat-title { font-size: 1.2rem; padding-bottom: 8px; }
  .et-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .et-card {
    padding: 18px 16px;
  }
  .et-card-icon { font-size: 2.4rem; }
  .et-card-title { font-size: 1.1rem; }
  .et-card-btn {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
  }

  /* Modal 全屏 */
  .et-modal-content {
    width: 95%;
    max-height: 95vh;
    border-radius: 12px;
  }
  .et-modal-header { padding: 14px 16px; }
  .et-modal-header h2 { font-size: 1.2rem; }
  .et-modal-close { font-size: 1.6rem; }
  .et-modal-body { padding: 16px; }

  /* upload */
  .et-upload-area { padding: 28px 14px; }
  .et-upload-icon { font-size: 2.4rem; }
  .et-upload-text { font-size: 1rem; }
  .et-preview img { max-height: 220px; }

  /* 工具选项 */
  .et-tool-options select,
  .et-tool-options input {
    width: 100%;
    min-height: 44px;
  }

  /* 按钮组 */
  .et-actions {
    flex-direction: column;
    gap: 10px;
  }
  .et-btn-primary,
  .et-btn-secondary {
    width: 100%;
    min-height: 44px;
  }
  .et-download-btn {
    width: 100%;
    min-height: 44px;
  }

  .et-result img { max-height: 300px; }
}

/* v17.0 — 佐糖余额卡片 */
.et-balance-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
}
.et-balance-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.et-balance-icon {
  font-size: 32px;
  line-height: 1;
}
.et-balance-info { flex: 1; min-width: 200px; }
.et-balance-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
}
.et-balance-numbers {
  font-size: 18px;
  color: #111827;
}
.et-balance-remaining {
  font-size: 28px;
  font-weight: 700;
  color: var(--brand-strong, #5BC85A);
}
.et-balance-total { color: #6b7280; font-size: 14px; }
.et-balance-actions button {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  min-height: 36px;
}
.et-balance-actions button:hover { background: #e5e7eb; }
.et-balance-actions button:disabled { opacity: 0.5; cursor: wait; }
.et-balance-bar {
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  margin-top: 12px;
  overflow: hidden;
}
.et-balance-bar-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 4px;
  transition: width 0.4s ease, background 0.3s ease;
  width: 0%;
}
.et-balance-foot {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}
.et-balance-alert {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.et-balance-alert-warn {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.et-balance-alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-weight: 600;
}
@media (max-width: 480px) {
  .et-balance-numbers { font-size: 16px; }
  .et-balance-remaining { font-size: 24px; }
}
