/* =========================================================   GHAYMAH CLOUD THEME DESIGN SYSTEM
   Modern Atmospheric Glassmorphism & Sky Blue Accents
   ========================================================= */
:root {
  /* Cloud Palette */
  --bg:               #070B16;
  --bg-gradient:      radial-gradient(ellipse at 50% 0%, #0F1932 0%, #070B16 75%);
  --surface:          rgba(15, 23, 42, 0.65);
  --surface-raised:   rgba(25, 38, 68, 0.55);
  --surface-hover:    rgba(30, 48, 86, 0.75);
  
  --border:           rgba(56, 139, 253, 0.18);
  --border-glow:      rgba(56, 139, 253, 0.45);
  --border-soft:      rgba(255, 255, 255, 0.06);

  --text:             #F0F6FC;
  --text-muted:       #8B949E;
  --text-dim:         #6E7681;
  --cloud-accent:     #388BFD;
  --cloud-cyan:       #00E5FF;
  --cloud-light:      #C9D1D9;

  --ok:               #39D353;
  --ok-glow:          rgba(57, 211, 83, 0.25);
  --bad:              #F85149;
  --bad-glow:         rgba(248, 81, 73, 0.25);
  --warn:             #D29922;
  --info:             #58A6FF;

  --radius-sm:        8px;
  --radius-md:        14px;
  --radius-lg:        20px;

  --font-ui:          'Outfit', 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono:        'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono {
  font-family: var(--font-mono);
}

/* =========================================================
   Ambient Floating Cloud Background
   ========================================================= */
.cloud-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cloud-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
  animation: floatCloud 24s ease-in-out infinite alternate;
}

.cloud-orb--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #388BFD 0%, rgba(0,229,255,0.4) 100%);
  top: -150px;
  left: 10%;
}

.cloud-orb--2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #1F6FEB 0%, rgba(88,166,255,0.3) 100%);
  bottom: -200px;
  right: 5%;
  animation-delay: -8s;
  animation-duration: 30s;
}

.cloud-orb--3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #00E5FF 0%, rgba(56,139,253,0.3) 100%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -15s;
  animation-duration: 22s;
  opacity: 0.18;
}

@keyframes floatCloud {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, -20px) scale(0.95); }
}

/* =========================================================
   Layout Shell
   ========================================================= */
.app {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 28px;
}

.banner {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  backdrop-filter: blur(12px);
}

.banner--warn {
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.35);
  color: #F0E2A0;
}
.banner--warn strong {
  color: var(--warn);
}

/* =========================================================
   Top Bar (Cloud Header)
   ========================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 26px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  transition: border-color 0.3s ease;
}

.topbar:hover {
  border-color: var(--border-glow);
}

.topbar__identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 139, 253, 0.25), rgba(0, 229, 255, 0.15));
  border: 1px solid rgba(56, 139, 253, 0.35);
  color: var(--cloud-cyan);
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.15);
}

.cloud-logo-icon {
  filter: drop-shadow(0 2px 6px rgba(0, 229, 255, 0.4));
}

.topbar__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px var(--ok);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.topbar__dot.is-bad {
  background: var(--bad);
  box-shadow: 0 0 12px var(--bad);
}

.topbar__title {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #FFFFFF 30%, #A5C7FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar__subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.topbar__updated {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.topbar__updated .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}
.topbar__updated .mono {
  font-size: 12.5px;
  color: var(--cloud-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: linear-gradient(135deg, rgba(56, 139, 253, 0.18), rgba(25, 38, 68, 0.6));
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.btn:hover {
  border-color: var(--cloud-accent);
  background: linear-gradient(135deg, rgba(56, 139, 253, 0.3), rgba(0, 229, 255, 0.2));
  color: #FFFFFF;
  box-shadow: 0 6px 20px rgba(56, 139, 253, 0.25);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(1px);
}
.btn__icon {
  color: var(--cloud-cyan);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn.is-spinning .btn__icon {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* =========================================================
   KPI Grid & Cloud Cards
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cloud-accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--border-glow);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45), 0 0 24px rgba(56, 139, 253, 0.15);
}

.card:hover::before {
  opacity: 1;
}

.kpi {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  gap: 12px;
}

.kpi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
}

.kpi__icon {
  color: var(--cloud-accent);
  opacity: 0.85;
}

.kpi__value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #FFFFFF;
}

.kpi__foot {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Status Indicator Card */
.kpi__status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  position: relative;
}

.status-indicator.is-healthy {
  background: var(--ok);
  box-shadow: 0 0 16px var(--ok-glow);
}
.status-indicator.is-healthy::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px solid var(--ok);
  animation: pulse-ring 2.2s ease-out infinite;
}

.status-indicator.is-unhealthy {
  background: var(--bad);
  box-shadow: 0 0 16px var(--bad-glow);
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}

.kpi__status-text {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* =========================================================
   Panels, Charts & Data Viz
   ========================================================= */
.charts-grid,
.stats-grid,
.detail-grid {
  display: grid;
  gap: 20px;
}

.charts-grid {
  grid-template-columns: repeat(2, 1fr);
}

.stats-grid,
.detail-grid {
  grid-template-columns: 1.4fr 1fr;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cloud-light);
}

