/* Archive page specific styles */

.archive-page .layout {
  display: block;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 64px;
}

.archive-page .board {
  min-height: 400px;
  overflow-y: visible;
  overscroll-behavior: auto;
}

/* Archive table container */
.archive-table-container {
  overflow-x: auto;
  margin: 0 -14px;
  padding: 0 14px;
}

/* Archive table */
.archive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.archive-table th,
.archive-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.archive-table th {
  background: var(--surface-alt);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 1;
}

.archive-table tbody tr {
  transition: background 0.15s ease;
}

.archive-table tbody tr:hover {
  background: rgba(210, 107, 52, 0.04);
}

.archive-table tbody tr.selected {
  background: rgba(210, 107, 52, 0.08);
}

/* Child row styling */
.archive-table tbody tr.child-row {
  background: rgba(27, 27, 27, 0.02);
}

.archive-table tbody tr.child-row:hover {
  background: rgba(210, 107, 52, 0.06);
}

.archive-table tbody tr.child-row td {
  padding-left: 48px;
}

.archive-table tbody tr.child-row td:first-child {
  padding-left: 14px;
}

/* Checkbox column */
.archive-table .col-checkbox {
  width: 40px;
  text-align: center;
}

.archive-table .col-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Expand column */
.archive-table .col-expand {
  width: 40px;
  text-align: center;
}

.expand-btn {
  border: none;
  background: rgba(27, 27, 27, 0.08);
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.expand-btn:hover {
  background: rgba(210, 107, 52, 0.15);
  color: var(--accent-strong);
}

.expand-btn.expanded {
  transform: rotate(90deg);
}

.expand-btn[hidden] {
  visibility: hidden;
}

/* Board column */
.archive-table .col-board {
  min-width: 120px;
}

/* Stage column */
.archive-table .col-stage {
  min-width: 100px;
}

/* Card name column */
.archive-table .col-name {
  min-width: 200px;
  max-width: 400px;
}

.archive-table .col-name a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.archive-table .col-name a:hover {
  color: var(--accent-strong);
}

/* Priority column */
.archive-table .col-priority {
  width: 80px;
}

/* Archived column */
.archive-table .col-archived {
  min-width: 140px;
}

/* Priority badges */
.priority-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  display: inline-block;
}

.priority-badge.low {
  background: var(--low);
}

.priority-badge.medium {
  background: var(--medium);
}

.priority-badge.high {
  background: var(--high);
}

/* Actions column */
.archive-table .col-actions {
  width: 160px;
  text-align: right;
}

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

.archive-actions .action-btn {
  border: 1px solid;
  background: transparent;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.archive-actions .action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.archive-actions .action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.archive-actions .restore-btn {
  border-color: rgba(47, 159, 99, 0.4);
  color: var(--low);
}

.archive-actions .restore-btn:hover:not(:disabled) {
  background: rgba(47, 159, 99, 0.12);
}

.archive-actions .delete-btn {
  border-color: rgba(208, 68, 47, 0.4);
  color: var(--high);
}

.archive-actions .delete-btn:hover:not(:disabled) {
  background: rgba(208, 68, 47, 0.12);
}

/* Bulk actions bar */
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface-alt);
  border-radius: 10px;
  margin-bottom: 16px;
}

.bulk-actions[hidden] {
  display: none;
}

.bulk-actions .selection-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.bulk-actions .bulk-btn {
  border: 1px solid;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.bulk-actions .bulk-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.bulk-actions .bulk-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bulk-actions .bulk-restore-btn {
  border-color: rgba(47, 159, 99, 0.4);
  color: var(--low);
}

.bulk-actions .bulk-restore-btn:hover:not(:disabled) {
  background: rgba(47, 159, 99, 0.12);
}

.bulk-actions .bulk-delete-btn {
  border-color: rgba(208, 68, 47, 0.4);
  color: var(--high);
}

.bulk-actions .bulk-delete-btn:hover:not(:disabled) {
  background: rgba(208, 68, 47, 0.12);
}

/* Loading state */
.archive-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Empty state - already styled in layout.css */

/* Status indicator */
.archive-status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1rem;
  margin-bottom: 12px;
}

