/* ============================================================
   COMPONENT: Listing Detail and Responsive Layout
   ============================================================ */
/* ============================================================
   COMPONENT: Detail Sidebar Skeleton
   ============================================================ */
.sidebar-skeleton {
  display: grid;
  gap: 10px;
}

.sidebar-skeleton-title {
  height: 14px;
  width: 50%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-surface-muted) 25%, var(--bg-surface-hover) 50%, var(--bg-surface-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 4px;
}

.sidebar-skeleton-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
}

.sidebar-skeleton-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--bg-surface-muted) 25%, var(--bg-surface-hover) 50%, var(--bg-surface-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  flex-shrink: 0;
}

.sidebar-skeleton-text {
  height: 14px;
  width: 70%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-surface-muted) 25%, var(--bg-surface-hover) 50%, var(--bg-surface-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.sidebar-skeleton-button {
  height: 36px;
  width: 100%;
  border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--bg-surface-muted) 25%, var(--bg-surface-hover) 50%, var(--bg-surface-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ============================================================
   COMPONENT: Listing Detail Layout (Left-wide Right-narrow)
   ============================================================ */
.listing-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr);
  gap: var(--space-3);
  align-items: start;
}

.listing-detail-main {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.listing-detail-sidebar {
  position: sticky;
  top: var(--space-2);
  display: grid;
  gap: var(--space-2);
  align-self: start;
}

/* Status Checklist */
.status-checklist {
  display: grid;
  gap: 10px;
  padding: var(--space-2);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
}

.status-checklist-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.status-checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-subtle);
  transition: border-color 140ms, background 140ms;
}

.status-checklist-item.pass { border-color: rgba(34, 197, 94, 0.2); }
.status-checklist-item.warn { border-color: rgba(245, 158, 11, 0.25); background: var(--warning-soft); }
.status-checklist-item.block { border-color: rgba(239, 68, 68, 0.25); background: var(--danger-soft); }

.status-checklist-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.status-checklist-dot.pass { background: var(--success); color: var(--success); }
.status-checklist-dot.warn { background: var(--warning); color: var(--warning); }
.status-checklist-dot.block { background: var(--danger); color: var(--danger); }

.status-checklist-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.status-checklist-text.pass { color: var(--success); }
.status-checklist-text.warn { color: var(--warning); }
.status-checklist-text.block { color: var(--danger); }

.status-checklist-detail {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

/* Action Panel */
.action-panel {
  display: grid;
  gap: 10px;
  padding: var(--space-2);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
}

.action-panel-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.action-panel .button { width: 100%; justify-content: center; }

/* Staging Basket (Floating Bottom Bar) */
.staging-basket {
  position: fixed;
  bottom: var(--space-2);
  left: calc(var(--sidebar-width) + var(--space-3) * 2);
  right: var(--space-3);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px var(--space-2);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.staging-basket-count {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.staging-basket-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.staging-basket-empty {
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================================
   Image grid within detail
   ============================================================ */
.detail-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.detail-image-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-default);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; padding: var(--space-2); gap: var(--space-2); }
  .menu-toggle { display: grid; }
  .topbar, .topbar.topbar-compact { justify-content: space-between; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(82vw, 280px); height: 100vh; border-radius: 0 var(--radius) var(--radius) 0; z-index: 50; transform: translateX(-100%); transition: transform 250ms; }
  .sidebar.open { transform: translateX(0); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-flow { grid-template-columns: 1fr; gap: 8px; }
  .pipeline-arrow { transform: rotate(90deg); }
  .detail-grid, .review-action-grid { grid-template-columns: 1fr; }
  .listing-detail-layout { grid-template-columns: 1fr; }
  .listing-detail-sidebar { position: static; }
  .workspace-shell { grid-template-columns: 1fr; }
  .workspace-side { position: static; }
  .workspace-product { grid-template-columns: 1fr; }
  .staging-basket { left: var(--space-2); }
}

@media (max-width: 640px) {
  .metric-grid { grid-template-columns: 1fr; }
  .workspace-kv-grid,
  .workspace-form-grid,
  .workspace-ai-cost { grid-template-columns: 1fr; }
  .workspace-section-header { align-items: flex-start; flex-direction: column; }
  .workspace-section-header .button { width: 100%; justify-content: center; }
  .workspace-product-copy h2 { font-size: 20px; line-height: 1.3; }
  .workspace-status-strip { align-items: flex-start; flex-direction: column; }
  .workspace-labeled-badge { justify-content: space-between; width: 100%; }
  .workspace-check-row { align-items: flex-start; flex-direction: column; }
  .workspace-button-row .button { flex: 1 1 140px; justify-content: center; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-header h1 { font-size: 28px; line-height: 34px; }
  .topbar { flex-wrap: wrap; padding: 10px 12px; }
  .global-search { order: 3; width: 100%; max-width: none; }
  .table-shell { overflow-x: auto; }
  .product-card-grid { grid-template-columns: 1fr; }
  .opportunity-board-header { align-items: flex-start; flex-direction: column; }
  .opportunity-pool-head { flex-direction: column; }
  .opportunity-pool-item { grid-template-columns: 1fr 72px; }
  .opportunity-pool-item span:nth-child(3),
  .opportunity-pool-item span:nth-child(4) { grid-column: 1 / -1; }
}
