/* ============================================================
   DAWNFALL — Ticket conversation view
   ============================================================ */

/* ── State pages (loading / error) ──────────────────────── */

.tk-state-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: 1;
  min-height: 300px;
  color: var(--text-muted);
}

.tk-error-state svg {
  color: var(--text-muted);
}

.tk-error-text {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

/* ── Content wrapper ────────────────────────────────────── */

.tk-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: fadeUp 0.4s ease both;
}

/* ── Meta row (badges + date) ───────────────────────────── */

.tk-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.tk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background-color: #fff;
  color: #000;
  border: none;
}

/* Status badges */
.tk-badge--open        { background-image: var(--purple-gradient); }
.tk-badge--in_progress { background-image: var(--gold-gradient); }
.tk-badge--resolved    { background-image: var(--green-gradient); }
.tk-badge--closed      { background-image: var(--gray-gradient); }

/* Type badges */
.tk-badge--contact { background-image: var(--brand-gradient); }
.tk-badge--bug     { background-image: var(--red-gradient); }

.tk-meta-date {
  font-size: 12px;
  color: var(--text);
  margin-left: auto;
}

/* ── Thread ─────────────────────────────────────────────── */

.tk-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Message card ───────────────────────────────────────── */

.tk-msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: border-color var(--dur-fast);
}

.tk-msg--support {
  border-left: 3px solid var(--brand-2);
}

.tk-msg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}

.tk-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-white);
  flex-shrink: 0;
  text-transform: uppercase;
}

.tk-msg--support .tk-msg-avatar {
  background: var(--brand-2);
}

.tk-msg-author-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tk-msg-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tk-msg-support-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-2);
}

.tk-msg-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Message body (markdown) ────────────────────────────── */

.tk-msg-body {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.75;
}

.tk-msg-body p          { margin: 0 0 10px; }
.tk-msg-body p:last-child { margin-bottom: 0; }
.tk-msg-body strong     { color: var(--text); }
.tk-msg-body a          { color: var(--brand-2); text-decoration: underline; }
.tk-msg-body ul,
.tk-msg-body ol         { padding-left: 20px; margin: 8px 0; }
.tk-msg-body li         { margin-bottom: 4px; }
.tk-msg-body s          { opacity: 0.6; }

/* ── Reply section ──────────────────────────────────────── */

.tk-reply-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Closed notice ──────────────────────────────────────── */

.tk-closed-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  background: var(--overlay-sm);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.tk-closed-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.tk-closed-notice a {
  color: var(--brand-2);
  text-decoration: underline;
}

/* ── Reply form ─────────────────────────────────────────── */

.tk-reply-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tk-reply-actions {
  display: flex;
  justify-content: flex-end;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 600px) {
  .tk-msg-header   { padding: 12px 14px 8px; }
  .tk-msg-body     { padding: 12px 14px; }
  .tk-closed-notice { padding: 12px 14px; font-size: 12px; }
}

@media (max-width: 480px) {
  .tk-reply-actions { justify-content: stretch; }
  .tk-reply-actions .btn { width: 100%; }
}

/* ── Empty thread ───────────────────────────────────────── */

.tk-thread-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 32px 0;
}
