/* ═══════════════════════════════════════════════════════════
   Server Status Page — Glassmorphism Dark Theme
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --st-bg:              #0a0a1a;
  --st-surface:         rgba(15, 15, 35, 0.65);
  --st-surface-border:  rgba(138, 77, 255, 0.12);
  --st-glass:           rgba(20, 20, 50, 0.45);
  --st-glass-border:    rgba(138, 77, 255, 0.18);
  --st-text:            #e4e4f0;
  --st-text-dim:        #9090b0;
  --st-accent:          #9a4dff;
  --st-accent-glow:     rgba(154, 77, 255, 0.35);
  --st-green:           #00e676;
  --st-green-glow:      rgba(0, 230, 118, 0.25);
  --st-yellow:          #ffc107;
  --st-yellow-glow:     rgba(255, 193, 7, 0.25);
  --st-red:             #ff5252;
  --st-red-glow:        rgba(255, 82, 82, 0.25);
  --st-blue:            #448aff;
  --st-radius:          16px;
  --st-radius-sm:       10px;
  --st-transition:      .3s cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --st-bg:              #f0f0f8;
  --st-surface:         rgba(255, 255, 255, 0.75);
  --st-surface-border:  rgba(138, 77, 255, 0.15);
  --st-glass:           rgba(255, 255, 255, 0.55);
  --st-glass-border:    rgba(138, 77, 255, 0.2);
  --st-text:            #1a1a2e;
  --st-text-dim:        #6b6b8a;
}

/* ── Page wrapper ──────────────────────────────────────── */
.status-page {
  min-height: 100vh;
  padding: 2rem 0 4rem;
}
.status-page .container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Page header ───────────────────────────────────────── */
.status-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.status-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--st-text);
  margin: 0 0 .5rem;
  letter-spacing: -0.02em;
}
.status-header h1 i {
  color: var(--st-accent);
  margin-right: .5rem;
}
.status-header .subtitle {
  color: var(--st-text-dim);
  font-size: .95rem;
}
.status-last-check {
  color: var(--st-text-dim);
  font-size: .8rem;
  margin-top: .35rem;
}

/* ── Overall status banner ─────────────────────────────── */
.overall-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1.1rem 1.5rem;
  border-radius: var(--st-radius);
  background: var(--st-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--st-glass-border);
  margin-bottom: 2rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--st-text);
  transition: var(--st-transition);
  animation: bannerFadeIn .6s ease-out;
}
.overall-banner .pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}
.overall-banner.operational .pulse-dot {
  background: var(--st-green);
  box-shadow: 0 0 12px var(--st-green-glow);
}
.overall-banner.degraded .pulse-dot {
  background: var(--st-yellow);
  box-shadow: 0 0 12px var(--st-yellow-glow);
}
.overall-banner.outage .pulse-dot {
  background: var(--st-red);
  box-shadow: 0 0 12px var(--st-red-glow);
}
.overall-banner.unknown .pulse-dot {
  background: var(--st-text-dim);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(1.3); }
}
@keyframes bannerFadeIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Uptime bar ────────────────────────────────────────── */
.uptime-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}
.uptime-card {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1.1rem;
  border-radius: var(--st-radius-sm);
  background: var(--st-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--st-glass-border);
  font-size: .85rem;
  color: var(--st-text);
  transition: var(--st-transition);
}
.uptime-card:hover {
  border-color: var(--st-accent);
  box-shadow: 0 0 20px var(--st-accent-glow);
  transform: translateY(-2px);
}
.uptime-card .label {
  color: var(--st-text-dim);
  font-weight: 500;
}
.uptime-card .value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.uptime-card .value.high { color: var(--st-green); }
.uptime-card .value.mid  { color: var(--st-yellow); }
.uptime-card .value.low  { color: var(--st-red); }

/* ── Section titles ────────────────────────────────────── */
.status-section {
  margin-bottom: 2.5rem;
}
.section-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--st-text);
  margin-bottom: 1rem;
  padding-left: .25rem;
}
.section-title i {
  color: var(--st-accent);
  width: 20px;
  height: 20px;
}

