/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-unknown: #6b7280;
  --color-primary: #3b82f6;
  --color-bg: #f9fafb;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--spacing-md) 0;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  height: 36px;
  width: auto;
}

.nav {
  display: flex;
  gap: var(--spacing-lg);
}

.nav-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-primary);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  width: 100%;
}

/* Main */
.main {
  flex: 1;
  padding: var(--spacing-2xl) 0;
}

/* Overall Status */
.overall-status {
  margin-bottom: var(--spacing-2xl);
}

.status-card {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-2xl);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
}

.status-card.status-success {
  border-left: 4px solid var(--color-success);
}

.status-card.status-warning {
  border-left: 4px solid var(--color-warning);
}

.status-card.status-error {
  border-left: 4px solid var(--color-error);
}

.status-icon {
  color: var(--color-text-muted);
}

.status-card.status-success .status-icon {
  color: var(--color-success);
}

.status-card.status-warning .status-icon {
  color: var(--color-warning);
}

.status-card.status-error .status-icon {
  color: var(--color-error);
}

.status-text h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
}

.status-subtitle {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Active Incidents */
.active-incidents {
  margin-bottom: var(--spacing-2xl);
}

.active-incidents h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
}

.incident-card {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-warning);
}

.incident-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.incident-endpoint {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.incident-card h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.incident-card h4 a {
  color: var(--color-text);
  text-decoration: none;
}

.incident-card h4 a:hover {
  color: var(--color-primary);
}

.incident-time {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Today's Incidents */
.today-incidents {
  margin-bottom: var(--spacing-2xl);
}

.today-incidents h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
}

.incident-description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
}

.affected-services {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-top: var(--spacing-sm);
}

.severity-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.severity-minor {
  background-color: #dbeafe;
  color: #1e3a8a;
}

.severity-major {
  background-color: #fed7aa;
  color: #7c2d12;
}

.severity-critical {
  background-color: #fecaca;
  color: #7f1d1d;
}

