/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f6f8fa;
  color: #24292f;
  line-height: 1.6;
}

.container {
  width: 100%;
  margin: 0;
  padding: 10px;
}

/* Authentication Section */
.auth-section {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-width: 600px;
  margin: 20px auto;
}

.auth-section h2 {
  margin-bottom: 20px;
  color: #24292f;
  font-size: 24px;
}

.auth-form {
  margin-bottom: 20px;
}

.auth-form label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
}

.auth-form input {
  width: 100%;
  max-width: 400px;
  padding: 12px;
  border: 2px solid #d0d7de;
  border-radius: 6px;
  font-size: 16px;
  margin-bottom: 15px;
}

.auth-form input:focus {
  outline: none;
  border-color: #0969da;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.button-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.auth-form button {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  min-width: 120px;
}

#saveToken,
#selectOrgButton {
  background-color: #0969da;
  color: white;
}

#saveToken:hover,
#selectOrgButton:hover {
  background-color: #0860ca;
}

#clearToken,
.secondary {
  background-color: #f6f8fa;
  color: #24292f;
  border: 1px solid #d0d7de;
}

#clearToken:hover,
.secondary:hover {
  background-color: #f3f4f6;
}

.token-info {
  padding: 15px;
  background-color: #dbeafe;
  border-left: 4px solid #0969da;
  border-radius: 4px;
  text-align: left;
}

.token-info code {
  background-color: #f6f8fa;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: "SF Mono", Monaco, Menlo, monospace;
}

.token-info a {
  color: #0969da;
  text-decoration: none;
}

.token-info a:hover {
  text-decoration: underline;
}

/* Organization Selection */
.org-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  margin: 20px 0;
  background: #f6f8fa;
}

.org-item {
  border-bottom: 1px solid #d0d7de;
  transition: background-color 0.2s;
}

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

.org-item:hover {
  background-color: #f3f4f6;
}

.org-item input[type="radio"] {
  display: none;
}

.org-item label {
  display: flex;
  align-items: center;
  padding: 15px;
  cursor: pointer;
  text-align: left;
  gap: 15px;
  transition: background-color 0.2s;
}

.org-item input[type="radio"]:checked + label {
  background-color: #dbeafe;
  border-left: 4px solid #0969da;
}

.org-avatar {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
}

.org-info {
  flex: 1;
}

.org-info strong {
  display: block;
  color: #24292f;
  font-size: 16px;
  margin-bottom: 4px;
}

.org-info p {
  color: #656d76;
  font-size: 14px;
  margin: 0;
  line-height: 1.4;
}

/* Organization Dropdown */
.org-dropdown-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.org-dropdown-container label {
  font-size: 14px;
  font-weight: 600;
  color: #24292f;
  white-space: nowrap;
}

.org-dropdown {
  padding: 8px 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: white;
  font-size: 14px;
  cursor: pointer;
  min-width: 150px;
}

.org-dropdown:focus {
  outline: none;
  border-color: #0969da;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

/* Hidden class for multi-step UI */
.hidden {
  display: none !important;
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #0969da;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Controls */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.controls-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.refresh-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

#clearDataButton {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

#clearDataButton:hover {
  background-color: #c82333;
}

.warning {
  background-color: #dc8035 !important;
}

#lastUpdated {
  color: #656d76;
  font-size: 14px;
}

.rate-limit-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.rate-limit-container span {
  font-size: 12px;
}

.rate-limit-ok {
  color: #656d76;
}

.rate-limit-low {
  color: #d73a49;
  font-weight: 600;
}

.loading-inline {
  color: #0969da;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.loading-inline[style*="block"] {
  opacity: 1;
}

/* CI Status Container */
.ci-status-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ci-status-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

/* Failed Checks List */
.failed-checks-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
  flex: 1;
}

.failed-checks-list li {
  margin: 1px 0;
}

.check-link {
  color: #dc2626;
  text-decoration: none;
  font-weight: 500;
}

.check-link:hover {
  text-decoration: underline;
}

/* Expand Checks Button */
.expand-checks-item {
  margin: 2px 0;
}

.expand-checks-button {
  background: none;
  border: none;
  color: #656d76;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
  transition: color 0.2s ease;
}

.expand-checks-button:hover {
  color: #24292f;
}

.hidden-checks {
  margin: 0;
  padding: 0;
}

/* Re-run Button */
.rerun-button {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  background-color: #f6f8fa;
  color: #24292f;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 50px;
  text-align: center;
}

.rerun-button:hover:not(:disabled) {
  background-color: #f3f4f6;
  border-color: #afb8c1;
}

.rerun-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.rerun-button.loading {
  background-color: #0969da;
  color: white;
  border-color: #0969da;
}

.rerun-button.success {
  background-color: #1f883d;
  color: white;
  border-color: #1f883d;
}

