/* Issue Detail Page CSS */
/* Uses design tokens from design-tokens.css for consistency */

/* ============================================
   1. CSS VARIABLES (mapped to design tokens)
   ============================================ */
:root {
  --gh-bg: var(--color-bg-primary, #ffffff);
  --gh-bg-subtle: var(--color-bg-secondary, #f5f5f5);
  --gh-border: var(--color-border-primary, #e0e0e0);
  --gh-border-muted: var(--color-border-secondary, #eee);
  --gh-text: var(--color-text-primary, #333);
  --gh-text-muted: var(--color-text-secondary, #666);
  --gh-text-link: var(--color-text-primary, #333);
  --gh-accent-green: #1a7f37;
  --gh-accent-green-bg: #e8f5e9;
  --gh-accent-purple: #8250df;
  --gh-accent-purple-bg: #f5f0ff;
  --gh-btn-primary-bg: var(--color-text-primary, #333);
  --gh-btn-primary-hover: var(--color-primary-hover, #000);
  --gh-btn-secondary-bg: var(--color-bg-secondary, #f5f5f5);
  --gh-btn-secondary-border: var(--color-border-primary, #e0e0e0);
  --gh-radius: 8px;
  --gh-radius-lg: 12px;
  --gh-header-bg: var(--color-bg-secondary, #f8f8f8);
  --gh-comment-border: var(--color-border-primary, #e0e0e0);
}

/* ============================================
   1b. BREADCRUMB
   ============================================ */
.gh-issue-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gh-text-muted);
  margin-bottom: 20px;
}

.gh-issue-breadcrumb a {
  color: var(--gh-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.gh-issue-breadcrumb a:hover {
  color: var(--gh-text);
}

.gh-issue-breadcrumb svg {
  flex-shrink: 0;
  opacity: 0.4;
}

.gh-issue-breadcrumb .gh-breadcrumb-current {
  color: var(--gh-text);
  font-weight: 500;
}

/* ============================================
   2. PAGE LAYOUT
   ============================================ */
.gh-issue-page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gh-text);
  background: var(--gh-bg);
}

/* Remove any container constraints from parent layouts */
.main-content-area:has(.gh-issue-page) {
  max-width: none !important;
  width: 100% !important;
  background: var(--gh-bg) !important;
}

.content-container:has(.gh-issue-page) {
  max-width: none !important;
  width: 100% !important;
}

.page-content:has(.gh-issue-page) {
  max-width: none !important;
  width: 100% !important;
}

/* ============================================
   3. HEADER
   ============================================ */
.gh-issue-header {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gh-border);
}

.gh-issue-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.gh-issue-title {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--gh-text);
  letter-spacing: -0.02em;
}

.gh-issue-number {
  font-weight: 300;
  color: var(--gh-text-muted);
}

.gh-issue-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gh-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 2em;
  font-size: 14px;
  font-weight: 500;
}

.gh-status-badge svg {
  flex-shrink: 0;
}

.gh-status-open {
  background: var(--gh-accent-green-bg);
  color: var(--gh-accent-green);
  border: 1px solid rgba(26, 127, 55, 0.2);
}

.gh-status-closed {
  background: var(--gh-accent-purple-bg);
  color: var(--gh-accent-purple);
  border: 1px solid rgba(130, 80, 223, 0.2);
}

.gh-status-resolved {
  background: var(--gh-accent-green-bg);
  color: var(--gh-accent-green);
  border: 1px solid rgba(26, 127, 55, 0.2);
}

.gh-meta-text {
  color: var(--gh-text-muted);
  font-size: 14px;
}

.gh-author-link {
  color: var(--gh-text);
  font-weight: 600;
  text-decoration: none;
}

.gh-author-link:hover {
  color: var(--gh-text-link);
  text-decoration: underline;
}

/* ============================================
   4. MAIN LAYOUT (Two columns)
   ============================================ */
.gh-issue-layout,
.gh-pr-layout {
  display: flex;
  gap: 24px;
}

.gh-issue-main,
.gh-pr-main {
  flex: 1;
  min-width: 0;
}

/* ============================================
   4b. PULL REQUEST SPECIFIC STYLES
   ============================================ */
.gh-pr-page {
  /* Inherits from gh-issue-page */
}

.gh-pr-header {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gh-border);
}

.gh-pr-breadcrumb {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--gh-text-muted);
}

.gh-pr-breadcrumb a {
  color: var(--gh-link);
  text-decoration: none;
}

.gh-pr-breadcrumb a:hover {
  text-decoration: underline;
}

.gh-pr-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.gh-pr-title {
  font-size: 32px;
  font-weight: 400;
  line-height: 1.25;
  margin: 0;
  color: var(--gh-text);
}

.gh-pr-number {
  font-weight: 300;
  color: var(--gh-text-muted);
}

.gh-pr-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gh-pr-section-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
  background: var(--gh-bg-secondary);
  color: var(--gh-text-muted);
}

/* PR Tabs */
.pr-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--gh-border);
  margin-bottom: 16px;
}

.pr-tabs .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gh-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pr-tabs .tab-btn:hover {
  color: var(--gh-text);
}

.pr-tabs .tab-btn.active {
  color: var(--gh-text);
  border-bottom-color: #f78166;
}

.pr-tabs .tab-btn svg {
  width: 16px;
  height: 16px;
}

/* PR Tab Content (scoped to PR detail page only) */
.pr-tabs ~ .tab-content {
  display: none;
}

.pr-tabs ~ .tab-content.active {
  display: block;
}

/* PR Diff Styles */
.gh-pr-diff {
  margin-top: 16px;
}

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

.gh-diff-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--gh-text);
}

.diff-mode-controls {
  display: flex;
  gap: 4px;
}

.diff-mode-btn {
  padding: 4px 8px !important;
}

.diff-mode-btn.active {
  background: var(--gh-bg-secondary) !important;
}

/* Split Diff View */
.gh-diff-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.gh-diff-panel {
  border: 1px solid var(--gh-border);
  border-radius: 8px;
  overflow: hidden;
}

.gh-diff-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  background: var(--gh-bg-secondary);
  border-bottom: 1px solid var(--gh-border);
  color: var(--gh-text-muted);
}

