/* ============================================================
   Flare Status Page — Theme Stylesheet
   ============================================================ */

/* ── Design Tokens (Light) ────────────────────────────────── */
:root {
  /* Layout */
  --fl-max-width: 780px;
  --fl-gap: 20px;
  --fl-radius: 12px;
  --fl-radius-sm: 8px;

  /* Surfaces */
  --fl-bg: #f3f4f6;
  --fl-surface: #ffffff;
  --fl-border: #e5e7eb;
  --fl-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);

  /* Text */
  --fl-text: #111827;
  --fl-text-muted: #6b7280;
  --fl-text-light: #9ca3af;

  /* Status */
  --fl-ok: #22c55e;
  --fl-warn: #f59e0b;
  --fl-down: #ef4444;
  --fl-info: #6366f1;

  /* Uptime bars */
  --fl-bar-width: 5px;
  --fl-bar-height: 28px;
  --fl-bar-gap: 2px;
  --fl-bar-radius: 2px;

  /* Pill controls */
  --fl-pill-bg: transparent;
  --fl-pill-active-bg: var(--fl-surface);
  --fl-pill-border: var(--fl-border);
  --fl-pill-active-shadow: 0 1px 2px rgba(0,0,0,.06);

  /* Transitions */
  --fl-transition: 0.15s ease;
}

/* ── Design Tokens (Dark) ─────────────────────────────────── */
[data-theme-style="dark"] {
  --fl-bg: #111827;
  --fl-surface: #1f2937;
  --fl-border: #374151;
  --fl-shadow: 0 4px 12px rgba(0,0,0,.4);
  --fl-text: #f3f4f6;
  --fl-text-muted: #9ca3af;
  --fl-text-light: #6b7280;
  --fl-ok: #4ade80;
  --fl-warn: #fbbf24;
  --fl-down: #f87171;
  --fl-info: #818cf8;
  --fl-pill-active-bg: #374151;
  --fl-pill-active-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* ── Layout ───────────────────────────────────────────────── */
.fl-wrap {
  max-width: var(--fl-max-width);
  margin: 0 auto;
  padding: 0 var(--fl-gap);
}

.fl-section {
  margin-bottom: 32px;
}

/* ── Centered Hero ────────────────────────────────────────── */
.fl-hero {
  text-align: center;
  padding: 48px 24px 32px;
}

.fl-hero__icon {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fl-hero__icon svg {
  width: 64px;
  height: 64px;
  position: relative;
  z-index: 1;
}

.fl-hero--operational .fl-hero__icon svg { color: var(--fl-ok); }
.fl-hero--degraded .fl-hero__icon svg { color: var(--fl-warn); }
.fl-hero--down .fl-hero__icon svg { color: var(--fl-down); }

.fl-hero__title {
  font-size: 28px;
  font-weight: 700;
  color: var(--fl-text);
  margin: 0 0 8px;
  line-height: 1.2;
}

.fl-hero__link {
  font-size: 14px;
  color: var(--fl-text-muted);
  text-decoration: none;
  transition: color var(--fl-transition);
}

.fl-hero__link:hover {
  color: var(--fl-info);
}

.fl-hero__link svg {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
}

/* ── Active Incidents Banner ──────────────────────────────── */
.fl-incidents-banner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.fl-incident-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--fl-down) 6%, var(--fl-surface));
  border: 1px solid color-mix(in srgb, var(--fl-down) 20%, var(--fl-border));
  border-radius: var(--fl-radius);
  box-shadow: var(--fl-shadow);
}

.fl-incident-alert__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fl-down);
  flex-shrink: 0;
  margin-top: 5px;
  animation: fl-pulse-dot 2s infinite;
}

@keyframes fl-pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.fl-incident-alert__body {
  flex: 1;
  min-width: 0;
}

.fl-incident-alert__name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fl-text);
}

.fl-incident-alert__meta {
  font-size: 12px;
  color: var(--fl-text-muted);
  margin-top: 2px;
}

.fl-incident-alert__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  background: color-mix(in srgb, var(--fl-down) 12%, var(--fl-surface));
  color: var(--fl-down);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* ── Live Status Section Header ───────────────────────────── */
.fl-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.fl-status-header__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fl-text);
}

.fl-status-header__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Tab Pills (Uptime / Performance) ─────────────────────── */
.fl-tab-pills {
  display: inline-flex;
  align-items: center;
  background: var(--fl-bg);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius-sm);
  padding: 3px;
  gap: 2px;
}

.fl-tab-btn {
  border: none;
  background: transparent;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fl-text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--fl-transition), color var(--fl-transition), box-shadow var(--fl-transition);
}

.fl-tab-btn:hover {
  color: var(--fl-text);
}

.fl-tab-btn--active {
  background: var(--fl-pill-active-bg);
  color: var(--fl-text);
  box-shadow: var(--fl-pill-active-shadow);
  font-weight: 600;
}

/* ── Range Pills (7d / 30d / 90d) ─────────────────────────── */
.fl-range-pills {
  display: inline-flex;
  align-items: center;
  background: var(--fl-bg);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius-sm);
  padding: 3px;
  gap: 2px;
}

.fl-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fl-text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: background var(--fl-transition), color var(--fl-transition), box-shadow var(--fl-transition);
}

.fl-pill:hover {
  color: var(--fl-text);
  text-decoration: none;
}

.fl-pill--active {
  background: var(--fl-pill-active-bg);
  color: var(--fl-text);
  box-shadow: var(--fl-pill-active-shadow);
  font-weight: 600;
}

