/* ch_support_ticket_list_html (theme/assets/request_services/ch_support_ticket_list_html.css).
 *
 * Linked from head_html, so the designer canvas is styled too. Every rule is scoped
 * :where(.ch-ticket-list-container), which adds no specificity; the root rule itself stays bare.
 * Section-wide: .ch-badge is scoped :where(.ch-services-container), because it is the only
 *   badge rule with line-height: 1.4 and also sets the ticket detail's status badge.
 * Keyframes are rs-tl-* (keyframe names are global across the page).
 * The empty-state icon is a span around the <svg> (the designer cannot set a class on an <svg>);
 *   the tl-hidden classes are compound, because two of those blocks set display: flex
 *   themselves; the module's inline display still wins over both.
 */

.ch-ticket-list-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 0;
}

/* Ticket row */
:where(.ch-ticket-list-container) .ch-ticket-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ch-border);
  cursor: pointer;
  transition: background-color var(--ch-transition-fast);
}

:where(.ch-ticket-list-container) .ch-ticket-row:hover {
  background: var(--ch-bg-secondary);
}

:where(.ch-ticket-list-container) .ch-ticket-row.selected {
  background: var(--ch-accent-secondary);
  border-left: 3px solid var(--ch-accent-primary);
}

:where(.ch-ticket-list-container) .ch-ticket-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

:where(.ch-ticket-list-container) .ch-ticket-id {
  font-size: 12px;
  color: var(--ch-text-muted);
  font-family: monospace;
}

:where(.ch-ticket-list-container) .ch-ticket-subject {
  font-size: 14px;
  font-weight: 500;
  color: var(--ch-text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Status badges */
:where(.ch-services-container) .ch-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

:where(.ch-ticket-list-container) .ch-badge-open {
  background: #dbeafe;
  color: #1d4ed8;
}

:where(.ch-ticket-list-container) .ch-badge-awaiting {
  background: #fef3c7;
  color: #b45309;
}

:where(.ch-ticket-list-container) .ch-badge-resolved {
  background: #e5e7eb;
  color: #4b5563;
}

/* Type badges */
:where(.ch-ticket-list-container) .ch-badge-returns { background: #dbeafe; color: #1d4ed8; }
:where(.ch-ticket-list-container) .ch-badge-complaint { background: #fee2e2; color: #dc2626; }
:where(.ch-ticket-list-container) .ch-badge-tray-change { background: #ffedd5; color: #c2410c; }
:where(.ch-ticket-list-container) .ch-badge-feedback { background: #dcfce7; color: #16a34a; }
:where(.ch-ticket-list-container) .ch-badge-interim { background: #ccfbf1; color: #0d9488; }
:where(.ch-ticket-list-container) .ch-badge-support { background: #f3e8ff; color: #7c3aed; }
:where(.ch-ticket-list-container) .ch-badge-unassigned { background: #fef9c3; color: #a16207; }

:where(.ch-ticket-list-container) .ch-assign-select {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  margin-left: auto;
}
:where(.ch-ticket-list-container) .ch-assign-select:hover { border-color: #a16207; }

:where(.ch-ticket-list-container) .ch-ticket-row-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

:where(.ch-ticket-list-container) .ch-ticket-home {
  font-size: 12px;
  color: var(--ch-text-muted);
}

:where(.ch-ticket-list-container) .ch-ticket-requester {
  color: #666;
  font-size: 0.82rem;
}

:where(.ch-ticket-list-container) .ch-ticket-dates {
  font-size: 11px;
  color: var(--ch-text-muted);
  margin-left: auto;
}

/* Skeleton loading */
:where(.ch-ticket-list-container) .ch-skeleton-list {
  padding: 12px 16px;
}

:where(.ch-ticket-list-container) .ch-skeleton-row {
  height: 56px;
  background: linear-gradient(90deg, var(--ch-bg-secondary) 25%, var(--ch-bg-card) 50%, var(--ch-bg-secondary) 75%);
  background-size: 200% 100%;
  animation: rs-tl-skel-shimmer 1.5s infinite;
  border-radius: var(--ch-radius-md);
  margin-bottom: 8px;
}

@keyframes rs-tl-skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty state */
:where(.ch-ticket-list-container) .ch-ticket-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}

:where(.ch-ticket-list-container) .ch-ticket-empty-icon {
  width: 48px;
  height: 48px;
  color: var(--ch-text-muted);
  opacity: 0.5;
  line-height: 0;
}

:where(.ch-ticket-list-container) .ch-ticket-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ch-text-primary);
}

:where(.ch-ticket-list-container) .ch-ticket-empty-text {
  font-size: 14px;
  color: var(--ch-text-muted);
}

:where(.ch-ticket-list-container) .ch-ticket-empty-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  background: var(--ch-accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--ch-radius-md);
  cursor: pointer;
  margin-top: 8px;
  transition: opacity var(--ch-transition-fast);
  min-height: 40px;
}

:where(.ch-ticket-list-container) .ch-ticket-empty-btn:hover {
  opacity: 0.9;
}

/* Info banner */
:where(.ch-ticket-list-container) .ch-ticket-banner {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ch-info);
  background: var(--ch-info-bg);
  border-bottom: 1px solid var(--ch-info-border);
}

/* Infinite scroll sentinel */
:where(.ch-ticket-list-container) .ch-scroll-sentinel {
  height: 1px;
  width: 100%;
}

:where(.ch-ticket-list-container) .ch-load-more-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

:where(.ch-ticket-list-container) .ch-load-more-spinner .ch-mini-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--ch-border);
  border-top-color: var(--ch-accent-primary);
  border-radius: 50%;
  animation: rs-tl-skel-shimmer-spin 0.8s linear infinite;
}

@keyframes rs-tl-skel-shimmer-spin {
  to { transform: rotate(360deg); }
}

:where(.ch-ticket-list-container) .ch-ticket-empty-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

:where(.ch-ticket-list-container) .ch-ticket-banner.tl-hidden,
:where(.ch-ticket-list-container) .ch-ticket-empty.tl-hidden,
:where(.ch-ticket-list-container) .ch-ticket-empty-btn.tl-hidden,
:where(.ch-ticket-list-container) .ch-load-more-spinner.tl-hidden {
  display: none;
}
