/* ============================================================================
 * status.zkillu.fr — custom styles (complements Tailwind utilities)
 * ========================================================================== */

:root {
  --zk-bg:        #0e1629;
  --zk-bg-2:      #0a1020;
  --zk-border:    #394a70;
}

html, body {
  background-color: var(--zk-bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom scrollbar to match palette */
::-webkit-scrollbar         { width: 10px; height: 10px; }
::-webkit-scrollbar-track   { background: var(--zk-bg-2); }
::-webkit-scrollbar-thumb   { background: var(--zk-border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #4a5f8a; }

/* ----- Uptime sparkline (30 days, under each service row) ----------------- */
.uptime-grid {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 3px;
  height: 22px;
  width: 100%;
  max-width: 640px;
}
@media (max-width: 640px) {
  .uptime-grid { height: 18px; gap: 2px; }
}
.uptime-grid .day {
  border-radius: 2px;
  background-color: #1f2b48;             /* darker than the row, but visible */
  background-image: linear-gradient(
    135deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.04) 50%,
    rgba(255,255,255,0.0)  50%,
    rgba(255,255,255,0.0)  100%
  );                                     /* subtle stripe = "no data" hint   */
  background-size: 6px 6px;
  transition: background-color 200ms ease, transform 120ms ease;
  cursor: pointer;
}
.uptime-grid .day.ok       { background-color: #22c55e; background-image: none; }
.uptime-grid .day.degraded { background-color: #eab308; background-image: none; }
.uptime-grid .day.partial  { background-color: #f97316; background-image: none; }
.uptime-grid .day.outage   { background-color: #ef4444; background-image: none; }
.uptime-grid .day:hover    { transform: scaleY(1.2); filter: brightness(1.2); }

/* ----- Status pulse for hero when bad ------------------------------------- */
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 0.95; }
  50%      { box-shadow: 0 0 0 8px transparent; opacity: 1; }
}
.status-pulse {
  animation: status-pulse 2.2s ease-in-out infinite;
  color: currentColor;
}

/* ----- Fade-in for content swaps ------------------------------------------ */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 240ms ease-out both; }

/* ----- Reduce motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ----- Status badges (text + dot) ----------------------------------------- */
.status-badge {
  display: inline-flex; align-items: center; gap: 0.375rem;
  font-size: 0.75rem; font-weight: 500;
  padding: 0.125rem 0.5rem; border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.04);
}
.status-badge .dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; }

/* ----- Uptime tooltip ----------------------------------------------------- */
#uptime-tooltip {
  position: absolute;
  z-index: 60;
  min-width: 240px;
  max-width: 320px;
  padding: 10px 12px;
  background: rgba(10, 16, 32, 0.97);
  border: 1px solid #394a70;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.45;
  animation: fade-in 120ms ease-out;
}
#uptime-tooltip a, #uptime-tooltip [data-incident-link] {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
#uptime-tooltip [data-incident-link]:hover .tt-inc-pid,
#uptime-tooltip [data-incident-link]:focus .tt-inc-pid {
  color: #bfdbfe;
  text-decoration: underline;
}
#uptime-tooltip[hidden] { display: none; }

#uptime-tooltip .tt-date {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 4px;
  color: #f3f4f6;
  text-transform: capitalize;
}
#uptime-tooltip .tt-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: #cbd5e1;
  padding-bottom: 6px;
  border-bottom: 1px solid #394a70;
  margin-bottom: 6px;
}
#uptime-tooltip .tt-dot {
  width: 8px; height: 8px; border-radius: 9999px;
}
#uptime-tooltip .tt-empty {
  font-size: 11px;
  color: #9ca3af;
  font-style: italic;
  margin: 0;
}
#uptime-tooltip .tt-count {
  font-size: 10.5px;
  font-weight: 600;
  color: #fde68a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 6px 0;
}
#uptime-tooltip .tt-incidents {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
#uptime-tooltip .tt-incidents li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 6px;
  align-items: baseline;
  font-size: 11px;
}
#uptime-tooltip .tt-inc-pid {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px;
  color: #93c5fd;
}
#uptime-tooltip .tt-inc-sev {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  background: #394a70;
  color: #e5e7eb;
}
#uptime-tooltip .tt-inc-sev-minor    { background: #eab30833; color: #fde68a; }
#uptime-tooltip .tt-inc-sev-major    { background: #f9731633; color: #fed7aa; }
#uptime-tooltip .tt-inc-sev-critical { background: #ef444433; color: #fecaca; }
#uptime-tooltip .tt-inc-title {
  color: #d1d5db;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Make the cells indicate they're interactive */
.uptime-grid .day {
  outline: none;
}
.uptime-grid .day:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}
.uptime-grid .day[data-incident-link] {
  cursor: pointer;
}
/* Multi-incident day: small white dot in the upper-right corner */
.uptime-grid .day[data-multi] {
  position: relative;
}
.uptime-grid .day[data-multi]::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

/* ----- Incident detail page ---------------------------------------------- */
.incident-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
  padding-left: 22px;
}
.incident-timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgba(57, 74, 112, 0.5);
}
.timeline-item {
  position: relative;
  padding-bottom: 16px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -22px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #0e1629;
  box-shadow: 0 0 0 1px rgba(57, 74, 112, 0.6);
}
.timeline-item.is-latest .timeline-dot {
  box-shadow: 0 0 0 1px currentColor, 0 0 0 4px rgba(255,255,255,0.04);
}
.timeline-card {
  background: rgba(21, 32, 56, 0.55);
  border: 1px solid rgba(57, 74, 112, 0.5);
  border-radius: 8px;
  padding: 10px 14px;
}
.timeline-card > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.timeline-status {
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.timeline-meta {
  font-size: 11px;
  color: #9ca3af;
}
.timeline-msg {
  font-size: 13px;
  line-height: 1.55;
  color: #d1d5db;
  margin: 0;
}

/* ----- Snippets (code blocks with copy button) on /badges ---------------- */
.snippet {
  border: 1px solid rgba(57, 74, 112, 0.5);
  background: rgba(10, 22, 40, 0.6);
  border-radius: 8px;
  overflow: hidden;
}
.snippet > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(21, 32, 56, 0.7);
  border-bottom: 1px solid rgba(57, 74, 112, 0.5);
  font-size: 11px;
  color: #9ca3af;
}
.snippet-title {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.snippet-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(37, 99, 235, 0.3);
  cursor: pointer;
  transition: background 150ms, color 150ms;
}
.snippet-copy:hover { background: rgba(37, 99, 235, 0.3); color: #bfdbfe; }
.snippet-copy.is-copied {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}
.snippet pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  background: transparent;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #cbd5e1;
}
.snippet pre code { color: inherit; background: transparent; }

/* Service chip (used in detail header + maybe elsewhere) */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  background: rgba(21, 32, 56, 0.6);
  border: 1px solid rgba(57, 74, 112, 0.6);
  color: #e5e7eb;
  text-decoration: none;
  transition: background 150ms;
}
.status-chip:hover { background: rgba(37, 99, 235, 0.15); }
.status-chip .dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: #22c55e; }
