/* ═══════════════════════════════════════════════════════════════
   inSigner Cloud Status Page — Premium Light Theme
   Inspired by UptimeRobot status pages
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Background & Surface */
  --bg-body:       #f8f9fb;
  --bg-white:      #ffffff;
  --bg-card:       #ffffff;
  --bg-hover:      #f3f4f6;
  --bg-skeleton:   #e5e7eb;

  /* Text */
  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  --text-light:     #d1d5db;

  /* Borders */
  --border:        #e5e7eb;
  --border-hover:  #d1d5db;

  /* Brand */
  --brand:         #003271;
  --brand-light:   #1a5bb5;
  --brand-soft:    rgba(0, 50, 113, 0.06);

  /* Status Colors */
  --green:         #22c55e;
  --green-light:   #dcfce7;
  --green-bg:      #f0fdf4;
  --green-border:  #bbf7d0;
  --green-text:    #15803d;

  --yellow:        #f59e0b;
  --yellow-light:  #fef3c7;
  --yellow-bg:     #fffbeb;
  --yellow-border: #fde68a;
  --yellow-text:   #b45309;

  --red:           #ef4444;
  --red-light:     #fee2e2;
  --red-bg:        #fef2f2;
  --red-border:    #fecaca;
  --red-text:      #dc2626;

  --gray-bar:      #e5e7eb;

  /* Sizing */
  --radius:        12px;
  --radius-sm:     8px;
  --radius-xs:     6px;

  /* Shadows */
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow:        0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:     0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg:     0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  /* Transition */
  --transition:    0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* Font */
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:     'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
}

html {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Container ─── */
.container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Header ─── */
.header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

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

.header__logo img {
  height: 32px;
  width: auto;
  display: block;
}

.header__title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.header__subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}

.header__meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  cursor: default;
  transition: all var(--transition);
}

.header__refresh svg {
  opacity: 0.5;
}

/* ─── Overall Status Banner ─── */
.status-banner-section {
  margin-top: 32px;
  margin-bottom: 8px;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-white);
  transition: all 0.4s ease;
  box-shadow: var(--shadow);
}

.status-banner--operational {
  background: var(--green-bg);
  border-color: var(--green-border);
}

.status-banner--degraded {
  background: var(--yellow-bg);
  border-color: var(--yellow-border);
}

.status-banner--down {
  background: var(--red-bg);
  border-color: var(--red-border);
}

.status-banner--loading {
  background: var(--bg-white);
  border-color: var(--border);
}

/* Pulse icon */
.status-banner__icon {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.4s ease;
  z-index: 1;
}

.pulse-ring {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  opacity: 0;
  animation: pulse-ring 2.5s ease-out infinite;
}

.status-banner--operational .pulse-dot  { background: var(--green); }
.status-banner--operational .pulse-ring { border-color: var(--green); }
.status-banner--degraded .pulse-dot     { background: var(--yellow); }
.status-banner--degraded .pulse-ring    { border-color: var(--yellow); }
.status-banner--down .pulse-dot         { background: var(--red); }
.status-banner--down .pulse-ring        { border-color: var(--red); }

@keyframes pulse-ring {
  0%   { transform: scale(0.5); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 0; }
}

.status-banner__text h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.status-banner--operational .status-banner__text h2 { color: var(--green-text); }
.status-banner--degraded .status-banner__text h2    { color: var(--yellow-text); }
.status-banner--down .status-banner__text h2        { color: var(--red-text); }

.status-banner__text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* ─── Stale Banner ─── */
.stale-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.stale-banner--investigating {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
  color: var(--yellow-text);
}

.stale-banner--outage {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red-text);
}

/* ─── Section Titles ─── */
.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 32px 0 16px;
}

.section-title--inline { margin: 0; }

.section-badge {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  background: var(--bg-body);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  margin-left: 8px;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   SERVICE ROW (UptimeRobot-style)
   Each service is a full-width card with name, status, bars, uptime %
   ═══════════════════════════════════════════════════════════════ */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.service-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.service-row:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

/* Service header: name + status left, uptime % right */
.service-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.service-row__name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-row__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--transition);
}

.service-row__dot--operational { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
.service-row__dot--degraded    { background: var(--yellow); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }
.service-row__dot--down        { background: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
.service-row__dot--unknown     { background: var(--text-muted); }

.service-row__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.service-row__url {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.service-row__status-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
}

.service-row__status-label--operational { color: var(--green-text); }
.service-row__status-label--degraded    { color: var(--yellow-text); }
.service-row__status-label--down        { color: var(--red-text); }
.service-row__status-label--unknown     { color: var(--text-muted); }

/* Uptime bar container within each service row */
.service-row__bars-wrapper {
  position: relative;
}

.service-row__bars {
  display: flex;
  gap: 1.5px;
  height: 34px;
  align-items: stretch;
}

.service-row__bar {
  flex: 1;
  border-radius: 2px;
  min-width: 2px;
  transition: opacity var(--transition), transform var(--transition);
  cursor: pointer;
  position: relative;
}

.service-row__bar:hover {
  opacity: 0.75;
  transform: scaleY(1.2);
}

.service-row__bar--operational { background: var(--green); }
.service-row__bar--degraded    { background: var(--yellow); }
.service-row__bar--down        { background: var(--red); }
.service-row__bar--empty       { background: var(--gray-bar); }

/* Tooltip on hover */
.service-row__bar[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-white);
  font-size: 0.7rem;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.service-row__bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Right side: uptime percentage */
.service-row__uptime {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-row__uptime-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--green-text);
  letter-spacing: -0.02em;
}

.service-row__uptime-value--degraded { color: var(--yellow-text); }
.service-row__uptime-value--down     { color: var(--red-text); }

.service-row__uptime-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

/* ═══════════════════════════════════════════════════════════════
   OVERALL UPTIME STATS (cards grid)
   ═══════════════════════════════════════════════════════════════ */
.uptime-overview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
}

