/* ─────────────────────────────────────────────────────────────────────── */
/* Ticket Detail Page — Full Ticket View, Comments, Metadata                */
/* ─────────────────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────────────── */
/* Page Layout (2-column: content + metadata)                               */
/* ─────────────────────────────────────────────────────────────────────── */

.page-ticket-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  height: 100%;
  min-width: 0;
}

@media (max-width: 1200px) {
  .page-ticket-detail {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
  }
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Ticket Main Content                                                       */
/* ─────────────────────────────────────────────────────────────────────── */

.ticket-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Ticket Header                                                             */
/* ─────────────────────────────────────────────────────────────────────── */

.ticket-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background-color: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ticket-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticket-id {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
}

.ticket-header-actions {
  display: flex;
  gap: 6px;
}

.ticket-inline-edit {
  cursor: text;
}

.ticket-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
  word-wrap: break-word;
  min-height: 30px;
}

.ticket-title.editing {
  border-bottom: 2px solid var(--focus-border);
  padding-bottom: 4px;
}

.ticket-title-input {
  width: 100%;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  border: 1px solid var(--focus-border);
  border-radius: 4px;
  padding: 8px;
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Ticket Description / Body                                                 */
/* ─────────────────────────────────────────────────────────────────────── */

.ticket-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background-color: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ticket-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.ticket-description {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  word-wrap: break-word;
}

.ticket-description img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 8px 0;
}

.ticket-description p {
  margin: 0 0 12px 0;
}

.ticket-description p:last-child {
  margin-bottom: 0;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Markdown Editor                                                           */
/* ─────────────────────────────────────────────────────────────────────── */

.md-editor {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.md-editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background-color: var(--bg-3);
  flex-wrap: wrap;
}

.md-editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
  transition: var(--transition-colors);
}

.md-editor-btn:hover {
  background-color: var(--bg-2);
  border-color: var(--hover-bd);
  color: var(--text);
}

.md-editor-textarea {
  width: 100%;
  min-height: 120px;
  border: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  background-color: var(--bg-1);
  color: var(--text);
  resize: vertical;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Comments Section                                                          */
/* ─────────────────────────────────────────────────────────────────────── */

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

.comment {
  display: flex;
  gap: 12px;
  padding: 12px;
  background-color: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-h));
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.comment-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-author {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.comment-time {
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
}

.comment-body {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  word-wrap: break-word;
}

.comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.comment-action-btn {
  font-size: 11px;
  color: var(--text-mute);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-colors);
}

.comment-action-btn:hover {
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Add Comment Form                                                          */
/* ─────────────────────────────────────────────────────────────────────── */

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background-color: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.comment-form-textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Ticket Metadata (Sidebar)                                                 */
/* ─────────────────────────────────────────────────────────────────────── */

.ticket-metadata {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.metadata-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background-color: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metadata-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin: 0;
}

.metadata-value {
  font-size: 13px;
  color: var(--text);
  margin: 0;
}

.metadata-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Votes / Engagement                                                        */
/* ─────────────────────────────────────────────────────────────────────── */

.metadata-votes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.votes-number {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
}

.votes-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-dim);
  transition: var(--transition-colors);
  font-size: 18px;
}

.votes-action:hover {
  background-color: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

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

@media (max-width: 1024px) {
  .page-ticket-detail {
    grid-template-columns: 1fr 320px;
    gap: 16px;
  }
}

@media (max-width: 880px) {
  .page-ticket-detail {
    grid-template-columns: 1fr;
  }

  .ticket-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    max-height: unset;
  }
}

@media (max-width: 640px) {
  .page-ticket-detail {
    gap: 12px;
  }

  .ticket-title {
    font-size: 18px;
  }

  .ticket-metadata {
    grid-template-columns: 1fr;
  }

  .comment {
    padding: 10px;
  }

  .comment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
