/* ========================================
   ADMIN ACTIONS DASHBOARD
   Ops-style detail view for action tracking
   ======================================== */

/* Status hero banner */
.action-hero {
  border-radius: var(--arp-radius-lg);
  padding: var(--arp-space-6) var(--arp-space-8);
  color: white;
  margin-bottom: var(--arp-space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--arp-space-4);
  flex-wrap: wrap;
}

.action-hero.is-pending {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.action-hero.is-queued {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.action-hero.is-running {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.action-hero.is-done {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.action-hero.is-failed {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.action-hero.is-cancelled {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

[data-theme="dark"] .action-hero.is-pending {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

[data-theme="dark"] .action-hero.is-queued {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

[data-theme="dark"] .action-hero.is-running {
  background: linear-gradient(135deg, #4c5fd5 0%, #5e3d8a 100%);
}

[data-theme="dark"] .action-hero.is-done {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

[data-theme="dark"] .action-hero.is-failed {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

[data-theme="dark"] .action-hero.is-cancelled {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

.action-hero-content {
  display: flex;
  align-items: center;
  gap: var(--arp-space-4);
}

.action-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.action-hero-text h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 var(--arp-space-1) 0;
  color: white;
}

.action-hero-text p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.action-hero-text code {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.15rem var(--arp-space-2);
  border-radius: var(--arp-radius-xs);
  font-size: 0.85rem;
}

.action-hero-actions {
  display: flex;
  gap: var(--arp-space-3);
  align-items: center;
}

.action-hero-actions .button {
  --bulma-duration: 0ms;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.action-hero-actions .button:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Detail card */
.action-detail-card {
  background: var(--arp-surface-raised);
  border-radius: var(--arp-radius-lg);
  border: 1px solid var(--arp-border);
  overflow: hidden;
  margin-bottom: var(--arp-space-6);
}

.action-detail-card-header {
  padding: var(--arp-space-4) var(--arp-space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--arp-border-subtle);
}

.action-detail-card-header-title {
  font-weight: 600;
  color: var(--arp-text-primary);
  display: flex;
  align-items: center;
  gap: var(--arp-space-2);
}

.action-detail-card-header-title .icon {
  color: var(--arp-text-muted);
}

.action-detail-card-body {
  padding: var(--arp-space-5);
}

.action-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--arp-space-5);
}

.action-detail {
  display: flex;
  flex-direction: column;
  gap: var(--arp-space-1);
}

.action-detail-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--arp-text-disabled);
  font-weight: 500;
}

[data-theme="dark"] .action-detail-label {
  color: var(--arp-text-muted);
}

.action-detail-value {
  color: #374151;
}

[data-theme="dark"] .action-detail-value {
  color: var(--arp-text-secondary);
}

.action-detail-value code {
  background: var(--arp-status-neutral-bg);
  padding: 0.15rem 0.4rem;
  border-radius: var(--arp-radius-xs);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

[data-theme="dark"] .action-detail-value code {
  background: #374151;
}

.action-detail-value a {
  font-weight: 500;
}

/* Dispatch method badge */
.action-dispatch-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--arp-space-1-5);
  padding: 0.2rem 0.6rem;
  border-radius: var(--arp-radius-xs);
  font-size: 0.75rem;
  font-weight: 500;
}

.action-dispatch-badge.is-http-agent {
  background: #ecfeff;
  color: #0891b2;
}

.action-dispatch-badge.is-sidekiq {
  background: #fce7f3;
  color: #be185d;
}

[data-theme="dark"] .action-dispatch-badge.is-http-agent {
  background: #164e63;
  color: #22d3ee;
}

[data-theme="dark"] .action-dispatch-badge.is-sidekiq {
  background: #831843;
  color: #f9a8d4;
}

/* Card footer for timestamps */
.action-detail-card-footer {
  padding: var(--arp-space-2-5) var(--arp-space-5);
  border-top: 1px solid var(--arp-border-subtle);
  background: #fafafa;
  display: flex;
  gap: var(--arp-space-6);
  color: var(--arp-text-muted);
}

[data-theme="dark"] .action-detail-card-footer {
  border-color: var(--arp-border);
  background: var(--arp-surface-muted);
  color: var(--arp-text-muted);
}

/* Error panel */
.action-error-panel {
  background: var(--arp-status-danger-bg);
  border-top: 1px solid #fecaca;
  padding: var(--arp-space-3) var(--arp-space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--arp-space-2);
}

[data-theme="dark"] .action-error-panel {
  border-color: #7f1d1d;
}

.action-error-panel .error-icon {
  color: var(--arp-status-danger-fg);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.action-error-panel .error-message {
  color: #991b1b;
  word-break: break-word;
}

[data-theme="dark"] .action-error-panel .error-message {
  color: #fca5a5;
}

/* JSON payload card */
.action-payload-card {
  background: var(--arp-surface-raised);
  border-radius: var(--arp-radius-lg);
  border: 1px solid var(--arp-border);
  overflow: hidden;
  margin-bottom: var(--arp-space-6);
}

.action-payload-card-header {
  padding: var(--arp-space-3) var(--arp-space-5);
  border-bottom: 1px solid var(--arp-border-subtle);
  display: flex;
  align-items: center;
  gap: var(--arp-space-2);
  font-weight: 600;
  color: var(--arp-text-primary);
}

.action-payload-card-header .icon {
  color: var(--arp-text-muted);
}

.action-payload-card-body {
  padding: 0;
}

.action-payload-card-body pre {
  margin: 0;
  padding: var(--arp-space-4) var(--arp-space-5);
  border-radius: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.action-payload-card-body pre.action-log {
  white-space: pre;
  word-break: normal;
  overflow-x: auto;
}

/* ========================================
   INDEX PAGE - Stats & Table
   ======================================== */

/* Stats pill row */
.action-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--arp-space-2);
  margin-bottom: var(--arp-space-5);
}

.action-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--arp-radius-full);
  border: 1px solid var(--arp-border);
  background: var(--arp-surface-raised);
  text-decoration: none;
}

.action-stat-pill:hover {
  border-color: var(--arp-border-strong);
}

.action-stat-pill .stat-count {
  font-weight: 700;
}

.action-stat-pill .stat-label {
  color: var(--arp-text-muted);
  font-weight: 500;
}


/* Pill color variants */
.action-stat-pill.is-total .stat-count, .action-stat-pill.is-total .fas { color: #3b82f6; }
.action-stat-pill.is-pending .stat-count, .action-stat-pill.is-pending .fas { color: #64748b; }
.action-stat-pill.is-queued .stat-count, .action-stat-pill.is-queued .fas { color: #3b82f6; }
.action-stat-pill.is-running .stat-count, .action-stat-pill.is-running .fas { color: #7c3aed; }
.action-stat-pill.is-done .stat-count, .action-stat-pill.is-done .fas { color: #10b981; }
.action-stat-pill.is-failed .stat-count, .action-stat-pill.is-failed .fas { color: #ef4444; }
.action-stat-pill.is-cancelled .stat-count, .action-stat-pill.is-cancelled .fas { color: #6b7280; }
.action-stat-pill.is-on-hold .stat-count, .action-stat-pill.is-on-hold .fas { color: #ef4444; }
.action-stat-pill.is-actionable .stat-count, .action-stat-pill.is-actionable .fas { color: #f59e0b; }
.action-stat-pill.is-open .stat-count, .action-stat-pill.is-open .fas { color: #10b981; }
.action-stat-pill.is-unassigned .stat-count, .action-stat-pill.is-unassigned .fas { color: #6b7280; }
.action-stat-pill.is-my-tickets .stat-count, .action-stat-pill.is-my-tickets .fas { color: #7c3aed; }
.action-stat-pill.is-unpaid-recent .stat-count, .action-stat-pill.is-unpaid-recent .fas { color: #ef4444; }
.action-stat-pill.is-unpaid .stat-count, .action-stat-pill.is-unpaid .fas { color: #f59e0b; }
.action-stat-pill.is-pending-review .stat-count, .action-stat-pill.is-pending-review .fas { color: #3b82f6; }
.action-stat-pill.is-this-month .stat-count, .action-stat-pill.is-this-month .fas { color: #6b7280; }
.action-stat-pill.is-suspended .stat-count, .action-stat-pill.is-suspended .fas { color: #ef4444; }
.action-stat-pill.is-missing-country .stat-count, .action-stat-pill.is-missing-country .fas { color: #f59e0b; }

[data-theme="dark"] .action-stat-pill.is-total .stat-count, [data-theme="dark"] .action-stat-pill.is-total .fas { color: #60a5fa; }
[data-theme="dark"] .action-stat-pill.is-pending .stat-count, [data-theme="dark"] .action-stat-pill.is-pending .fas { color: #94a3b8; }
[data-theme="dark"] .action-stat-pill.is-queued .stat-count, [data-theme="dark"] .action-stat-pill.is-queued .fas { color: #60a5fa; }
[data-theme="dark"] .action-stat-pill.is-running .stat-count, [data-theme="dark"] .action-stat-pill.is-running .fas { color: #c4b5fd; }
[data-theme="dark"] .action-stat-pill.is-done .stat-count, [data-theme="dark"] .action-stat-pill.is-done .fas { color: #34d399; }
[data-theme="dark"] .action-stat-pill.is-failed .stat-count, [data-theme="dark"] .action-stat-pill.is-failed .fas { color: #f87171; }
[data-theme="dark"] .action-stat-pill.is-cancelled .stat-count, [data-theme="dark"] .action-stat-pill.is-cancelled .fas { color: #9ca3af; }
[data-theme="dark"] .action-stat-pill.is-on-hold .stat-count, [data-theme="dark"] .action-stat-pill.is-on-hold .fas { color: #f87171; }
[data-theme="dark"] .action-stat-pill.is-actionable .stat-count, [data-theme="dark"] .action-stat-pill.is-actionable .fas { color: #fbbf24; }
[data-theme="dark"] .action-stat-pill.is-open .stat-count, [data-theme="dark"] .action-stat-pill.is-open .fas { color: #34d399; }
[data-theme="dark"] .action-stat-pill.is-unassigned .stat-count, [data-theme="dark"] .action-stat-pill.is-unassigned .fas { color: #9ca3af; }
[data-theme="dark"] .action-stat-pill.is-my-tickets .stat-count, [data-theme="dark"] .action-stat-pill.is-my-tickets .fas { color: #c4b5fd; }
[data-theme="dark"] .action-stat-pill.is-unpaid-recent .stat-count, [data-theme="dark"] .action-stat-pill.is-unpaid-recent .fas { color: #f87171; }
[data-theme="dark"] .action-stat-pill.is-unpaid .stat-count, [data-theme="dark"] .action-stat-pill.is-unpaid .fas { color: #fbbf24; }
[data-theme="dark"] .action-stat-pill.is-pending-review .stat-count, [data-theme="dark"] .action-stat-pill.is-pending-review .fas { color: #60a5fa; }
[data-theme="dark"] .action-stat-pill.is-this-month .stat-count, [data-theme="dark"] .action-stat-pill.is-this-month .fas { color: #9ca3af; }
[data-theme="dark"] .action-stat-pill.is-suspended .stat-count, [data-theme="dark"] .action-stat-pill.is-suspended .fas { color: #f87171; }
[data-theme="dark"] .action-stat-pill.is-missing-country .stat-count, [data-theme="dark"] .action-stat-pill.is-missing-country .fas { color: #fbbf24; }

/* Active pill (selected filter) */
.action-stat-pill.is-active { border-width: 2px; }
.action-stat-pill.is-active.is-total { border-color: #3b82f6; }
.action-stat-pill.is-active.is-pending { border-color: #64748b; }
.action-stat-pill.is-active.is-queued { border-color: #3b82f6; }
.action-stat-pill.is-active.is-running { border-color: #7c3aed; }
.action-stat-pill.is-active.is-done { border-color: #10b981; }
.action-stat-pill.is-active.is-failed { border-color: #ef4444; }
.action-stat-pill.is-active.is-cancelled { border-color: #6b7280; }
.action-stat-pill.is-active.is-on-hold { border-color: #ef4444; }
.action-stat-pill.is-active.is-actionable { border-color: #f59e0b; }
.action-stat-pill.is-active.is-open { border-color: #10b981; }
.action-stat-pill.is-active.is-unassigned { border-color: #6b7280; }
.action-stat-pill.is-active.is-my-tickets { border-color: #7c3aed; }
.action-stat-pill.is-active.is-unpaid-recent { border-color: #ef4444; }
.action-stat-pill.is-active.is-unpaid { border-color: #f59e0b; }
.action-stat-pill.is-active.is-pending-review { border-color: #3b82f6; }
.action-stat-pill.is-active.is-this-month { border-color: #6b7280; }
.action-stat-pill.is-active.is-suspended { border-color: #ef4444; }
.action-stat-pill.is-active.is-missing-country { border-color: #f59e0b; }

[data-theme="dark"] .action-stat-pill.is-active.is-total { border-color: #60a5fa; }
[data-theme="dark"] .action-stat-pill.is-active.is-pending { border-color: #94a3b8; }
[data-theme="dark"] .action-stat-pill.is-active.is-queued { border-color: #60a5fa; }
[data-theme="dark"] .action-stat-pill.is-active.is-running { border-color: #c4b5fd; }
[data-theme="dark"] .action-stat-pill.is-active.is-done { border-color: #34d399; }
[data-theme="dark"] .action-stat-pill.is-active.is-failed { border-color: #f87171; }
[data-theme="dark"] .action-stat-pill.is-active.is-cancelled { border-color: #9ca3af; }
[data-theme="dark"] .action-stat-pill.is-active.is-on-hold { border-color: #f87171; }
[data-theme="dark"] .action-stat-pill.is-active.is-actionable { border-color: #fbbf24; }
[data-theme="dark"] .action-stat-pill.is-active.is-open { border-color: #34d399; }
[data-theme="dark"] .action-stat-pill.is-active.is-unassigned { border-color: #9ca3af; }
[data-theme="dark"] .action-stat-pill.is-active.is-my-tickets { border-color: #c4b5fd; }
[data-theme="dark"] .action-stat-pill.is-active.is-unpaid-recent { border-color: #f87171; }
[data-theme="dark"] .action-stat-pill.is-active.is-unpaid { border-color: #fbbf24; }
[data-theme="dark"] .action-stat-pill.is-active.is-pending-review { border-color: #60a5fa; }
[data-theme="dark"] .action-stat-pill.is-active.is-this-month { border-color: #9ca3af; }
[data-theme="dark"] .action-stat-pill.is-active.is-suspended { border-color: #f87171; }
[data-theme="dark"] .action-stat-pill.is-active.is-missing-country { border-color: #fbbf24; }

/* Table card wrapper */
.action-table-card {
  background: var(--arp-surface-raised);
  border-radius: var(--arp-radius-lg);
  border: 1px solid var(--arp-border);
  overflow: hidden;
}

.action-table-card-header {
  padding: var(--arp-space-4) var(--arp-space-5);
  border-bottom: 1px solid var(--arp-border-subtle);
}

.action-table-card-body {
  padding: 0 var(--arp-space-5) var(--arp-space-5);
}

.action-table-card-body .table-container {
  margin-top: var(--arp-space-4);
}

.action-table-card-footer {
  padding: var(--arp-space-3) var(--arp-space-5);
  border-top: 1px solid var(--arp-border-subtle);
  background: #fafafa;
}

[data-theme="dark"] .action-table-card-footer {
  border-color: var(--arp-border);
  background: var(--arp-surface-muted);
}

/* Responsive */
@media screen and (max-width: 768px) {
  .action-hero {
    flex-direction: column;
    text-align: center;
  }

  .action-hero-content {
    flex-direction: column;
  }

  .action-hero-actions {
    width: 100%;
    justify-content: center;
  }

  .action-detail-grid {
    grid-template-columns: 1fr;
  }

  .action-stats-row {
    gap: var(--arp-space-1-5);
  }

  .action-detail-card-footer {
    flex-direction: column;
    gap: var(--arp-space-2);
  }
}