.archive-status.busy {
  color: var(--accent-strong);
  font-weight: 600;
}

.archive-status.success {
  color: var(--low);
  font-weight: 600;
}

.archive-status.error {
  color: var(--high);
  font-weight: 600;
}

/* Card type indicator */
.card-type-indicator {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 8px;
}

/* Orphaned badge */
.orphaned-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(27, 27, 27, 0.06);
  border: 1px solid rgba(27, 27, 27, 0.12);
  border-radius: 999px;
  vertical-align: middle;
}

/* Archived date */
.archived-date {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Archive layout with detail panel */

.archive-layout.detail-visible {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 400px);
  gap: 24px;
  height: calc(100vh - 220px);
  min-height: 400px;
}

.archive-layout.detail-visible .board {
  overflow-y: auto;
}

/* Archive detail panel */
.archive-detail {
  min-width: 0;
  overflow-y: auto;
  min-height: 0;
}

.archive-detail[hidden] {
  display: none;
}

.archive-detail .detail-card {
  background: var(--surface-strong);
  border-radius: 24px;
  border: 1px solid rgba(27, 27, 27, 0.08);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
  animation: float-in 0.3s ease both;
}

/* Detail row selection highlight */
.archive-table tbody tr.detail-selected {
  background: rgba(210, 107, 52, 0.12);
  border-left: 3px solid var(--accent-strong);
}

.archive-table tbody tr.detail-selected:hover {
  background: rgba(210, 107, 52, 0.16);
}

/* Detail panel action buttons at bottom */
.archive-detail-actions {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.archive-detail-actions .action-btn {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.archive-detail-actions .action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.archive-detail-actions .restore-btn {
  border-color: rgba(47, 159, 99, 0.4);
  color: var(--low);
}

.archive-detail-actions .restore-btn:hover:not(:disabled) {
  background: rgba(47, 159, 99, 0.12);
}

.archive-detail-actions .delete-btn {
  border-color: rgba(208, 68, 47, 0.4);
  color: var(--high);
}

.archive-detail-actions .delete-btn:hover:not(:disabled) {
  background: rgba(208, 68, 47, 0.12);
}

/* Message list styles for archive detail */
.archive-detail .message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-detail .message-item {
  padding: 12px;
  background: var(--surface-alt);
  border-radius: 12px;
  border: 1px solid rgba(27, 27, 27, 0.08);
}

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

.archive-detail .message-time {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.archive-detail .message-body {
  font-size: 0.9rem;
  line-height: 1.5;
}

.archive-detail .message-body.markdown {
  /* Inherit markdown styles from layout.css */
}

.archive-detail .message-body.markdown p {
  margin: 0 0 0.5em;
}

.archive-detail .message-body.markdown p:last-child {
  margin-bottom: 0;
}

/* Toast styles for archive page */
.toast.success {
  background: rgba(47, 159, 99, 0.95);
  color: #fff;
  border-color: rgba(47, 159, 99, 0.6);
}

.toast.error {
  background: rgba(208, 68, 47, 0.95);
  color: #fff;
  border-color: rgba(208, 68, 47, 0.6);
}

/* Responsive adjustments */
@media (max-width: 720px) {
  .archive-table .col-board,
  .archive-table .col-stage,
  .archive-table .col-archived {
    display: none;
  }

  .archive-table .col-name {
    max-width: none;
  }

  .archive-actions {
    flex-direction: column;
    gap: 4px;
  }

  .bulk-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .bulk-actions .bulk-btn {
    width: 100%;
  }

  .archive-layout.detail-visible {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  .archive-detail {
    overflow-y: visible;
    max-height: none;
  }
}