.gh-diff-panel-header svg {
  width: 16px;
  height: 16px;
}

.gh-diff-content {
  padding: 16px;
  min-height: 100px;
  background: var(--gh-bg);
}

.gh-diff-original .gh-diff-panel-header {
  background: rgba(248, 81, 73, 0.1);
  border-bottom-color: rgba(248, 81, 73, 0.2);
}

.gh-diff-proposed .gh-diff-panel-header {
  background: rgba(63, 185, 80, 0.1);
  border-bottom-color: rgba(63, 185, 80, 0.2);
}

.gh-empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: var(--gh-text-muted);
}

.gh-empty-content p {
  margin: 8px 0 4px;
  font-size: 14px;
}

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

/* Unified Diff View */
.gh-diff-unified {
  border: 1px solid var(--gh-border);
  border-radius: 8px;
  overflow: hidden;
}

.gh-diff-unified-content {
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  background: var(--gh-bg);
  overflow-x: auto;
}

.gh-unified-diff-lines {
  width: 100%;
}

.gh-diff-line {
  display: flex;
  align-items: stretch;
  min-height: 20px;
}

.gh-diff-line-num {
  width: 40px;
  min-width: 40px;
  padding: 0 8px;
  text-align: right;
  color: var(--gh-text-muted);
  background: var(--gh-bg-secondary);
  border-right: 1px solid var(--gh-border);
  user-select: none;
  font-size: 12px;
}

.gh-diff-line-marker {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-weight: 600;
  user-select: none;
}