.uptime-overview__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.uptime-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.uptime-stat-card {
  text-align: center;
  padding: 16px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.uptime-stat-card:hover {
  box-shadow: var(--shadow);
}

.uptime-stat__value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--green-text);
  letter-spacing: -0.02em;
}

.uptime-stat__value--degraded { color: var(--yellow-text); }
.uptime-stat__value--down     { color: var(--red-text); }

.uptime-stat__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   INCIDENTS
   ═══════════════════════════════════════════════════════════════ */
.incident-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.incident-card:hover {
  box-shadow: var(--shadow);
}

.incident-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.incident-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.incident-card__severity {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 12px;
  border-radius: 20px;
  flex-shrink: 0;
}

.severity--minor    { background: var(--yellow-light); color: var(--yellow-text); }
.severity--major    { background: #ffedd5; color: #c2410c; }
.severity--critical { background: var(--red-light); color: var(--red-text); }

.incident-card__services {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.incident-service-tag {
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand);
  text-transform: capitalize;
  font-weight: 500;
}

.incident-timeline {
  border-left: 2px solid var(--border);
  padding-left: 20px;
  margin-left: 6px;
}

.timeline-entry {
  position: relative;
  padding-bottom: 16px;
}

.timeline-entry:last-child { padding-bottom: 0; }

.timeline-entry::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 2px solid var(--bg-white);
}

.timeline-entry--investigating::before { background: var(--yellow); }
.timeline-entry--identified::before    { background: #f97316; }
.timeline-entry--monitoring::before    { background: var(--brand-light); }
.timeline-entry--resolved::before      { background: var(--green); }

.timeline-entry__status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 2px;
}

.timeline-entry--investigating .timeline-entry__status { color: var(--yellow-text); }
.timeline-entry--identified .timeline-entry__status    { color: #c2410c; }
.timeline-entry--monitoring .timeline-entry__status    { color: var(--brand); }
.timeline-entry--resolved .timeline-entry__status      { color: var(--green-text); }

.timeline-entry__message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.timeline-entry__time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* No incidents placeholder */
.card--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card--empty svg {
  opacity: 0.35;
  color: var(--text-muted);
}

/* ─── Footer ─── */
.footer {
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-white);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer__inner strong {
  color: var(--brand);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   BACKEND SERVICES GRID (individual service cards)
   ═══════════════════════════════════════════════════════════════ */
.backend-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.backend-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
  cursor: default;
  box-shadow: var(--shadow-sm);
}

.backend-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.backend-card__icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--bg-body);
}

.backend-card__info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.backend-card__status {
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.backend-card__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.backend-card__dot--operational { background: var(--green); }
.backend-card__dot--down        { background: var(--red); }
.backend-card__dot--unknown     { background: var(--text-muted); }

.backend-card__status-text--operational { color: var(--green-text); }
.backend-card__status-text--down        { color: var(--red-text); }
.backend-card__status-text--unknown     { color: var(--text-muted); }

.backend-card__ms {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: auto;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSE TIME CARD
   ═══════════════════════════════════════════════════════════════ */
.response-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
}

.response-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.response-card__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.response-card__avg {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-weight: 500;
}

.sparkline-container {
  position: relative;
  height: 80px;
}

.sparkline-container canvas {
  width: 100%;
  display: block;
}

/* ─── Skeleton Loading ─── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-skeleton) 25%, #f3f4f6 37%, var(--bg-skeleton) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 4px;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ─── Fade In ─── */
.fade-in {
  animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .header__inner { height: 56px; }
  .header__subtitle { display: none; }

  .status-banner { padding: 20px; gap: 12px; }
  .status-banner__text h2 { font-size: 1.05rem; }

  .service-row { padding: 20px; }
  .service-row__header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .service-row__uptime { align-self: flex-end; margin-top: -28px; }

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

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

  .uptime-overview { padding: 20px; }
  .response-card { padding: 20px; }
  .uptime-stat-card { padding: 12px 8px; }
  .uptime-stat__value { font-size: 1.2rem; }

  .footer__inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .service-row__bars { height: 28px; }
  .service-row__uptime-value { font-size: 1.1rem; }
  .uptime-stat__value { font-size: 1rem; }
  .backend-services-grid { grid-template-columns: 1fr; }
}
