/* proposals.css — Photo upload step and vertical proposals list */

/* ── Step 2: Photo upload ─────────────────────────────────────── */

.photo-upload-header {
  margin-bottom: 1.5rem;
}

.photo-upload-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
}


.photo-drop-wrap {
  width: 100%;
  flex: 1;
  min-height: 0;
  cursor: pointer;
  position: relative;
}

.drop-zone--photo {
  position: absolute;
  inset: 0;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 2px dashed var(--border, #cbd5e1);
  border-radius: 1rem;
  padding: 2rem;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone--photo:hover,
.drop-zone--photo.dragover {
  border-color: var(--accent);
  background: var(--accent-bg, rgba(45, 122, 79, 0.04));
}

.drop-zone--photo.has-file {
  padding: 0;
  cursor: zoom-in;
}

.drop-zone--photo .preview {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 0.75rem;
}

.drop-zone--photo.has-file .drop-icon,
.drop-zone--photo.has-file .drop-hint { display: none; }
.drop-zone--photo.has-file .preview   { display: block; }

.photo-remove-btn {
  display: none;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.45);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10;
  transition: background 0.15s;
}
.photo-remove-btn svg { width: 14px; height: 14px; }
.photo-remove-btn:hover { background: rgba(220,38,38,0.85); }
.drop-zone--photo.has-file .photo-remove-btn { display: flex; }

.photo-upload-hint {
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
  text-align: center;
}

/* Toggles */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  align-self: flex-start;
}

.toggle-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--text-muted, #64748b);
  user-select: none;
}

/* ── Per-row pipeline stepper (shown while rendering) ─────────── */

/* Row state while render is in progress */
.proposal-row--rendering {
  border-color: var(--accent);
}

.proposal-row--rendering .proposal-row-render {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1.5rem;
  background: var(--bg-muted, #f8fafc);
}

/* The pipeline dots strip */
.proposal-pipeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  max-width: 480px;
}

.proposal-pipeline-dots {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  justify-content: center;
}

.ps-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border, #cbd5e1);
  background: #fff;
  flex-shrink: 0;
  transition: background 0.25s, border-color 0.25s;
}

.ps-dot.done {
  background: var(--success, #16a34a);
  border-color: var(--success, #16a34a);
}

.ps-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
  animation: ps-pulse 1.4s ease-in-out infinite;
}

@keyframes ps-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(37,99,235,0.18); }
  50%       { box-shadow: 0 0 0 6px rgba(37,99,235,0.08); }
}

.ps-connector {
  flex: 1;
  height: 2px;
  background: var(--border, #e2e8f0);
  min-width: 1rem;
  max-width: 3rem;
}

.proposal-pipeline-label {
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
  text-align: center;
}

.proposal-row-timer {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.02em;
}

.proposal-render-duration {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  text-align: center;
  padding: 0.25rem 0;
}


/* ── Step 3: Proposals list ────────────────────────────────────── */

.proposals-header {
  margin-bottom: 1rem;
}

/* Progress */
#proposalsProgressWrap {
  margin-bottom: 1.5rem;
}

.proposals-progress {
  position: relative;
  height: 6px;
  background: var(--border, #e2e8f0);
  border-radius: 999px;
  overflow: hidden;
}

.proposals-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.proposals-progress-label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
}