.gh-diff-line-content {
  flex: 1;
  padding: 0 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

.gh-diff-line-added {
  background: rgba(63, 185, 80, 0.15);
}

.gh-diff-line-added .gh-diff-line-marker {
  color: #3fb950;
}

.gh-diff-line-added .gh-diff-line-num {
  background: rgba(63, 185, 80, 0.2);
}

.gh-diff-line-removed {
  background: rgba(248, 81, 73, 0.15);
}

.gh-diff-line-removed .gh-diff-line-marker {
  color: #f85149;
}

.gh-diff-line-removed .gh-diff-line-num {
  background: rgba(248, 81, 73, 0.2);
}

.gh-diff-line-context {
  background: var(--gh-bg);
}

.gh-diff-line-context .gh-diff-line-marker {
  color: var(--gh-text-muted);
}

.gh-diff-simple {
  padding: 16px;
}

.gh-diff-simple pre {
  background: var(--gh-bg-secondary);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
}

.gh-diff-error {
  color: #f85149;
  padding: 16px;
  text-align: center;
}

.gh-diff-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--gh-text-muted);
}

/* ============================================
   5. TIMELINE (Comments)
   ============================================ */
.gh-timeline {
  position: relative;
  margin-top: 24px;
}

/* Timeline Events (merge/close) */
.gh-timeline-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  padding-left: 40px;
  position: relative;
}

.gh-timeline-event-icon {
  position: absolute;
  left: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gh-bg);
  z-index: 1;
}

.gh-timeline-event-icon svg {
  width: 16px;
  height: 16px;
}

.gh-event-merged .gh-timeline-event-icon {
  background: rgba(130, 80, 223, 0.1);
  color: #8250df;
}

.gh-event-closed .gh-timeline-event-icon {
  background: rgba(248, 81, 73, 0.1);
  color: #f85149;
}

.gh-event-default .gh-timeline-event-icon {
  background: var(--gh-bg-secondary);
  color: var(--gh-text-muted);
}

.gh-timeline-event-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gh-timeline-event-text {
  font-size: 14px;
  color: var(--gh-text);
}

.gh-timeline-event-text strong {
  font-weight: 600;
}

.gh-timeline-event-time {
  font-size: 12px;
  color: var(--gh-text-muted);
}

/* Add visual connector line between comments */
.gh-timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gh-border);
  z-index: 0;
}

/* Hide line for first/last elements */
.gh-timeline .gh-comment:last-child::after {
  content: '';
  position: absolute;
  left: -16px;
  bottom: 0;
  width: 2px;
  height: 50%;
  background: var(--gh-bg);
  z-index: 0;
}

.gh-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--gh-text-muted);
}

.gh-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gh-border);
  border-top-color: var(--gh-text-link);
  border-radius: 50%;
  animation: gh-spin 1s linear infinite;
}

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

/* Empty state */
.gh-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
  color: var(--gh-text-muted);
}

.gh-empty-state h3 {
  margin: 16px 0 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--gh-text);
}

.gh-empty-state p {
  margin: 0;
  font-size: 14px;
}

/* ============================================
   6. COMMENT BOX
   ============================================ */
.gh-comment {
  position: relative;
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  z-index: 1;
}

.gh-comment-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

.gh-comment-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: none;
  box-shadow: 0 0 0 1px rgba(27, 31, 36, 0.15);
}

.gh-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gh-text, #333);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
}

.gh-comment-container {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--gh-comment-border);
  border-radius: var(--gh-radius);
  background: var(--gh-bg);
  box-shadow: none;
}

/* First comment (issue body) styling */
.gh-comment.gh-comment-first .gh-comment-container {
  border-color: var(--gh-border);
  border-width: 1px;
}

.gh-comment.gh-comment-first .gh-comment-header {
  background: var(--gh-header-bg);
  border-bottom-color: var(--gh-border);
}

.gh-comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--gh-header-bg);
  border-bottom: 1px solid var(--gh-comment-border);
  border-radius: var(--gh-radius) var(--gh-radius) 0 0;
  font-size: 14px;
  min-height: 40px;
}

.gh-comment-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gh-comment-author {
  font-weight: 600;
  color: var(--gh-text);
  text-decoration: none;
}