/* ── Service Cards (Always Expanded) ──────────────────────── */
.fl-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fl-card {
  background: var(--fl-surface);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius);
  padding: 24px;
  box-shadow: var(--fl-shadow);
  transition: box-shadow var(--fl-transition);
}

.fl-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

[data-theme-style="dark"] .fl-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

.fl-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.fl-card__left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.fl-card__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.fl-card__icon svg {
  width: 20px;
  height: 20px;
}

.fl-card__icon--ok svg { color: var(--fl-ok); }
.fl-card__icon--down svg { color: var(--fl-down); }

.fl-card__info {
  min-width: 0;
}

.fl-card__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--fl-text);
  text-decoration: none;
  display: block;
  word-break: break-word;
}

.fl-card__name:hover {
  color: var(--fl-text);
  text-decoration: underline;
}

.fl-card__status {
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
}

.fl-card__status--ok { color: var(--fl-ok); }
.fl-card__status--down { color: var(--fl-down); }

.fl-card__right {
  text-align: right;
  flex-shrink: 0;
}

.fl-card__uptime {
  font-size: 24px;
  font-weight: 700;
  color: var(--fl-text);
  line-height: 1.1;
}

.fl-card__uptime-label {
  font-size: 12px;
  color: var(--fl-text-muted);
  font-weight: 500;
}

/* ── Tall Uptime Bars ─────────────────────────────────────── */
.fl-bars {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fl-bar-gap);
  padding-top: 16px;
}

.fl-bar {
  width: var(--fl-bar-width);
  height: var(--fl-bar-height);
  border-radius: var(--fl-bar-radius);
  transition: opacity var(--fl-transition);
  cursor: default;
}

.fl-bar:hover {
  opacity: 0.65;
}

.fl-bar--ok { background: var(--fl-ok); }
.fl-bar--down { background: var(--fl-down); }

/* ── Performance Chart Container ──────────────────────────── */
.fl-chart-container {
  padding-top: 16px;
  height: 175px;
  display: none;
}

.fl-tab-content--performance .fl-chart-container {
  display: block;
}

/* ── Incident History Timeline ────────────────────────────── */
.fl-timeline-section {
  margin-top: 16px;
}

.fl-timeline-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fl-text);
  margin-bottom: 20px;
}

.fl-timeline {
  position: relative;
  padding-left: 28px;
}

.fl-timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--fl-border);
}

.fl-timeline__date-group {
  margin-bottom: 20px;
}

.fl-timeline__date {
  font-size: 13px;
  font-weight: 700;
  color: var(--fl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  position: relative;
}

.fl-timeline__item {
  position: relative;
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--fl-surface);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius-sm);
  box-shadow: var(--fl-shadow);
}

.fl-timeline__item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--fl-border);
  background: var(--fl-surface);
}

.fl-timeline__item--resolved::before {
  border-color: var(--fl-ok);
  background: color-mix(in srgb, var(--fl-ok) 30%, var(--fl-surface));
}

.fl-timeline__item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.fl-timeline__item-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fl-text);
}

.fl-timeline__item-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fl-timeline__item-status--resolved {
  background: color-mix(in srgb, var(--fl-ok) 12%, var(--fl-surface));
  color: var(--fl-ok);
}

.fl-timeline__item-meta {
  font-size: 12px;
  color: var(--fl-text-muted);
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.fl-timeline__item-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--fl-border);
  font-size: 13px;
  color: var(--fl-text-muted);
}

.fl-timeline__empty {
  font-size: 14px;
  color: var(--fl-text-muted);
  padding: 12px 0;
}

/* ── Collapse Utility ─────────────────────────────────────── */
.fl-collapse {
  display: none;
}

.fl-collapse.show {
  display: block;
}

.fl-collapse-toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--fl-text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.fl-collapse-toggle:hover {
  color: var(--fl-text);
}

/* ── Footer Info ──────────────────────────────────────────── */
.fl-footer-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  padding: 16px 0;
  font-size: 12px;
  color: var(--fl-text-muted);
}

.fl-footer-info__item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.fl-footer-info__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fl-ok);
  animation: fl-pulse-dot 3s infinite;
}

/* ── Empty State ──────────────────────────────────────────── */
.fl-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--fl-text-muted);
  font-size: 15px;
}

.fl-empty__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--fl-text-light);
}

/* ── No Logs State ────────────────────────────────────────── */
.fl-no-logs {
  font-size: 13px;
  color: var(--fl-text-muted);
  padding-top: 12px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .fl-hero {
    padding: 32px 16px 24px;
  }

  .fl-hero__icon {
    width: 64px;
    height: 64px;
  }

  .fl-hero__icon svg {
    width: 52px;
    height: 52px;
  }

  .fl-hero__title {
    font-size: 22px;
  }

  .fl-status-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .fl-status-header__controls {
    width: 100%;
    justify-content: space-between;
  }

  .fl-card {
    padding: 18px;
  }

  .fl-card__uptime {
    font-size: 20px;
  }

  .fl-card__name {
    font-size: 15px;
  }

  .fl-timeline {
    padding-left: 22px;
  }

  .fl-timeline__item {
    padding: 12px;
  }
}

@media (max-width: 479.98px) {
  .fl-status-header__controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .fl-card__top {
    flex-direction: column;
    gap: 8px;
  }

  .fl-card__right {
    text-align: left;
    display: flex;
    gap: 6px;
    align-items: baseline;
  }

  .fl-card__uptime {
    font-size: 18px;
  }

  .fl-bar {
    height: 22px;
  }
}