/* ── Server cards — vertical list ──────────────────────── */
.server-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* ── Server card — two-part layout ─────────────────────── */
.server-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--st-radius);
  background: var(--st-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--st-surface-border);
  transition: var(--st-transition);
  overflow: hidden;
  animation: cardFadeIn .5s ease-out both;
}
.server-card:hover {
  border-color: var(--st-accent);
  box-shadow: 0 4px 30px var(--st-accent-glow);
  transform: translateY(-2px);
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Top area of the card — clickable to open chart */
.server-card .card-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.35rem;
  cursor: pointer;
}

/* Left: name + meta */
.server-card .card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.server-card .card-top {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.server-card .server-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--st-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-card .status-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .22rem .65rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.status-badge.online {
  background: rgba(0, 230, 118, 0.12);
  color: var(--st-green);
  border: 1px solid rgba(0, 230, 118, 0.25);
}
.status-badge.degraded {
  background: rgba(255, 193, 7, 0.12);
  color: var(--st-yellow);
  border: 1px solid rgba(255, 193, 7, 0.25);
}
.status-badge.offline {
  background: rgba(255, 82, 82, 0.12);
  color: var(--st-red);
  border: 1px solid rgba(255, 82, 82, 0.25);
}
.status-badge .badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.status-badge.online .badge-dot  { background: var(--st-green); box-shadow: 0 0 6px var(--st-green-glow); }
.status-badge.degraded .badge-dot { background: var(--st-yellow); box-shadow: 0 0 6px var(--st-yellow-glow); }
.status-badge.offline .badge-dot  { background: var(--st-red); box-shadow: 0 0 6px var(--st-red-glow); }

/* Card meta row */
.server-card .card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .8rem;
  color: var(--st-text-dim);
}
.card-meta .meta-item {
  display: flex;
  align-items: center;
  gap: .3rem;
}
.card-meta .meta-item i {
  width: 14px;
  height: 14px;
  opacity: .7;
}
.card-meta .ping-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.card-meta .ping-value.good     { color: var(--st-green); }
.card-meta .ping-value.warning  { color: var(--st-yellow); }
.card-meta .ping-value.bad      { color: var(--st-red); }

/* Center: status badge */
.server-card .card-status {
  flex-shrink: 0;
}

/* Right: Mini sparkline in card */
.server-card .card-sparkline {
  width: 140px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   Activity Timeline — horizontal bar of coloured checks
   ═══════════════════════════════════════════════════════════ */
.timeline-wrap {
  position: relative;
  padding: 0 1.35rem .75rem;
}

.timeline-bar {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.tl-cell {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border-radius: 2px;
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: default;
}
.tl-cell:hover {
  transform: scaleY(1.8);
  z-index: 2;
}

/* Colours */
.tl-cell.tl-online {
  background: var(--st-green);
}
.tl-cell.tl-online:hover {
  box-shadow: 0 0 6px var(--st-green-glow);
}
.tl-cell.tl-degraded {
  background: var(--st-yellow);
}
.tl-cell.tl-degraded:hover {
  box-shadow: 0 0 6px var(--st-yellow-glow);
}
.tl-cell.tl-offline {
  background: var(--st-red);
}
.tl-cell.tl-offline:hover {
  box-shadow: 0 0 6px var(--st-red-glow);
}

/* ── Glassmorphism tooltip for timeline ────────────────── */
.tl-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 200px;
  padding: .6rem .8rem;
  border-radius: 10px;
  background: rgba(15, 15, 35, 0.72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(138, 77, 255, 0.22);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  color: var(--st-text);
  font-size: .75rem;
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
  z-index: 30;
}
.tl-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.tl-tip-row {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.tl-tip-icon {
  font-size: .7rem;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}
.tl-tip-status-online  { color: var(--st-green); }
.tl-tip-status-degraded { color: var(--st-yellow); }
.tl-tip-status-offline  { color: var(--st-red); }

/* ── Chart modal / expanded view ───────────────────────── */
.chart-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.chart-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.chart-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 9999;
  width: min(92vw, 720px);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.75rem;
  border-radius: var(--st-radius);
  background: var(--st-surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--st-glass-border);
  box-shadow: 0 16px 64px rgba(0,0,0,.4);
  opacity: 0;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.chart-panel.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.chart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.chart-panel-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--st-text);
}
.chart-panel-close {
  background: none;
  border: none;
  color: var(--st-text-dim);
  cursor: pointer;
  padding: .25rem;
  border-radius: 8px;
  transition: var(--st-transition);
}
.chart-panel-close:hover {
  color: var(--st-text);
  background: rgba(255,255,255,.06);
}
.chart-period-tabs {
  display: flex;
  gap: .35rem;
  margin-bottom: 1rem;
}
.chart-period-tabs button {
  padding: .35rem .85rem;
  border-radius: 8px;
  border: 1px solid var(--st-glass-border);
  background: transparent;
  color: var(--st-text-dim);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--st-transition);
}
.chart-period-tabs button.active,
.chart-period-tabs button:hover {
  background: var(--st-accent);
  color: #fff;
  border-color: var(--st-accent);
}
.chart-canvas-wrap {
  position: relative;
  height: 260px;
  border-radius: 8px;
  background: rgba(0,0,0,.15);
  padding: .5rem;
}
.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Skeleton loaders ──────────────────────────────────── */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--st-radius);
  background: var(--st-surface);
  border: 1px solid var(--st-surface-border);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(154, 77, 255, 0.06) 40%,
    rgba(154, 77, 255, 0.12) 50%,
    rgba(154, 77, 255, 0.06) 60%,
    transparent 100%
  );
  animation: shimmer 1.8s infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 64px;
  padding: 1rem 1.35rem;
}
.skeleton-card .sk-line {
  height: 12px;
  border-radius: 6px;
  background: rgba(255,255,255,.06);
}
.skeleton-card .sk-line.short  { width: 120px; }
.skeleton-card .sk-line.medium { width: 80px; }
.skeleton-card .sk-line.long   { width: 160px; }
.skeleton-card .sk-sparkline {
  width: 140px;
  height: 36px;
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  margin-left: auto;
  flex-shrink: 0;
}
/* skeleton section list */
.skeleton-section-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.skeleton-banner {
  height: 52px;
  margin-bottom: 2rem;
}
.skeleton-uptime-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}
.skeleton-uptime {
  width: 140px;
  height: 42px;
  border-radius: var(--st-radius-sm);
}