.gh-comment-author:hover {
  color: var(--gh-text-link);
  text-decoration: underline;
}

.gh-comment-timestamp {
  color: var(--gh-text-muted);
  text-decoration: none;
}

.gh-comment-timestamp:hover {
  color: var(--gh-text-link);
  text-decoration: underline;
}

.gh-owner-badge {
  padding: 0 7px;
  font-size: 12px;
  font-weight: 500;
  line-height: 22px;
  border: 1px solid var(--gh-border);
  border-radius: 2em;
  color: var(--gh-text-muted);
  background: transparent;
}

.gh-contributor-badge {
  padding: 0 7px;
  font-size: 12px;
  font-weight: 500;
  line-height: 22px;
  border: 1px solid var(--gh-border);
  border-radius: 2em;
  color: var(--gh-text-muted);
  background: transparent;
}

.gh-edited-badge {
  font-size: 12px;
  font-style: italic;
  color: var(--gh-text-muted);
}

.gh-comment-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gh-comment-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.gh-comment:hover .gh-comment-actions {
  opacity: 1;
}

.gh-comment-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--gh-text-muted);
  border-radius: var(--gh-radius);
  cursor: pointer;
}

.gh-comment-action-btn:hover {
  background: var(--gh-bg-subtle);
  color: var(--gh-text);
}

/* Three dot menu button */
.gh-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--gh-text-muted);
  border-radius: var(--gh-radius);
  cursor: pointer;
}

.gh-menu-btn:hover {
  background: var(--gh-bg-subtle);
  color: var(--gh-text);
}

.gh-comment-body {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gh-text);
  background: var(--gh-bg);
  border-radius: 0 0 var(--gh-radius) var(--gh-radius);
}

.gh-comment-body p {
  margin: 0 0 16px 0;
}

.gh-comment-body p:last-child {
  margin-bottom: 0;
}

.gh-comment-body pre {
  padding: 16px;
  background: var(--gh-bg-subtle);
  border-radius: var(--gh-radius);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.gh-comment-body code {
  padding: 0.2em 0.4em;
  background: rgba(175, 184, 193, 0.2);
  border-radius: var(--gh-radius);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 85%;
}

.gh-comment-body pre code {
  padding: 0;
  background: none;
}

/* Reactions */
.gh-reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-top: 1px solid var(--gh-comment-border);
  background: var(--gh-bg);
  border-radius: 0 0 var(--gh-radius) var(--gh-radius);
}

.gh-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--gh-border);
  border-radius: 2em;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--gh-text-muted);
}

.gh-reaction:hover {
  background: var(--gh-bg-subtle);
  border-color: var(--gh-text-muted);
}

.gh-reaction.gh-reaction-active {
  background: var(--gh-bg-subtle);
  border-color: var(--gh-text);
  color: var(--gh-text);
}

.gh-reaction-emoji {
  font-size: 14px;
  line-height: 1;
}

.gh-reaction-count {
  font-weight: 500;
  font-size: 12px;
}

.gh-add-reaction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px dashed var(--gh-border);
  border-radius: 2em;
  color: var(--gh-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.gh-add-reaction:hover {
  background: var(--gh-bg-subtle);
  border-color: var(--gh-text-muted);
  border-style: solid;
  color: var(--gh-text);
}

.gh-add-reaction svg {
  width: 16px;
  height: 16px;
}

/* Thread replies indicator */
.gh-thread-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--gh-comment-border);
  color: var(--gh-text-link);
  font-size: 13px;
  cursor: pointer;
  background: var(--gh-bg);
  border-radius: 0 0 var(--gh-radius) var(--gh-radius);
}

.gh-thread-indicator:hover {
  text-decoration: underline;
}

/* Dropdown menu */
.gh-dropdown {
  position: relative;
  display: inline-flex;
}

.gh-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 160px;
  padding: 4px 0;
  background: var(--gh-bg);
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
  z-index: 100;
}

