/* Card Status Radar & Changelog Styling
 *
 * Loaded by every card profile page and by /tools/status-radar/, so what lives
 * here is shared furniture: the lifecycle bar, the alert banner, the changelog
 * timeline. Styles only the radar page can use are in /radar-page.css, which
 * that one page loads.
 */

.lifecycle-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7faf7;
  border: 1px solid #d8e5d6;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0 20px;
  overflow-x: auto;
  white-space: nowrap;
}

.lifecycle-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.lifecycle-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.lifecycle-step {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  /* The stages the card has not reached are de-emphasised with colour and a
     flat fill, not with opacity: fading the text took it to 3.56:1 against the
     chip, below the 4.5:1 a label this size needs. */
  color: #55635b;
  background: #f7f9f6;
  border: 1px solid #dfe7dd;
}

.lifecycle-step.is-current {
  opacity: 1;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.lifecycle-step.step-active.is-current {
  color: #0d632f;
  background: #edf8f1;
  border-color: #8edaa8;
}

.lifecycle-step.step-degraded.is-current {
  color: #8a5700;
  background: #fef8eb;
  border-color: #f7c978;
}

.lifecycle-step.step-paused.is-current {
  color: #1e40af;
  background: #eff6ff;
  border-color: #93c5fd;
}

.lifecycle-step.step-winddown.is-current {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}

.lifecycle-step.step-closed.is-current {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fca5a5;
}

.lifecycle-arrow {
  color: #62746a;
  font-size: 11px;
}

/* Card Incident & Risk Banner */
.radar-alert-banner {
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0 24px;
  border: 1px solid;
}

.radar-alert-banner.alert-critical {
  background: #fff5f5;
  border-color: #f8b4b4;
  color: #991b1b;
}

.radar-alert-banner.alert-warning {
  background: #fffaf0;
  border-color: #fed7aa;
  color: #9a3412;
}

.radar-alert-banner.alert-info {
  background: #f0f7ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.radar-alert-banner h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.radar-alert-banner p {
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 10px;
  color: inherit;
  opacity: 0.9;
}

.radar-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid currentColor;
}

/* The lifecycle-stage filter row above the status matrix. These lived in the
   inline first-paint layer, which no longer exists; they belong to this page,
   and this is the only stylesheet it loads.
   min-height keeps the pills at the 24px target size WCAG 2.2 asks for. */
.hero-pill {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid #cbd8c4;
  background: #fff;
  color: var(--ink);
  min-height: 28px;
  cursor: pointer;
}

.hero-pill:hover {
  border-color: #38704c;
  background: #edf4eb;
  color: var(--ink);
  text-decoration: none;
}

/* The script toggles this class on the current filter, but nothing styled it,
   so the selected stage looked the same as the other five. */
.hero-pill.active {
  background: var(--deep);
  border-color: var(--deep);
  color: #fff;
}

/* Changelog Timeline */
.card-changelog-wrap {
  margin: 28px 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.changelog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.changelog-head h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.changelog-head span {
  font-size: 12px;
  color: var(--muted);
}

.changelog-timeline {
  position: relative;
  padding-left: 20px;
}

.changelog-timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: 2px;
  background: #e2ece0;
}

.changelog-item {
  position: relative;
  margin-bottom: 20px;
}

.changelog-item:last-child {
  margin-bottom: 0;
}

.changelog-dot {
  position: absolute;
  left: -18px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38704c;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #38704c;
}

.changelog-item.type-incident .changelog-dot {
  background: #ef4444;
  box-shadow: 0 0 0 2px #ef4444;
}

.changelog-item.type-fee .changelog-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px #f59e0b;
}

.changelog-item.type-reward .changelog-dot {
  background: #8b5cf6;
  box-shadow: 0 0 0 2px #8b5cf6;
}

.changelog-item.type-compliance .changelog-dot {
  background: #3b82f6;
  box-shadow: 0 0 0 2px #3b82f6;
}

.changelog-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.changelog-date {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.changelog-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f0f5ee;
  color: #38704c;
}

.changelog-item.type-incident .changelog-tag {
  background: #fee2e2;
  color: #b91c1c;
}

.changelog-item.type-fee .changelog-tag {
  background: #fef3c7;
  color: #b45309;
}

.changelog-item.type-reward .changelog-tag {
  background: #ede9fe;
  color: #6d28d9;
}

.changelog-item.type-compliance .changelog-tag {
  background: #dbeafe;
  color: #1d4ed8;
}

.changelog-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.changelog-note {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}


/* Timeliness & Freshness Dashboard */
.radar-freshness-dashboard {
  background: #f4f8f4;
  border: 1px solid #cfe0cd;
  border-radius: 10px;
  padding: 20px 24px;
  margin: 16px 0 28px;
}

.radar-freshness-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #dce8db;
}

.radar-freshness-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #285741;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.radar-freshness-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.radar-freshness-card {
  background: #fff;
  border: 1px solid #d5e2d3;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.radar-freshness-card .metric-label {
  font-size: 12.5px;
  color: #4b6354;
  font-weight: 600;
  margin-bottom: 6px;
}

.radar-freshness-card .metric-val {
  font-size: 22px;
  font-weight: 800;
  color: #1a422d;
  line-height: 1.2;
}

.radar-freshness-card .metric-sub {
  font-size: 11.5px;
  color: #6d8476;
  margin-top: 5px;
  line-height: 1.4;
}

@media (max-width: 860px) {
  .radar-freshness-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .radar-freshness-grid {
    grid-template-columns: 1fr;
  }
}

/* Google Web Push & Notifications Component */
.radar-push-section {
  margin: 28px 0;
}

