/* =========================================================
   GTA:Yonder — Components
   ========================================================= */

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 11, 10, 0.85);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  transition: background var(--duration-slow) var(--ease);
}

[data-theme="light"] .header {
  background: rgba(245, 247, 246, 0.85);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.header-logo {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text);
  letter-spacing: -0.02em;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
}

.header-subtitle {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: all var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
}

.header-link:hover { background: var(--surface-hover); color: var(--text); }
.header-link.active { color: var(--accent); }

/* Theme switch */
.theme-switch {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 1px;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
}

.theme-btn:hover { color: var(--text-secondary); }
.theme-btn.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  padding: var(--sp-16) 0 var(--sp-10);
  text-align: center;
}

.hero-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--sp-4);
}

.hero-title {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
  margin-bottom: var(--sp-4);
}

.hero-desc {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

/* ---------- Status Banner ---------- */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-10);
}

.status-banner-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.operational { background: var(--success); animation: pulse 3s ease-in-out infinite; }
.status-dot.degraded { background: var(--warning); animation: pulse 2s ease-in-out infinite; }
.status-dot.outage { background: var(--danger); animation: pulse 1.5s ease-in-out infinite; }
.status-dot.maintenance { background: var(--info); }

.status-banner-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.status-banner-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.status-banner-right {
  text-align: right;
}

.status-banner-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.status-banner-time {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ---------- Overview ---------- */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-10);
}

.overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  transition: all var(--transition);
}

.overview-card:hover { border-color: var(--border-strong); }

.overview-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.overview-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

/* ---------- Services Section ---------- */
.services-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.services-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

/* Time range tabs */
.time-tabs {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 1px;
}

.time-tab {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.time-tab:hover { color: var(--text-secondary); }
.time-tab.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Service Card ---------- */
.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-3);
  transition: all var(--transition);
}

.service-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.service-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.service-info {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.service-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border-radius: var(--radius);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.service-name {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.service-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.service-status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.service-status.operational { color: var(--success); }
.service-status.degraded { color: var(--warning); }
.service-status.outage { color: var(--danger); }
.service-status.maintenance { color: var(--info); }

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

.service-status-dot.operational { background: var(--success); }
.service-status-dot.degraded { background: var(--warning); }
.service-status-dot.outage { background: var(--danger); }
.service-status-dot.maintenance { background: var(--info); }

/* Uptime bar */
.uptime-section { margin-bottom: var(--sp-4); }

.uptime-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.uptime-text {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.uptime-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.uptime-bar {
  height: 6px;
  background: var(--surface-hover);
  border-radius: 3px;
  overflow: hidden;
}

.uptime-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--duration-slow) var(--ease);
}

.uptime-bar-fill.excellent { background: var(--success); }
.uptime-bar-fill.good { background: var(--success); }
.uptime-bar-fill.fair { background: var(--warning); }
.uptime-bar-fill.poor { background: var(--danger); }

/* Service meta */
.service-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.meta-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.meta-value {
  font-weight: var(--weight-medium);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Timeline ---------- */
.timeline-section { margin-top: var(--sp-4); }

.timeline-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.timeline-text {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-range {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.timeline-blocks {
  display: flex;
  gap: 2px;
  height: 28px;
  align-items: flex-end;
}

.timeline-block {
  flex: 1;
  min-width: 3px;
  border-radius: 2px;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.timeline-block.up { background: var(--success); opacity: 0.6; }
.timeline-block.degraded { background: var(--warning); opacity: 0.8; }
.timeline-block.down { background: var(--danger); opacity: 0.8; }
.timeline-block.maintenance { background: var(--info); opacity: 0.8; }
.timeline-block.no-data { background: var(--border-strong); opacity: 0.4; }

.timeline-block:hover { opacity: 1; transform: scaleY(1.3); transform-origin: bottom; }

/* Timeline tooltip */
.timeline-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text);
  white-space: nowrap;
  z-index: 10;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

.timeline-block:hover .timeline-tooltip { display: block; }

.timeline-tooltip-date { color: var(--text-muted); margin-bottom: 2px; }
.timeline-tooltip-status { font-weight: var(--weight-medium); }

/* ---------- Footer ---------- */
.footer {
  margin-top: var(--sp-16);
  padding: var(--sp-8) 0;
  border-top: 1px solid var(--border);
}

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

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.footer-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.footer-copy {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.footer-link {
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-link:hover { color: var(--text); }

.footer-powered {
  font-size: var(--text-xs);
  color: var(--text-muted);
  opacity: 0.6;
}

/* ---------- Empty / Error / Loading ---------- */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-8);
}

.empty-icon {
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
  opacity: 0.5;
}

.empty-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.empty-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.error-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-8);
}

.error-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.error-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}

.btn-retry {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-retry:hover { background: var(--accent-hover); }

/* Skeleton cards */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-3);
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  margin-bottom: var(--sp-2);
}

.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-100 { width: 100%; }
.skeleton-line.h-6 { height: 6px; }

/* Data unavailable */
.unavailable {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
}
