/* ── Case List View ──────────────────────── */
.case-list-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn 0.4s ease;
}

.case-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.case-list-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* ── Filter Tabs ──────────────────────────── */
.case-filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--chip-bg);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.case-filter-tab {
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition);
}

.case-filter-tab:hover {
  color: var(--text);
}

.case-filter-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.case-filter-tab--active {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ── Cards Container ──────────────────────── */
.case-cards-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Case Card ────────────────────────────── */
.case-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  outline: none;
}

.case-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.case-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 59, 130, 246), 0.25);
  transform: translateY(-1px);
}

.case-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.case-card__icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.case-card__title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-card__badge {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Badge Color Variants ─────────────────── */
.case-card__badge--intake     { background: #f0eee8; color: var(--text-muted); }
.case-card__badge--matching   { background: #fef3cd; color: #856404; }
.case-card__badge--outreach   { background: #d1ecf1; color: #0c5460; }
.case-card__badge--accepted   { background: var(--success-light); color: var(--success-dark); }
.case-card__badge--scoping    { background: #e0f2f1; color: #00695c; }
.case-card__badge--quoting    { background: #ede7f6; color: #4527a0; }
.case-card__badge--payment    { background: var(--warning-light); color: #e65100; }
.case-card__badge--scheduled  { background: #e3f2fd; color: #1565c0; }
.case-card__badge--in_service { background: var(--success-light); color: var(--success-dark); }
.case-card__badge--completed  { background: var(--success-light); color: var(--success-dark); }
.case-card__badge--cancelled  { background: var(--danger-light); color: var(--danger-dark); }
.case-card__badge--disputed   { background: var(--danger-light); color: var(--danger-dark); }

/* ── Meta Line ────────────────────────────── */
.case-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.case-card__sep {
  color: var(--border);
}

/* ── Progress Bar ─────────────────────────── */
.case-card__progress {
  height: 4px;
  background: var(--bg-muted);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.case-card__progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Summary / Provider ───────────────────── */
.case-card__summary {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.4;
}

.case-card__summary strong {
  color: var(--text);
}

/* ── New Request Button ───────────────────── */
.case-list-new-btn {
  margin-top: 16px;
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  align-self: center;
}

.case-list-new-btn:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.case-list-new-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Empty State ──────────────────────────── */
.case-list-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Loading Skeleton ────────────────────── */
.case-list-loading {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.case-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.case-skeleton__card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 88px;
  position: relative;
  overflow: hidden;
}

.case-skeleton__card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.04) 50%,
    transparent 100%
  );
  animation: skeletonShimmer 1.5s ease infinite;
}

@keyframes skeletonShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Error State ─────────────────────────── */
.case-list-error {
  text-align: center;
  padding: 32px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.case-list-error__icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.case-list-error__text {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

.case-list-retry-btn {
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.case-list-retry-btn:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.case-list-retry-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Resume Overlay ──────────────────────── */
.case-resume-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.case-resume-overlay__content {
  text-align: center;
}

.case-resume-overlay__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.case-resume-overlay__text {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Back to Cases Link (in cbar) ─────────── */
.cbar__back-link {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  margin-right: 8px;
  flex-shrink: 0;
}

.cbar__back-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.cbar__back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Card Footer (providers + activity + unread) ── */
.case-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
}

.case-card__providers {
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.case-card__footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.case-card__activity {
  color: var(--text-muted);
  font-size: 11px;
}

.case-card__unread {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ── Timeline View (in messages area) ──────── */
.case-timeline-view {
  padding: 12px 0;
}

.timeline-date-group {
  margin-bottom: 16px;
}

.timeline-date-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 4px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.timeline-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}

.timeline-event__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--chip-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

.timeline-event__content {
  flex: 1;
  min-width: 0;
}

.timeline-event__title {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  display: block;
}

.timeline-event__detail {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  display: block;
  margin-top: 2px;
}

.timeline-event__time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Provider Contact Bar (from resume) ──── */
.pcb-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.pcb-avatar-initials {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.pcb-info {
  flex: 1;
  min-width: 0;
}

.pcb-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pcb-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pcb-unread {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 600px) {
  .case-list-view {
    padding: 12px;
  }

  .case-list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .case-card {
    padding: 12px;
  }

  .case-card__title {
    font-size: 14px;
  }
}