.gh-dropdown:hover .gh-dropdown-menu,
.gh-dropdown.gh-dropdown-open .gh-dropdown-menu {
  display: block;
}

.gh-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--gh-text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.gh-dropdown-item:hover {
  background: var(--gh-bg-subtle);
}

.gh-dropdown-item svg {
  color: var(--gh-text-muted);
  flex-shrink: 0;
}

.gh-dropdown-danger {
  color: #d1242f;
}

.gh-dropdown-danger:hover {
  background: #ffebe9;
}

.gh-dropdown-danger svg {
  color: #d1242f;
}

/* ============================================
   7. NEW COMMENT FORM
   ============================================ */
.gh-new-comment {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--gh-border);
  position: relative;
  z-index: 1;
}

.gh-comment-box {
  display: flex;
  gap: 16px;
}

.gh-comment-form-container {
  flex: 1;
  min-width: 0;
}

.gh-comment-form {
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  background: var(--gh-bg);
}

.gh-comment-tabs {
  display: flex;
  gap: 0;
  padding: 8px 8px 0;
  background: var(--gh-bg-subtle);
  border-bottom: 1px solid var(--gh-border);
  border-radius: var(--gh-radius) var(--gh-radius) 0 0;
}

.gh-tab {
  padding: 8px 16px;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--gh-text-muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--gh-radius) var(--gh-radius) 0 0;
  margin-bottom: -1px;
}

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

.gh-tab.gh-tab-active {
  background: var(--gh-bg);
  border-color: var(--gh-border);
  color: var(--gh-text);
}


.gh-write-area textarea {
  width: 100%;
  min-height: 150px;
  padding: 16px;
  border: none;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  box-sizing: border-box;
}

.gh-write-area textarea::placeholder {
  color: var(--gh-text-muted);
}

.gh-preview-area {
  min-height: 150px;
  padding: 16px;
}

.gh-preview-content {
  color: var(--gh-text-muted);
  font-style: italic;
}

.gh-comment-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--gh-bg-subtle);
  border-top: 1px solid var(--gh-border);
  border-radius: 0 0 var(--gh-radius) var(--gh-radius);
}

.gh-format-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gh-text-muted);
  font-size: 12px;
}

.gh-format-hint svg {
  opacity: 0.7;
}

.gh-submit-buttons {
  display: flex;
  gap: 8px;
}

/* NOTE: Button styles (.gh-btn-*) removed - now using component system (.btn, .btn-primary, etc.) */

/* ============================================
   9. SIDEBAR
   ============================================ */
.gh-sidebar {
  width: 256px;
  flex-shrink: 0;
}

.gh-sidebar-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--gh-border-muted);
}

.gh-sidebar-section:first-child {
  padding-top: 0;
}

.gh-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.gh-sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gh-text);
}

.gh-sidebar-content {
  font-size: 12px;
  color: var(--gh-text);
}

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

.gh-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.gh-label {
  display: inline-flex;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  border-radius: 2em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.gh-label-default {
  background: #ddf4ff;
  color: #0969da;
  border-color: rgba(9, 105, 218, 0.2);
}

.gh-label-bug {
  background: #ffebe9;
  color: #d1242f;
  border-color: rgba(209, 36, 47, 0.2);
}

.gh-label-enhancement {
  background: #dafbe1;
  color: #1a7f37;
  border-color: rgba(26, 127, 55, 0.2);
}

.gh-label-question {
  background: #fff8c5;
  color: #9a6700;
  border-color: rgba(154, 103, 0, 0.2);
}

/* Generic label colors */
.gh-label-analysis {
  background: #ddf4ff;
  color: #0969da;
}

.gh-label-custom {
  background: #f6f8fa;
  color: var(--gh-text);
  border-color: var(--gh-border);
}

.gh-sidebar-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gh-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
}

.gh-sidebar-link:hover {
  color: var(--gh-text-link);
  text-decoration: underline;
}

.gh-sidebar-link svg {
  color: var(--gh-text-muted);
  flex-shrink: 0;
}