/* Endpoints Section */
.endpoints-section {
  margin-bottom: var(--spacing-2xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.section-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.btn {
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius);
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-refresh {
  background-color: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-refresh:hover {
  background-color: var(--color-bg);
}

/* Endpoints List */
.endpoints-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.endpoint-item {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.endpoint-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
}

.endpoint-info h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.endpoint-info h4 a {
  color: var(--color-text);
  text-decoration: none;
}

.endpoint-info h4 a:hover {
  color: var(--color-primary);
}

.endpoint-description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.endpoint-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--spacing-xs);
}

.status-indicator {
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: 99px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-indicator.status-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.status-indicator.status-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.status-indicator.status-error {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.status-indicator.status-unknown {
  background-color: rgba(107, 114, 128, 0.1);
  color: var(--color-unknown);
}

.response-time {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-family: 'Monaco', 'Courier New', monospace;
}

.endpoint-error {
  background-color: rgba(239, 68, 68, 0.05);
  border-left: 3px solid var(--color-error);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-error);
}

.endpoint-footer {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-badge.status-investigating {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.status-badge.status-identified {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.status-badge.status-monitoring {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
}

.status-badge.status-resolved {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.status-badge.status-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.status-badge.status-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.status-badge.status-error {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: var(--spacing-xl);
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.breadcrumb a {
  color: var(--color-primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.separator {
  margin: 0 var(--spacing-sm);
}

/* Endpoint Details */
.endpoint-details-header {
  margin-bottom: var(--spacing-2xl);
}

.endpoint-details-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
}

.stat-card {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.stat-label {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--spacing-sm);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-value.status-error {
  color: var(--color-error);
}

/* Chart Section */
.chart-section {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
  box-shadow: var(--shadow-sm);
}

.chart-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
}

.chart-container {
  height: 300px;
  position: relative;
}

/* Checks Table */
.checks-section {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
  box-shadow: var(--shadow-sm);
}

.checks-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
}

.checks-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background-color: var(--color-bg);
}

th {
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
}

td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
}

.error-message {
  color: var(--color-error);
  font-size: 0.875rem;
}

.text-muted {
  color: var(--color-text-muted);
}

/* Incidents List Page */
.incidents-header {
  margin-bottom: var(--spacing-2xl);
}

.incidents-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
}

.incidents-list-page {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.incident-card-large {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.incident-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.incident-endpoint-badge {
  background-color: var(--color-bg);
  color: var(--color-text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.incident-card-large h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.incident-card-large h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.incident-card-large h3 a:hover {
  color: var(--color-primary);
}

.incident-description {
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-lg);
  line-height: 1.6;
}

.incident-timestamps {
  display: flex;
  gap: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.timestamp {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.timestamp .label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timestamp .value {
  font-size: 0.875rem;
  color: var(--color-text);
}

/* Incident Details */
.incident-details-header {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
  box-shadow: var(--shadow-sm);
}

.incident-details-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
}

/* Timeline */
.incident-timeline {
  background-color: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
}

.incident-timeline h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xl);
}

.timeline {
  position: relative;
  padding-left: var(--spacing-2xl);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--spacing-2xl);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -1.75rem;
  top: 0;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: var(--color-primary);
  border: 3px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-border);
}

.timeline-content {
  background-color: var(--color-bg);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.timeline-time {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.timeline-message {
  color: var(--color-text);
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
}

.timeline-author {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--color-text-muted);
}

.empty-state svg {
  margin-bottom: var(--spacing-lg);
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
}

/* Error Page */
.error-page {
  text-align: center;
  padding: var(--spacing-2xl);
}

.error-icon {
  margin-bottom: var(--spacing-xl);
  color: var(--color-error);
}

.error-page h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
}

.error-code {
  color: var(--color-text-muted);
  font-size: 1.125rem;
  margin-bottom: var(--spacing-xl);
}

/* Email Subscription */
.email-subscription {
  margin-bottom: var(--spacing-2xl);
}

.subscription-card {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: white;
  padding: 40px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.subscription-card h3 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-md);
}

.subscription-card p {
  margin-bottom: var(--spacing-lg);
  opacity: 0.95;
}

.subscription-form {
  display: flex;
  gap: var(--spacing-md);
  max-width: 500px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.subscription-form input[type="email"] {
  flex: 1;
  min-width: 250px;
  padding: 14px 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
}

.subscription-form input[type="email"]::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.subscription-form input[type="email"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
}

.subscription-form button {
  padding: 14px 28px;
  background: white;
  color: #4f46e5;
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.subscription-form button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.subscription-form button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.subscription-message {
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius);
  font-weight: 500;
  display: none;
}

.subscription-message.success {
  display: block;
  background: rgba(16, 185, 129, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.subscription-message.error {
  display: block;
  background: rgba(239, 68, 68, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

/* Footer */
.footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--spacing-xl) 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-top: auto;
}

.footer-links {
  margin-top: var(--spacing-sm);
}

.footer-links a {
  color: var(--color-primary);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Uptime Graph */
.uptime-graph-container {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md);
  background-color: var(--color-bg);
  border-radius: var(--radius);
}

.uptime-graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
  font-size: 0.875rem;
}

.uptime-label {
  color: var(--color-text-muted);
  font-weight: 500;
}

.uptime-percentage {
  color: var(--color-text);
  font-weight: 600;
}

.uptime-graph {
  width: 100%;
  display: block;
  margin: var(--spacing-sm) 0;
}

.uptime-day {
  cursor: pointer;
  transition: opacity 0.2s;
}

.uptime-day:hover {
  opacity: 0.8;
}

.uptime-graph-legend {
  display: flex;
  justify-content: space-between;
  margin-top: var(--spacing-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.legend-start,
.legend-end {
  font-weight: 500;
}

/* Tooltip for uptime graph */
.uptime-tooltip {
  position: absolute;
  background-color: var(--color-text);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius);
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 1000;
  display: none;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  max-width: 300px;
  line-height: 1.5;
}

.uptime-tooltip strong {
  font-weight: 600;
}

.uptime-tooltip-date {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.uptime-tooltip-stats {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.uptime-tooltip-stat {
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.uptime-tooltip-label {
  color: rgba(255, 255, 255, 0.8);
}

.uptime-tooltip-value {
  font-weight: 600;
}

.uptime-tooltip .status-success {
  color: var(--color-success);
}

.uptime-tooltip .status-warning {
  color: var(--color-warning);
}

.uptime-tooltip .status-error {
  color: var(--color-error);
}

/* Pagination */
.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-xl) 0;
  margin-top: var(--spacing-xl);
  border-top: 1px solid var(--color-border);
}

.pagination-info {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: white;
  color: var(--color-primary);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.pagination-btn:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--spacing-md);
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .status-card {
    flex-direction: column;
    text-align: center;
  }

  .endpoint-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .endpoint-status {
    align-items: flex-start;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .incident-timestamps {
    flex-direction: column;
    gap: var(--spacing-md);
  }
}