.rerun-button.warning {
  background-color: #fb8500;
  color: white;
  border-color: #fb8500;
}

.rerun-button.error {
  background-color: #da3633;
  color: white;
  border-color: #da3633;
}

/* Convert Draft Button */
.convert-draft-button {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  background-color: #f6f8fa;
  color: #24292f;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-right: 2px;
}

.convert-draft-button:hover:not(:disabled) {
  background-color: #f3f4f6;
  border-color: #afb8c1;
}

.convert-draft-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.convert-draft-button.loading {
  background-color: #0969da;
  color: white;
  border-color: #0969da;
}

.convert-draft-button.success {
  background-color: #1f883d;
  color: white;
  border-color: #1f883d;
}

.convert-draft-button.warning {
  background-color: #fb8500;
  color: white;
  border-color: #fb8500;
}

.convert-draft-button.error {
  background-color: #da3633;
  color: white;
  border-color: #da3633;
}

/* Sync Button */
.sync-button {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  background-color: #f6f8fa;
  color: #24292f;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-right: 2px;
}

.sync-button:hover:not(:disabled) {
  background-color: #f3f4f6;
  border-color: #afb8c1;
}

.sync-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.sync-button.loading {
  background-color: #0969da;
  color: white;
  border-color: #0969da;
}

.sync-button.success {
  background-color: #1f883d;
  color: white;
  border-color: #1f883d;
}

.sync-button.warning {
  background-color: #fb8500;
  color: white;
  border-color: #fb8500;
}

.sync-button.error {
  background-color: #da3633;
  color: white;
  border-color: #da3633;
}

/* Loading and Error States */
.loading,
.error,
.no-data {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.error {
  background-color: #fdf2f2;
  color: #dc3545;
  border-left: 4px solid #dc3545;
}

.no-data {
  color: #656d76;
}

/* Table */
.table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: opacity 0.3s ease;
  width: 98%;
  margin: 0 auto;
}

.table-container.loading {
  opacity: 0.7;
  position: relative;
}

.table-container.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(1px);
  z-index: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background-color: #f6f8fa;
  border-bottom: 2px solid #d0d7de;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #d0d7de;
}

th {
  font-weight: 600;
  color: #24292f;
}

/* Fixed widths for Repository and Author columns */
th:nth-child(1),
td:nth-child(1) {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th:nth-child(2),
td:nth-child(2) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
}

/* sttatus*/
th:nth-child(4),
td:nth-child(4) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
}

/* Actions column */
/*th:nth-child(7),*/
/*td:nth-child(7) {*/
/*white-space: nowrap;*/
/*}*/

.actions-cell {
  padding: 8px 4px;
}

tbody {
  transition: opacity 0.2s ease;
}

tbody tr:hover {
  background-color: #f6f8fa;
}

.stale-pr {
  background-color: #fef3c7 !important;
}

.stale-pr:hover {
  background-color: #fde68a !important;
}

.blocked-by-other-pr {
  background-color: #f3f4f6 !important;
  opacity: 0.7;
}

.blocked-by-other-pr:hover {
  background-color: #e5e7eb !important;
  opacity: 0.8;
}

.ready-to-be-merged {
  background-color: #23e42d !important;
}

.ready-to-be-merged:hover {
  background-color: #bbf7d0 !important;
}
/* PR Link */
.pr-link {
  color: #0969da;
  text-decoration: none;
  font-weight: 500;
}

.pr-link:hover {
  text-decoration: underline;
}

.jira-link {
  color: #0052cc;
  text-decoration: none;
  font-weight: 600;
  background-color: #deebff;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 12px;
}

.jira-link:hover {
  background-color: #b3d4ff;
  text-decoration: none;
}

/* Author Avatar */
.author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #d0d7de;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge.success {
  background-color: #dcfdf2;
  color: #166534;
}

.status-badge.warning {
  background-color: #fef3c7;
  color: white;
}

.status-badge.error {
  background-color: #fecaca;
  color: #dc2626;
}

.status-badge.neutral {
  background-color: #f3f4f6;
  color: #6b7280;
}

.status-badge.open {
  background-color: #dcfce7;
  color: #166534;
}

.status-badge.closed {
  background-color: #fee2e2;
  color: #dc2626;
}

.draft-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  background-color: #6b7280;
  color: white;
  border-radius: 8px;
  text-transform: uppercase;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .controls {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .controls-left {
    align-items: center;
    text-align: center;
  }

  .controls-right {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .refresh-section {
    justify-content: center;
  }

  .table-container {
    overflow-x: auto;
  }

  table {
    min-width: 600px;
  }

  th,
  td {
    padding: 8px 12px;
  }

  .auth-form input {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  th,
  td {
    padding: 6px 8px;
    font-size: 14px;
  }

  .status-badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  header h1 {
    font-size: 24px;
  }
}