.gh-sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 5px 12px;
  background: var(--gh-btn-secondary-bg);
  border: 1px solid var(--gh-btn-secondary-border);
  border-radius: var(--gh-radius);
  color: var(--gh-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.gh-sidebar-btn:hover {
  background: #f3f4f6;
  border-color: rgba(31, 35, 40, 0.15);
}

.gh-sidebar-btn svg {
  flex-shrink: 0;
}

.gh-sidebar-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--gh-text-muted);
}

.gh-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.gh-participant {
  width: 28px;
  height: 28px;
}

.gh-participant img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(27, 31, 36, 0.15);
}

.gh-participant .gh-avatar-placeholder {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

/* ============================================
   10. LOGIN PROMPT
   ============================================ */
.gh-login-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  background: var(--gh-bg-subtle);
  color: var(--gh-text-muted);
}

.gh-login-link {
  color: var(--gh-text-link);
  text-decoration: none;
  font-weight: 500;
}

.gh-login-link:hover {
  text-decoration: underline;
}

/* ============================================
   11. THREAD PANEL
   ============================================ */
.gh-thread-overlay {
  display: none;
}

.gh-thread-overlay.active {
  display: none;
}

.gh-thread-panel {
  display: none;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 440px;
  max-width: 100%;
  background: var(--gh-bg);
  border-left: 1px solid var(--gh-border);
  z-index: 10001;
  flex-direction: column;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.gh-thread-panel.active,
.gh-thread-panel.open {
  display: flex;
}

.gh-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--gh-border);
}

.gh-thread-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.gh-thread-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--gh-text-muted);
  border-radius: var(--gh-radius);
  cursor: pointer;
}

.gh-thread-close:hover {
  background: var(--gh-bg-subtle);
  color: var(--gh-text);
}

.gh-thread-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.gh-thread-parent {
  margin-bottom: 16px;
}

.gh-thread-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  color: var(--gh-text-muted);
  font-size: 12px;
}

.gh-thread-divider::before,
.gh-thread-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gh-border);
}

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

/* Thread message styling */
.gh-thread-message {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--gh-bg);
  border-radius: var(--gh-radius);
}

.gh-thread-message-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.gh-thread-message-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.gh-thread-message-avatar .gh-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gh-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--gh-text-muted);
}

.gh-thread-message-content {
  flex: 1;
  min-width: 0;
}

.gh-thread-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.gh-thread-author {
  font-weight: 600;
  color: var(--gh-text);
  font-size: 14px;
}

.gh-thread-time {
  color: var(--gh-text-muted);
  font-size: 12px;
}

.gh-thread-message-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--gh-text);
  word-wrap: break-word;
}

.gh-thread-parent-msg {
  background: var(--gh-bg-subtle);
  border: 1px solid var(--gh-border);
}

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

.gh-thread-input {
  padding: 16px;
  border-top: 1px solid var(--gh-border);
}

.gh-thread-input form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-thread-input textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  box-sizing: border-box;
}

.gh-thread-input textarea:focus {
  outline: none;
  border-color: var(--gh-text-link);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}

/* ============================================
   12. MODALS
   ============================================ */
.gh-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.gh-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.gh-modal-content {
  position: relative;
  width: 400px;
  max-width: 90%;
  background: var(--gh-bg);
  border-radius: var(--gh-radius-lg);
  box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
}

.gh-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--gh-border);
}

.gh-modal-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.gh-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--gh-text-muted);
  border-radius: var(--gh-radius);
  cursor: pointer;
}

.gh-modal-close:hover {
  background: var(--gh-bg-subtle);
  color: var(--gh-text);
}

.gh-modal-body {
  padding: 16px;
}

.gh-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--gh-border);
}

/* ============================================
   12B. MESSAGE EDIT FORM (in GitHub-style comments)
   ============================================ */
.gh-comment-body .message-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-comment-body .message-edit-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
  background: var(--gh-bg);
  color: var(--gh-text);
}

