/* ====== 画廊 / 批量 / 详情专用样式 ====== */

/* ---------- 1. Mode Toggle ---------- */
.mode-toggle {
  display: flex;
  flex-direction: row;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  width: fit-content;
}

.mode-toggle-btn {
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mode-toggle-btn:first-child {
  border-right: 1px solid var(--color-border);
}

.mode-toggle-btn.active {
  background: var(--color-primary);
  color: #fff;
}

/* ---------- 2. Batch Queue ---------- */
.batch-queue {
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
  overflow-x: auto;
  overflow-y: hidden;
  padding: var(--space-xs) 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.batch-queue::-webkit-scrollbar {
  height: 4px;
}

.batch-queue::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.batch-thumb {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: var(--space-sm);
  border: 2px solid var(--color-border);
  object-fit: cover;
  flex-shrink: 0;
  transition: border-color var(--transition-fast);
  cursor: pointer;
}

.batch-thumb:hover {
  border-color: var(--color-primary);
}

/* ---------- 3. Batch List ---------- */
.batch-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.batch-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--space-md);
  background: var(--color-surface);
  transition: box-shadow var(--transition-fast);
}

.batch-item:hover {
  box-shadow: var(--shadow-hover);
}

.batch-item-thumb {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: var(--space-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.batch-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.batch-item-name {
  font-size: 0.7rem;
  font-family: var(--font-body);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.batch-item-styles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* ---------- 4. Style Chips ---------- */
.batch-style-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.6rem;
  font-family: var(--font-body);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.batch-style-chip:hover {
  border-color: var(--color-primary);
}

.batch-style-chip.selected {
  border-color: var(--color-primary);
  background: #fff8f0;
  color: var(--color-primary-dark);
}

/* ---------- 5. Batch Progress Grid ---------- */
.batch-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: var(--space-sm);
}

.batch-progress-thumb {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--space-sm);
  object-fit: cover;
  position: relative;
  overflow: hidden;
}

/* done — success color border */
.batch-progress-thumb.done {
  border: 2px solid var(--color-success);
  opacity: 1;
}

/* processing — primary color border with pulse animation */
.batch-progress-thumb.processing {
  border: 2px solid var(--color-primary);
  animation: pulse 1.5s ease-in-out infinite;
}

/* pending — dashed border, reduced opacity */
.batch-progress-thumb.pending {
  border: 2px dashed var(--color-border);
  opacity: 0.5;
}

/* failed — error color border */
.batch-progress-thumb.failed {
  border: 2px solid var(--color-error-border);
  opacity: 1;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* ---------- 6. Gallery Header ---------- */
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  gap: var(--space-md);
}

.gallery-title {
  font-size: 1.1rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.gallery-subtitle {
  font-size: 0.75rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  margin: 0;
}

.gallery-actions {
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.gallery-actions button,
.gallery-actions .btn-action {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.75rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.gallery-actions button:hover,
.gallery-actions .btn-action:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ---------- 7. Gallery Grid ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gallery-card {
  border-radius: var(--space-md);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: 0 2px 8px rgba(200, 150, 80, 0.1);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.gallery-card-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

.gallery-card-name {
  font-size: 0.6rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: var(--space-xs) var(--space-sm);
}

/* ---------- 8. Detail Navigation ---------- */
.detail-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.7rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  padding: var(--space-sm) 0;
}

.detail-back {
  color: var(--color-primary);
  cursor: pointer;
  font-weight: 500;
  background: none;
  border: none;
  padding: var(--space-xs) 0;
  font-size: inherit;
  font-family: inherit;
  white-space: nowrap;
  transition: color var(--transition-fast);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.detail-back:hover {
  color: var(--color-primary-dark);
}

.detail-separator {
  color: var(--color-border);
  user-select: none;
}

.detail-position {
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* ---------- 9. Detail Prev/Next ---------- */
.detail-prev-next {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
}

.detail-prev-next button {
  padding: var(--space-xs) var(--space-lg);
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.detail-prev-next button:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.detail-prev-next button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.detail-counter {
  font-size: 0.75rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  text-align: center;
  white-space: nowrap;
}

/* ---------- 10. Batch Actions / Stats ---------- */
.batch-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
}

.batch-stats {
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  text-align: center;
}

.batch-stats .count {
  font-weight: 600;
  color: var(--color-primary);
}

.batch-item-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.batch-item-remove:hover {
  color: var(--color-error-border);
  border-color: var(--color-error-border);
  background: var(--color-error-bg);
}

/* ---------- 11. Responsive: max-width 400px ---------- */
@media (max-width: 400px) {
  .gallery-grid {
    gap: 6px;
  }

  .gallery-card-name {
    font-size: 0.55rem;
  }

  .mode-toggle {
    max-width: 100%;
  }

  .mode-toggle-btn {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.7rem;
  }

  .batch-item {
    padding: var(--space-sm);
  }

  .batch-item-thumb {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .batch-thumb {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
}