.panel__meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
}

.chart-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Check results timeline */
.status-timeline-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  justify-content: center;
}

.status-timeline-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.status-timeline-stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-timeline-stat .mono {
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
}

.status-timeline-stat--ok .mono {
  color: var(--ok);
}

.status-timeline-stat--bad .mono {
  color: var(--bad);
}

.status-timeline-stat__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-timeline-stat--ok .status-timeline-stat__dot {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok-glow);
}

.status-timeline-stat--bad .status-timeline-stat__dot {
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad-glow);
}

.status-timeline {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 48px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow-x: auto;
  scrollbar-width: thin;
}

.status-timeline:empty::after {
  content: 'Collecting data…';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 12px;
  color: var(--text-dim);
}

.status-timeline__cell {
  flex: 1 1 0;
  min-width: 6px;
  max-width: 24px;
  border-radius: 4px;
  background: var(--ok);
  opacity: 0.9;
  cursor: default;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.status-timeline__cell:hover,
.status-timeline__cell:focus-visible {
  transform: scaleY(1.08);
  opacity: 1;
  box-shadow: 0 0 10px var(--ok-glow);
  outline: none;
}

.status-timeline__cell.is-fail {
  background: var(--bad);
}

.status-timeline__cell.is-fail:hover,
.status-timeline__cell.is-fail:focus-visible {
  box-shadow: 0 0 10px var(--bad-glow);
}

.status-timeline__cell.is-pending {
  background: rgba(255, 255, 255, 0.08);
  opacity: 1;
}

.status-timeline__cell.is-pending:hover,
.status-timeline__cell.is-pending:focus-visible {
  box-shadow: none;
  transform: none;
}

.status-timeline-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.doughnut-wrap {
  position: relative;
  width: 100%;
  max-width: 180px;
  height: 180px;
  margin: 0 auto;
}

.doughnut-canvas {
  width: 100%;
  height: 100%;
}

.doughnut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.doughnut-center__value {
  font-size: 22px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1;
}

.doughnut-center__label {
  margin-top: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}

.check-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border-soft);
}

.check-stats__row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.check-stats__label {
  color: var(--text-muted);
  min-width: 52px;
}

.check-stats__value {
  font-weight: 600;
  color: #FFFFFF;
}

.check-stats__foot {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Uptime strip */
.uptime-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.uptime-pct {
  font-size: 36px;
  font-weight: 700;
  color: var(--ok);
  line-height: 1;
  letter-spacing: -0.03em;
}

.uptime-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.uptime-strip {
  display: grid;
  grid-template-columns: repeat(48, 1fr);
  gap: 3px;
  height: 36px;
  align-items: stretch;
}

.uptime-cell {
  border-radius: 3px;
  background: var(--ok);
  opacity: 0.85;
  min-width: 0;
  transition: opacity 0.2s ease;
}

.uptime-cell.is-down {
  background: var(--bad);
}

.uptime-cell.is-unknown {
  background: rgba(255, 255, 255, 0.08);
  opacity: 1;
}

.uptime-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Detail list */
.detail-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-list__row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: start;
}

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

.detail-list dt {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
}

.detail-list dd {
  margin: 0;
  font-size: 13px;
  color: var(--cloud-light);
  word-break: break-all;
}

.detail-list dd.dd-ok {
  color: var(--ok);
  font-weight: 600;
  text-transform: capitalize;
}

.detail-list dd.dd-bad {
  color: var(--bad);
  font-weight: 600;
  text-transform: capitalize;
}

.detail-list__raw {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}

/* Events log */
.panel--events {
  min-height: 320px;
}

.events-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.events-log__row {
  display: grid;
  grid-template-columns: 8px 52px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border-soft);
  font-size: 12px;
  line-height: 1.45;
}

.events-log__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.events-log__dot--ok {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok-glow);
}

.events-log__dot--bad {
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad-glow);
}

.events-log__time {
  font-family: var(--font-mono);
  color: var(--text-dim);
  white-space: nowrap;
}

.events-log__msg {
  color: var(--cloud-light);
}

.events-log__msg strong {
  color: #FFFFFF;
  font-weight: 600;
}

/* =========================================================
   Footer
   ========================================================= */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.footer-cloud-icon {
  vertical-align: middle;
  margin-right: 4px;
  color: var(--cloud-accent);
}

/* =========================================================
   Responsive Layout
   ========================================================= */
@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .charts-grid,
  .stats-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .app {
    padding: 20px 16px 40px;
  }
  .topbar {
    padding: 16px 20px;
  }
  .topbar__actions {
    width: 100%;
    justify-content: space-between;
  }
  .kpi__value {
    font-size: 22px;
  }
  .uptime-strip {
    grid-template-columns: repeat(24, 1fr);
  }
}

@media (max-width: 480px) {
  .app {
    padding: 20px 14px 32px;
  }
  .topbar {
    padding: 14px;
  }
}

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