.gh-comment-body .message-edit-input:focus {
  outline: none;
  border-color: var(--gh-text-link);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.gh-comment-body .message-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.gh-comment-body .btn-save-edit {
  padding: 5px 16px;
  background: var(--gh-btn-primary-bg);
  border: 1px solid rgba(31, 35, 40, 0.15);
  color: white;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--gh-radius);
  cursor: pointer;
}

.gh-comment-body .btn-save-edit:hover {
  background: var(--gh-btn-primary-hover);
}

.gh-comment-body .btn-save-edit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.gh-comment-body .btn-cancel-edit {
  padding: 5px 16px;
  background: var(--gh-btn-secondary-bg);
  border: 1px solid var(--gh-btn-secondary-border);
  color: var(--gh-text);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--gh-radius);
  cursor: pointer;
}

.gh-comment-body .btn-cancel-edit:hover {
  background: #f3f4f6;
}

/* ============================================
   13. REACTION PICKER
   ============================================ */
.gh-reaction-picker {
  position: absolute;
  display: flex;
  gap: 2px;
  padding: 8px;
  background: var(--gh-bg);
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
  z-index: 50;
}

.gh-reaction-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 18px;
  border-radius: var(--gh-radius);
  cursor: pointer;
  transition: transform 0.1s, background 0.1s;
}

.gh-reaction-btn:hover {
  background: var(--gh-bg-subtle);
  transform: scale(1.1);
}

/* ============================================
   14. RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .gh-issue-page {
    padding: 24px 32px;
  }
  
  .gh-diff-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1012px) {
  .gh-issue-layout,
  .gh-pr-layout {
    flex-direction: column;
  }
  
  .gh-sidebar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .gh-sidebar-section {
    flex: 1;
    min-width: 200px;
    padding: 16px;
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius);
  }
}

@media (max-width: 768px) {
  .gh-issue-page {
    width: 100%;
    padding: 16px;
  }

  .gh-issue-breadcrumb {
    font-size: 12px;
  }

  .gh-issue-title,
  .gh-pr-title {
    font-size: 22px;
  }
  
  .gh-comment {
    gap: 12px;
  }
  
  .gh-comment-avatar,
  .gh-comment-avatar img,
  .gh-comment-avatar .gh-avatar-placeholder {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .gh-timeline::before {
    left: 36px;
  }
  
  .gh-thread-panel {
    width: 100%;
  }
  
  .pr-tabs {
    overflow-x: auto;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
:root[data-theme="dark"] {
  --gh-bg: var(--color-bg-primary);
  --gh-bg-subtle: var(--color-bg-secondary);
  --gh-border: var(--color-border-primary);
  --gh-border-muted: var(--color-border-secondary);
  --gh-text: var(--color-text-primary);
  --gh-text-muted: var(--color-text-secondary);
  --gh-text-link: var(--color-text-primary);
  --gh-btn-secondary-bg: var(--color-bg-secondary);
  --gh-btn-secondary-border: var(--color-border-primary);
  --gh-header-bg: var(--color-bg-secondary);
  --gh-comment-border: var(--color-border-primary);
  --gh-accent-green-bg: rgba(26, 127, 55, 0.15);
  --gh-accent-purple-bg: rgba(130, 80, 223, 0.15);
}

:root[data-theme="dark"] .gh-issue-page {
  background: var(--gh-bg);
  color: var(--gh-text);
}

:root[data-theme="dark"] .gh-comment-box {
  background: var(--gh-bg-subtle);
  border-color: var(--gh-border);
}

:root[data-theme="dark"] .gh-comment-header {
  background: var(--gh-bg);
  border-color: var(--gh-border);
}

:root[data-theme="dark"] .gh-comment-body {
  background: var(--gh-bg);
}

:root[data-theme="dark"] .gh-sidebar-card {
  background: var(--gh-bg-subtle);
  border-color: var(--gh-border);
}

:root[data-theme="dark"] .gh-label-preview {
  color: var(--color-text-primary);
}
