/* ============================================================================
   Contigo Data Explorer — Jira Module Styles
   Board, issue cards, priority/type indicators
   ============================================================================ */

/* ---- Board / Kanban ---- */
.jira-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: 400px;
}

.jira-board-column {
  min-width: 280px;
  max-width: 320px;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-sunken);
  border-radius: 8px;
  overflow: hidden;
}

.jira-col-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid transparent;
}

.jira-col-header.todo { border-bottom-color: #3b82f6; color: #3b82f6; }
.jira-col-header.inprogress { border-bottom-color: #f59e0b; color: #f59e0b; }
.jira-col-header.done { border-bottom-color: #10b981; color: #10b981; }

.jira-col-count {
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-raised);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-secondary);
}

.jira-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 600px;
  flex: 1;
}

/* ---- Issue Card (on Board) ---- */
.jira-card {
  background: var(--bg-raised);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  border: 1px solid var(--border);
}

.jira-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.jira-card-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-text);
  margin-bottom: 4px;
}

.jira-card-summary {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.jira-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.jira-card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ---- Issue Type Icons ---- */
.issue-type-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 10px;
  flex-shrink: 0;
}

.issue-type-icon.bug { background: #ef4444; color: white; }
.issue-type-icon.task { background: #3b82f6; color: white; }
.issue-type-icon.story { background: #10b981; color: white; }
.issue-type-icon.epic { background: #8b5cf6; color: white; }
.issue-type-icon.subtask { background: #6b7280; color: white; }
.issue-type-icon.improvement { background: #06b6d4; color: white; }
.issue-type-icon.default { background: #94a3b8; color: white; }

/* ---- Priority Indicators ---- */
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-dot.p1 { background: #ef4444; }
.priority-dot.p2 { background: #f97316; }
.priority-dot.p3 { background: #eab308; }
.priority-dot.p4 { background: #3b82f6; }
.priority-dot.p5 { background: #94a3b8; }

/* ---- Status Badges ---- */
.status-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.todo { background: #dbeafe; color: #1d4ed8; }
.status-badge.inprogress { background: #fef3c7; color: #92400e; }
.status-badge.done { background: #d1fae5; color: #065f46; }

[data-theme="dark"] .status-badge.todo { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .status-badge.inprogress { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .status-badge.done { background: #064e3b; color: #6ee7b7; }

/* ---- Board Controls ---- */
.jira-board-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.jira-board-controls select {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.jira-board-controls label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* ---- Sprint Cards ---- */
.sprint-group {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.sprint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-sunken);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.sprint-header:hover { background: var(--bg-raised); }

.sprint-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sprint-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.sprint-state {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.sprint-state.active { background: #dbeafe; color: #1d4ed8; }
.sprint-state.closed { background: #d1fae5; color: #065f46; }
.sprint-state.future { background: #f3f4f6; color: #6b7280; }

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

.sprint-issues {
  padding: 0;
}

.sprint-issues.collapsed { display: none; }

/* ---- Issue Detail ---- */
.jira-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

@media (max-width: 900px) {
  .jira-detail { grid-template-columns: 1fr; }
}

.jira-detail-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.jira-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.jira-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.jira-detail-key {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
}

.jira-detail-summary {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 8px;
}

.jira-sidebar-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.jira-sidebar-card h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}

.jira-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.jira-field-row:last-child { border-bottom: none; }

.jira-field-label {
  color: var(--text-muted);
  font-size: 12px;
}

.jira-field-value {
  color: var(--text);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Activity / Changelog ---- */
.jira-activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.jira-activity-item:last-child { border-bottom: none; }

.jira-activity-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.jira-activity-body {
  flex: 1;
  min-width: 0;
}

.jira-activity-author {
  font-weight: 600;
  color: var(--text);
}

.jira-activity-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}

.jira-activity-change {
  color: var(--text-secondary);
  margin-top: 2px;
}

.jira-activity-from {
  text-decoration: line-through;
  color: var(--text-muted);
}

.jira-activity-to {
  font-weight: 500;
  color: var(--text);
}

/* ---- Dashboard Stat Cards ---- */
.jira-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.jira-stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}

.jira-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.jira-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

/* ---- Comment Thread ---- */
.jira-comment {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.jira-comment:last-child { border-bottom: none; }

.jira-comment-body {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.jira-comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

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

.jira-comment-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Collapsible sections ---- */
.jira-collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.jira-collapsible-header:hover { color: var(--text); }

.jira-collapsible-toggle {
  font-size: 10px;
  transition: transform 0.2s;
}

.jira-collapsible-toggle.expanded { transform: rotate(90deg); }

.jira-collapsible-body.collapsed { display: none; }

/* ---- Filter Workbench ---- */
.jira-filter-bar {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.jira-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.jira-filter-group { display: flex; flex-direction: column; gap: 3px; min-width: 110px; }
.jira-filter-group label { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.04em; }
.jira-filter-group select, .jira-filter-group input {
  padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--bg-sunken); color: var(--text); font-size: 12px; outline: none;
}
.jira-quick-filters {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.jf-quick {
  padding: 3px 10px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-sunken); color: var(--text-muted); font-size: 11px;
  cursor: pointer; transition: all 0.15s;
}
.jf-quick:hover { border-color: var(--accent); color: var(--text); }
.jf-quick.active { background: var(--accent); color: white; border-color: var(--accent); }
.jira-jql-summary {
  margin-top: 8px; padding: 6px 10px; background: var(--bg-sunken); border-radius: 5px;
  font-family: monospace; font-size: 11px; color: var(--text-muted); white-space: pre-wrap; word-break: break-all;
}

/* ---- Projects Grid ---- */
.jira-projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
.jira-project-card {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; cursor: pointer; transition: box-shadow 0.15s, transform 0.1s;
}
.jira-project-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-2px); }