.radar-push-card {
  background: linear-gradient(135deg, #f0f7f2 0%, #e8f3ec 100%);
  border: 1px solid #c2dbcb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(26,66,45,0.06);
}

.radar-push-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.radar-push-title {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
  min-width: 280px;
}

.radar-push-icon {
  font-size: 32px;
  line-height: 1;
  background: #ffffff;
  border: 1px solid #b5d5c0;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.radar-push-title h3 {
  font-size: 19px;
  font-weight: 800;
  color: #143322;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.radar-push-title p {
  font-size: 14px;
  color: #3b5a47;
  line-height: 1.55;
  margin: 0;
}

.radar-push-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.push-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1b4b32;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(27,75,50,0.25);
}

.push-btn:hover {
  background: #143825;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(27,75,50,0.3);
}

.push-btn.is-subscribed {
  background: #2e6945;
}

.radar-push-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #d3e4d8;
  border-radius: 8px;
  font-size: 13px;
  color: #324e3c;
  flex-wrap: wrap;
}

.push-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f59e0b;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}

.push-status-dot.active {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
}

.push-status-dot.denied {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

.push-tech-tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #5c7a67;
  background: #edf5ef;
  border: 1px solid #cfe0d5;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.radar-push-test-panel {
  margin-top: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px dashed #a8cdb6;
  border-radius: 8px;
}

.radar-push-test-panel strong {
  display: block;
  font-size: 13.5px;
  color: #173b26;
  margin-bottom: 4px;
}

.radar-push-test-panel p {
  font-size: 12.5px;
  color: #547360;
  margin: 0 0 12px;
}

.radar-push-test-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.push-test-btn {
  background: #f2f7f3;
  border: 1px solid #bad6c3;
  color: #1a422d;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.push-test-btn:hover {
  background: #e3efe6;
  border-color: #9ac2a6;
}

.push-test-btn.warning {
  border-color: #fed7aa;
  background: #fffbf5;
  color: #9a3412;
}

.push-test-btn.warning:hover {
  background: #ffedd5;
  border-color: #fdba74;
}

.push-test-btn.info {
  border-color: #bfdbfe;
  background: #f8faff;
  color: #1e40af;
}

.push-test-btn.info:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.radar-push-faq {
  margin-top: 14px;
}

.radar-push-faq details {
  font-size: 12.5px;
  color: #4b6654;
}

.radar-push-faq summary {
  cursor: pointer;
  font-weight: 600;
  color: #245239;
  user-select: none;
}

.radar-push-faq p {
  margin: 8px 0 0;
  line-height: 1.6;
}

.radar-push-faq code {
  background: #eaf3ed;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 11.5px;
  color: #143322;
}

.push-test-btn.is-firing {
  opacity: 0.7;
  transform: scale(0.97);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  pointer-events: none;
}

/* Radar Push Troubleshooting Box */
.radar-push-troubleshoot {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fbfdfb;
  border: 1px solid #d8e8dc;
  border-radius: 6px;
  font-size: 12px;
}

.radar-push-troubleshoot-header {
  font-weight: 700;
  color: #1b492f;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.radar-push-troubleshoot-list {
  margin: 0;
  padding-left: 18px;
  color: #41604c;
  line-height: 1.65;
}

.radar-push-troubleshoot-list li {
  margin-bottom: 5px;
}

.radar-push-troubleshoot-list li:last-child {
  margin-bottom: 0;
}

.radar-push-troubleshoot-list strong {
  color: #143322;
}

/* Push Notification In-Page High-Fidelity Toast UI */
.ucard-push-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 440px;
  width: calc(100vw - 32px);
}

.ucard-push-toast {
  pointer-events: auto;
  position: relative;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #c2decb;
  border-left: 5px solid #10b981;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 14px 36px -4px rgba(18, 43, 31, 0.22), 0 4px 14px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  overflow: hidden;
  animation: pushToastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ucard-push-toast:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -4px rgba(18, 43, 31, 0.28);
}

.ucard-push-toast.is-dismissing {
  animation: pushToastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes pushToastSlideIn {
  from {
    opacity: 0;
    transform: translateX(110%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes pushToastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(110%) scale(0.95);
  }
}

.push-toast-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 15px;
  color: #64748b;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  z-index: 2;
  transition: all 0.15s ease;
}

.push-toast-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.push-toast-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.push-toast-icon {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #d1fae5;
  background: #f0fdf4;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.push-toast-text {
  flex: 1;
  min-width: 0;
}

.push-toast-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #0f291e;
  line-height: 1.4;
  margin-bottom: 3px;
  padding-right: 22px;
}

.push-toast-body {
  font-size: 12px;
  line-height: 1.5;
  color: #3d5a49;
  margin: 0;
  word-break: break-word;
}

.push-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #10b981;
  width: 100%;
  animation: toastProgressBar 7s linear forwards;
}

@keyframes toastProgressBar {
  from { width: 100%; }
  to { width: 0%; }
}

@media (max-width: 600px) {
  .ucard-push-toast-container {
    top: 12px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}

/* The five-stage lifecycle bar is a single 640px row, so on narrow viewports it
   used to push the whole card profile past the right edge. Let it wrap and drop
   the decorative arrows instead of forcing a horizontal scroll. */
@media (max-width: 620px) {
  .lifecycle-bar {
    flex-wrap: wrap;
    white-space: normal;
    overflow-x: visible;
    row-gap: 8px;
  }

  .lifecycle-bar > a {
    margin-left: 0 !important;
  }

  .lifecycle-steps {
    flex-wrap: wrap;
    gap: 5px;
  }

  .lifecycle-arrow {
    display: none;
  }

  .lifecycle-step {
    font-size: 13px;
    padding: 4px 10px;
  }

  .changelog-tag {
    font-size: 13px;
  }

  .radar-action-pill,
  .changelog-head span,
  .changelog-date {
    font-size: 13px;
  }
}
