/* Shared styles for test pages (CM-159) */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px; background: #f5f5f5; }

/* Environment banner */
.env-banner { padding: 6px 12px; text-align: center; font-weight: 600; font-size: 0.85rem; color: white; border-radius: 6px; margin-bottom: 12px; }
.env-banner.test { background: #f59e0b; }
.env-banner.prod { background: #ef4444; }
h1 { margin-bottom: 20px; }
h2 { margin-bottom: 12px; }

/* Back link */
.back-link { display: inline-block; margin-bottom: 12px; font-size: 13px; color: #2563eb; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* Section cards */
.section { background: white; border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Form elements */
label { display: block; font-weight: 600; margin-bottom: 4px; }
textarea, input, select { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; font-family: inherit; margin-bottom: 12px; }
textarea { height: 80px; resize: vertical; }
input[type="file"] { padding: 6px; }
input[type="checkbox"] { width: auto; margin: 0; }
input:disabled, select:disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }

/* Buttons */
button { padding: 10px 20px; background: #2563eb; color: white; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; margin-right: 8px; margin-bottom: 8px; }
button:disabled { background: #94a3b8; cursor: not-allowed; }
button:hover:not(:disabled) { background: #1d4ed8; }
button.secondary { background: #059669; }
button.secondary:hover:not(:disabled) { background: #047857; }
button.danger { background: #dc2626; }
button.danger:hover:not(:disabled) { background: #b91c1c; }
button.small { padding: 4px 10px; font-size: 12px; margin: 4px 2px 0; }

/* Progress bar */
.progress { margin-top: 12px; }
.progress-bar { height: 24px; background: #e5e7eb; border-radius: 12px; overflow: hidden; }
.progress-fill { height: 100%; background: #2563eb; transition: width 0.3s; border-radius: 12px; }
.progress-text { text-align: center; margin-top: 4px; font-size: 13px; color: #64748b; }

/* Work items grid */
.work-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.work-item { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px; text-align: center; min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.work-item.completed { border-color: #22c55e; }
.work-item.failed { border-color: #ef4444; background: #fef2f2; }
.work-item.generating, .work-item.processing, .work-item.uploading { border-color: #eab308; }
.work-item img { max-width: 100%; border-radius: 4px; margin-top: 4px; }
.work-item .status { font-size: 12px; color: #64748b; }
.work-item .error { font-size: 11px; color: #ef4444; }
.work-item .work-item-checkbox { margin-bottom: 4px; }

/* Log panel */
.log { font-size: 12px; color: #334155; background: #f1f5f9; padding: 8px; border-radius: 4px; margin-top: 8px; max-height: 200px; overflow-y: auto; white-space: pre-wrap; font-family: monospace; }

/* Mockup section */
.mockup-section { margin-top: 12px; padding: 12px; background: #faf5ff; border-radius: 6px; border: 1px solid #e9d5ff; }
.mockup-section h3 { margin-bottom: 8px; font-size: 14px; }
.mockup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.mockup-grid img { width: 100%; border-radius: 4px; }
.mockup-grid .mockup-item { text-align: center; }
.mockup-label { font-size: 12px; color: #64748b; margin-top: 4px; }
.mockup-loading { font-size: 13px; color: #7c3aed; }
.mockup-error { font-size: 13px; color: #ef4444; }

/* Field validation warnings */
.field-warning { font-size: 12px; color: #ef4444; margin-top: 2px; margin-bottom: 8px; }

/* Checkbox labels */
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* Upload status */
.upload-status { font-size: 13px; color: #64748b; margin-bottom: 12px; }
.upload-status.success { color: #16a34a; }
.upload-status.error { color: #ef4444; }
.preview-img { max-width: 200px; max-height: 200px; border-radius: 8px; margin-bottom: 12px; border: 1px solid #e5e7eb; }

/* Upload progress bar */
.upload-progress { margin-bottom: 12px; }
.upload-progress-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: #7c3aed; transition: width 0.2s; border-radius: 4px; }
.upload-progress-text { font-size: 12px; color: #7c3aed; margin-top: 2px; }

/* Fantasy league-specific */
.league-info { font-size: 14px; color: #334155; margin-bottom: 12px; padding: 10px; background: #f0fdf4; border-radius: 6px; border: 1px solid #bbf7d0; }
.order-summary { padding: 12px; background: #eff6ff; border-radius: 6px; border: 1px solid #bfdbfe; margin-top: 12px; }

/* Retry bar */
.retry-bar { margin-top: 12px; padding: 10px; background: #fef2f2; border-radius: 6px; border: 1px solid #fecaca; display: flex; align-items: center; gap: 12px; }
.retry-bar span { font-size: 13px; color: #dc2626; }

/* Quantity selector (CM-121) */
.quantity-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.quantity-row label { margin: 0; white-space: nowrap; }
.quantity-stepper { display: inline-flex; align-items: center; border: 1px solid #ccc; border-radius: 6px; overflow: hidden; }
.quantity-stepper button { width: 36px; height: 36px; padding: 0; margin: 0; border: none; border-radius: 0; background: #f1f5f9; color: #334155; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.quantity-stepper button:hover:not(:disabled) { background: #e2e8f0; }
.quantity-stepper button:disabled { color: #cbd5e1; cursor: not-allowed; }
.quantity-stepper .qty-value { width: 40px; text-align: center; font-size: 16px; font-weight: 600; border-left: 1px solid #ccc; border-right: 1px solid #ccc; line-height: 36px; }

/* Price breakdown (CM-121) */
.price-breakdown { font-size: 14px; color: #334155; margin-bottom: 12px; line-height: 1.6; }
.price-breakdown .price-total { font-weight: 700; font-size: 16px; border-top: 1px solid #e5e7eb; padding-top: 4px; margin-top: 4px; }

/* Order section (CM-121) */
.order-section { margin-top: 12px; padding: 16px; background: #eff6ff; border-radius: 8px; border: 1px solid #bfdbfe; }

/* Mockup lightbox modal */
.mockup-lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.mockup-lightbox {
  background: white; border-radius: 12px; padding: 24px; max-width: 90vw; max-height: 90vh;
  overflow-y: auto; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.mockup-lightbox h3 { margin-bottom: 16px; font-size: 18px; }
.mockup-lightbox-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  border: none; background: #f1f5f9; border-radius: 50%; font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #475569; margin: 0; padding: 0;
}
.mockup-lightbox-close:hover { background: #e2e8f0; }
.mockup-lightbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
  justify-content: center; max-width: 720px; margin: 0 auto;
}
.mockup-lightbox-grid .mockup-item { text-align: center; }
.mockup-lightbox-grid .mockup-item a { display: block; }
.mockup-lightbox-grid .mockup-item img {
  width: 100%; height: auto; max-height: 260px; object-fit: contain;
  border-radius: 8px; cursor: zoom-in; transition: transform 0.15s ease;
}
.mockup-lightbox-grid .mockup-item img:hover { transform: scale(1.03); }
.mockup-lightbox-grid .mockup-label { font-size: 13px; color: #64748b; margin-top: 6px; }
.mockup-lightbox-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 48px 24px; color: #64748b; font-size: 14px;
}
.mockup-lightbox-progress-track {
  width: 240px; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden;
}
.mockup-lightbox-progress-fill {
  height: 100%; width: 0%; background: #7c3aed; border-radius: 4px;
  transition: width 0.5s ease;
}
.mockup-spinner-placeholder {
  width: 100%; aspect-ratio: 1; background: #f1f5f9; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.mockup-spinner {
  width: 28px; height: 28px;
  border: 3px solid #e2e8f0; border-top-color: #7c3aed;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mockup lightbox mobile (CM-312) */
@media (max-width: 600px) {
  .mockup-lightbox {
    max-width: 100vw; max-height: 100vh; border-radius: 0;
    padding: 16px; padding-top: 56px;
  }
  .mockup-lightbox-close {
    position: fixed; top: 12px; right: 12px; z-index: 1001;
    width: 44px; height: 44px; font-size: 22px;
    background: rgba(0,0,0,0.6); color: white;
  }
  .mockup-lightbox-close:hover { background: rgba(0,0,0,0.8); }
  .mockup-lightbox-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}

/* Size guide (CM-191) */
.size-guide { margin-bottom: 12px; }
.size-guide-toggle { background: none; border: 1px solid #2563eb; color: #2563eb; padding: 6px 12px; border-radius: 4px; font-size: 13px; cursor: pointer; margin-bottom: 8px; }
.size-guide-toggle:hover { background: #eff6ff; }
.size-guide-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 6px; }
.size-guide-table th { background: #f1f5f9; text-align: left; padding: 6px 10px; border-bottom: 2px solid #e2e8f0; font-weight: 600; }
.size-guide-table td { padding: 6px 10px; border-bottom: 1px solid #e5e7eb; }
.size-guide-table tr.size-guide-selected { background: #eff6ff; font-weight: 600; }
.size-guide-meta { font-size: 12px; color: #64748b; margin-bottom: 8px; }

/* Per-item quantity stepper in work item grid (CM-152) */
.work-item-qty { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.work-item-qty .qty-btn { width: 28px; height: 28px; padding: 0; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.work-item-qty .qty-value { min-width: 24px; text-align: center; font-weight: 600; font-size: 14px; }
