/* ==========================================================================
   Status Page — Public Latency Dashboard
   ========================================================================== */

/* --------------------------------------------------------------------------
   Status Page Layout
   -------------------------------------------------------------------------- */

.status-page {
  padding-top: calc(var(--space-20) + 60px); /* Account for fixed nav */
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */

.status-hero {
  text-align: center;
  padding: var(--space-12) 0 var(--space-16);
}

.status-hero__indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: relative;
}

.status-dot--operational {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot--operational::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0.3;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

.status-dot--degraded {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

.status-dot--outage {
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
}

.status-text {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--success);
}

.status-hero__title {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.status-hero__subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.status-hero__updated {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Quick Stats Bar
   -------------------------------------------------------------------------- */

.quick-stats {
  padding: var(--space-8) 0;
  margin-bottom: var(--space-8);
}

.quick-stats__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .quick-stats__grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
  }
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  position: relative;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

.stat-card--healthy {
  border-left: 3px solid var(--success);
}

.stat-card--degraded {
  border-left: 3px solid var(--warning);
}

.stat-card--down {
  border-left: 3px solid var(--error);
}

.stat-card__icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-2);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-secondary);
}

.stat-card__icon svg {
  fill: #25D366;
}

.stat-card__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.stat-card__value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-card__unit {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-muted);
}