/* ── Tooltip ───────────────────────────────────────────── */
.st-tooltip {
  position: relative;
}
.st-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(.92);
  padding: .3rem .65rem;
  border-radius: 6px;
  background: #1a1a2e;
  color: #e4e4f0;
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all .2s ease;
  z-index: 20;
}
.st-tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  .status-header h1 {
    font-size: 1.5rem;
  }
  .server-card .card-main {
    flex-direction: column;
    align-items: stretch;
    gap: .6rem;
  }
  .server-card .card-sparkline {
    width: 100%;
    height: 36px;
  }
  .server-card .card-top {
    justify-content: space-between;
  }
  .uptime-row {
    gap: .6rem;
  }
  .uptime-card {
    padding: .5rem .8rem;
    font-size: .78rem;
  }
  .chart-panel {
    width: 96vw;
    padding: 1.25rem;
  }
  .chart-canvas-wrap {
    height: 200px;
  }
  /* Timeline on mobile */
  .timeline-wrap {
    padding: 0 .8rem .6rem;
  }
  .timeline-bar {
    height: 6px;
    gap: 1px;
  }
  .tl-tooltip {
    width: 180px;
    font-size: .7rem;
    padding: .5rem .65rem;
  }
}
@media (max-width: 400px) {
  .overall-banner {
    font-size: .9rem;
    padding: .85rem 1rem;
  }
  .timeline-bar {
    height: 5px;
  }
}

/* ── Auto-refresh indicator ────────────────────────────── */
.refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--st-text-dim);
  font-size: .75rem;
  margin-top: .25rem;
}
.refresh-indicator .spin-icon {
  animation: spin 2s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── No data state ─────────────────────────────────────── */
.no-data {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--st-text-dim);
}
.no-data i {
  width: 48px;
  height: 48px;
  opacity: .4;
  margin-bottom: 1rem;
}
.no-data p {
  font-size: .95rem;
}

/* ── Disclaimer ────────────────────────────────────────── */
.status-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-top: 2.5rem;
  padding: .9rem 1.2rem;
  border-radius: var(--st-radius-sm);
  background: var(--st-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--st-glass-border);
  color: var(--st-text-dim);
  font-size: .8rem;
  line-height: 1.5;
}
.status-disclaimer p {
  margin: 0;
}