.proposals-all-done {
  font-size: 0.9rem;
  color: var(--success, #16a34a);
  font-weight: 500;
  margin: 0;
}

/* List */
.proposals-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Skeleton */
.proposal-row--skeleton {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 1rem;
  background: var(--card-bg, #fff);
}

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-block {
  border-radius: 0.75rem;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
}

.proposal-row--skeleton .proposal-row-render.skeleton-block {
  aspect-ratio: 16/10;
}

.skeleton-article {
  height: 72px;
  margin-bottom: 0.75rem;
}

/* Real rows */
.proposal-row {
  position: relative;
  border: 2px solid var(--border, #e2e8f0);
  border-radius: 1rem;
  background: var(--card-bg, #fff);
  overflow: hidden;
  transition: border-color 0.2s;
}

.proposal-row:hover {
  border-color: var(--accent);
}

.proposal-row-number {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* Horizontal body: render image left, articles right */
.proposal-row-body {
  display: flex;
  height: 350px;
  overflow: hidden;
}

.proposal-row-render {
  flex: 1.4;
  min-width: 0;
  min-height: 0;
  background: var(--bg-muted, #f1f5f9);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* When render is done, let the result card fill the area */
.proposal-row-render--done {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  min-height: unset;
  align-self: stretch;
}

/* Sidebar: articles stacked vertically on the right */
.proposal-row-sidebar {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-left: 1px solid var(--border, #e2e8f0);
  overflow-y: auto;
}

/* Strip card chrome so it sits flush inside the row */
.proposal-result-card {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transform: none !important;
  transition: none !important;
  animation: none !important;
  position: relative;
}

/* In proposal context, hide title and download button; keep compare + mask buttons */
.proposal-result-card .result-card-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.75rem;
  border-top: none;
  background: transparent;
}

.proposal-result-card .result-card-footer .btn-sm {
  background: #fff;
  border-color: var(--border, #e2e8f0);
  color: var(--text, #1e293b);
}

.proposal-result-card .result-card-footer .btn-sm:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.proposal-result-card .result-card-footer .btn-sm.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.proposal-result-card .result-card-title-wrap {
  display: none;
}
.proposal-result-card .result-card-actions a.btn-sm {
  display: none;
}

.proposal-result-card .result-card-img-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.proposal-result-card .result-card-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #fff;
  aspect-ratio: unset;
  transform: none !important;
  cursor: zoom-in;
}

/* Variant tab bar (open / dicht) */
.proposal-variant-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0;
  background: var(--bg-muted, #f8fafc);
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.proposal-variant-tab {
  padding: 0.35rem 1rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.4rem;
  background: var(--card-bg, #fff);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.proposal-variant-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.proposal-variant-cards {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.proposal-variant-cards .proposal-result-card.hidden {
  display: none;
}

/* Spinner placeholder */
.render-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
}

.render-placeholder--error { color: var(--error, #dc2626); }

.render-placeholder .spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border, #e2e8f0);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* @keyframes spin defined in base.css */

/* Article cards (inside sidebar) */
.proposal-article-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.6rem;
  background: var(--bg-muted, #f8fafc);
}

.article-thumbs {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.article-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 0.35rem;
  flex-shrink: 0;
  background: var(--border, #e2e8f0);
}

.article-thumb--clickable {
  cursor: zoom-in;
  transition: outline 0.15s, transform 0.15s;
}
.article-thumb--clickable:hover {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  transform: scale(1.06);
}

.article-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.article-category {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.article-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-code {
  font-size: 12px;
  font-family: monospace;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.article-code-copy {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 1px 2px;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  border-radius: 3px;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.article-code-copy:hover { opacity: 1; color: var(--accent); }
.article-code-copy.copied { opacity: 1; color: var(--accent); }

.article-brand {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

.article-colours {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.colour-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}

.article-source-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 0.2rem;
}

.article-source-link:hover { text-decoration: underline; }

.article-price-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  align-self: flex-end;
  flex-shrink: 0;
}

.article-price {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.article-price-per-m2 {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
}

.article-price-link {
  color: inherit;
  text-decoration: none;
}
.article-price-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* Row footer */
.proposal-row-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--border, #e2e8f0);
  background: var(--bg-muted, #f8fafc);
}

.proposal-row-total {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #1e293b);
}

.proposal-choose-btn {
  padding: 0.55rem 1.4rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
}

.proposal-choose-btn:hover {
  background: var(--accent-hover, #1d4ed8);
}

/* ── Combination preview (no render queued yet) ───────────────── */

.proposal-row--preview .proposal-preview-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 1rem 1.5rem 0.75rem 3rem; /* left indent clears the number badge */
}

.proposal-preview-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.proposal-refresh-btn {
  padding: 0.55rem 1.2rem;
  border: 1.5px solid var(--accent);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.proposal-refresh-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Proposal detail (kept in DOM but hidden in new flow) ─────── */
.proposal-detail-header,
.proposal-detail-body,
.proposal-detail-actions { display: none; }

@media (max-width: 768px) {
  .proposal-row-body {
    flex-direction: column;
    height: auto;
  }
  .proposal-row-render {
    min-height: 220px;
  }
  .proposal-row-sidebar {
    border-left: none;
    border-top: 1px solid var(--border, #e2e8f0);
  }
}