.stat-card__sublabel {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.stat-card__trend--positive {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.stat-card__trend--negative {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.stat-card__trend--stable {
  color: var(--text-muted);
  background: var(--bg-surface-alt);
}

.trend-icon {
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   Metrics Sections (Email, SMS, Trends)
   -------------------------------------------------------------------------- */

.metrics-section {
  padding: var(--space-12) 0;
  border-top: 1px solid var(--border-subtle);
}

.metrics-section__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .metrics-section__header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.metrics-section__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.metrics-section__icon {
  font-size: 1.25rem;
}

.metrics-section__footer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

/* Time Range Selector */
.time-range-selector {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-surface);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.time-range-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.time-range-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-alt);
}

.time-range-btn--active {
  color: var(--text-primary);
  background: var(--bg-surface-alt);
}

/* Country Selector */
.country-selector {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.country-flag {
  font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   Provider / Carrier Table
   -------------------------------------------------------------------------- */

.provider-table {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.provider-table__header {
  display: none;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .provider-table__header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1.2fr 1fr;
    gap: var(--space-4);
    align-items: center;
  }
}

.provider-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-fast) var(--ease-out);
}

@media (min-width: 768px) {
  .provider-row {
    grid-template-columns: 2fr 1.5fr 1fr 1.2fr 1fr;
    gap: var(--space-4);
    align-items: center;
  }
}

.provider-row:last-child {
  border-bottom: none;
}

.provider-row:hover {
  background: var(--bg-surface-alt);
}

.provider-col {
  display: flex;
  align-items: center;
  font-size: var(--text-sm);
}

.provider-col--name {
  gap: var(--space-3);
  font-weight: 500;
  color: var(--text-primary);
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .provider-col--name {
    grid-column: auto;
  }
}

.provider-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #ea4335, #fbbc05, #34a853, #4285f4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.provider-col--latency {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
}

@media (min-width: 768px) {
  .provider-col--latency {
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
  }
}

.latency-bar {
  width: 100%;
  max-width: 100px;
  height: 6px;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.latency-bar__fill {
  height: 100%;
  background: var(--ch-email);
  border-radius: var(--radius-full);
  transition: width var(--duration-base) var(--ease-out);
}

.latency-bar--sms .latency-bar__fill {
  background: var(--ch-sms);
}

.latency-bar__fill--warning {
  background: var(--warning);
}

.latency-value {
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.provider-col--success {
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.provider-col--status {
  justify-content: flex-start;
}

@media (min-width: 768px) {
  .provider-col--status {
    justify-content: center;
  }
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.status-badge--healthy {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.status-badge--degraded {
  color: var(--warning);
  background: rgba(234, 179, 8, 0.1);
}

.status-badge--down {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.provider-col--trend {
  display: none;
}

@media (min-width: 768px) {
  .provider-col--trend {
    display: flex;
    justify-content: flex-end;
  }
}

/* Sparkline Charts */
.sparkline {
  width: 60px;
  height: 20px;
}

.sparkline__line {
  fill: none;
  stroke: var(--ch-email);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline__line--sms {
  stroke: var(--ch-sms);
}

.sparkline__line--warning {
  stroke: var(--warning);
}

/* --------------------------------------------------------------------------
   Chart Tabs
   -------------------------------------------------------------------------- */

.chart-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-surface);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.chart-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.chart-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-alt);
}

.chart-tab--active {
  color: var(--text-primary);
  background: var(--bg-surface-alt);
}

/* --------------------------------------------------------------------------
   Historical Trend Chart
   -------------------------------------------------------------------------- */

.chart-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.chart-area {
  position: relative;
  height: 200px;
  margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
  .chart-area {
    height: 250px;
  }
}

.trend-chart {
  width: 100%;
  height: 100%;
}

.chart-grid {
  stroke: var(--border-subtle);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart-line {
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line--email {
  stroke: var(--ch-email);
}

.chart-line--sms {
  stroke: var(--ch-sms);
}

.chart-line--whatsapp {
  stroke: var(--ch-whatsapp);
}

.chart-y-axis {
  position: absolute;
  top: 0;
  left: -40px;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.chart-x-axis {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  padding-left: 40px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-item--email .legend-dot {
  background: var(--ch-email);
}

.legend-item--sms .legend-dot {
  background: var(--ch-sms);
}

.legend-item--whatsapp .legend-dot {
  background: var(--ch-whatsapp);
}

/* --------------------------------------------------------------------------
   Methodology Section
   -------------------------------------------------------------------------- */

.methodology-section {
  padding: var(--space-12) 0;
}

.methodology-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.methodology-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.methodology-card__icon {
  font-size: 1.25rem;
}

.methodology-card__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
}

.methodology-card__text:last-child {
  margin-bottom: 0;
}

.methodology-card__text--muted {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   CTA Section
   -------------------------------------------------------------------------- */

.status-cta {
  padding: var(--space-16) 0;
  border-top: 1px solid var(--border-subtle);
}

.status-cta__card {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), rgba(34, 197, 94, 0.02));
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-6);
  text-align: center;
}

@media (min-width: 768px) {
  .status-cta__card {
    padding: var(--space-12) var(--space-10);
  }
}

.status-cta__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.status-cta__text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.status-cta__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  justify-content: center;
}

@media (min-width: 640px) {
  .status-cta__actions {
    flex-direction: row;
    gap: var(--space-4);
  }
}

/* --------------------------------------------------------------------------
   Mobile Menu Active State
   -------------------------------------------------------------------------- */

.mobile-menu__link--active {
  color: var(--brand-400);
}

.nav__link--active {
  color: var(--brand-400);
}

/* --------------------------------------------------------------------------
   Loading & Error States
   -------------------------------------------------------------------------- */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-surface-alt) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  margin-bottom: var(--space-6);
}

.error-banner__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--error);
  margin-bottom: var(--space-2);
}

.error-banner__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .stat-card,
  .provider-row,
  .chart-line {
    animation: fadeInUp 0.5s var(--ease-out) forwards;
    opacity: 0;
  }
  
  .stat-card:nth-child(1) { animation-delay: 0.1s; }
  .stat-card:nth-child(2) { animation-delay: 0.15s; }
  .stat-card:nth-child(3) { animation-delay: 0.2s; }
  .stat-card:nth-child(4) { animation-delay: 0.25s; }
  
  .provider-row:nth-child(1) { animation-delay: 0.1s; }
  .provider-row:nth-child(2) { animation-delay: 0.15s; }
  .provider-row:nth-child(3) { animation-delay: 0.2s; }
  .provider-row:nth-child(4) { animation-delay: 0.25s; }
  .provider-row:nth-child(5) { animation-delay: 0.3s; }
  .provider-row:nth-child(6) { animation-delay: 0.35s; }
  .provider-row:nth-child(7) { animation-delay: 0.4s; }
  .provider-row:nth-child(8) { animation-delay: 0.45s; }
}

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