/* Oyun Garaj — Assetto Corsa Portal */

:root {
  --bg: #0a0a0c;
  --bg-elevated: #121216;
  --surface: rgba(22, 22, 28, 0.72);
  --border: rgba(255, 120, 40, 0.18);
  --border-hover: rgba(255, 140, 50, 0.45);
  --text: #e8e8ec;
  --text-muted: #8a8a96;
  --accent: #ff6b1a;
  --accent-soft: rgba(255, 107, 26, 0.15);
  --accent-glow: rgba(255, 107, 26, 0.35);
  --success: #2dd4a0;
  --danger: #ff4d5a;
  --warning: #f5b942;
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --transition: 0.22s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Background */

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-glow), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(255, 80, 20, 0.06), transparent),
    linear-gradient(180deg, #0d0d10 0%, var(--bg) 40%);
  pointer-events: none;
}

/* Hero */

.hero {
  text-align: center;
  padding: 2.5rem 1.25rem 2rem;
  max-width: 720px;
  margin: 0 auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent) 0%, #ff9a4d 100%);
  border-radius: var(--radius);
  box-shadow: 0 0 28px var(--accent-glow);
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.hero-title {
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  background: linear-gradient(180deg, #fff 0%, #c8c8d0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto;
}

/* Live global stats */

.live-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 1.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.live-stats__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 120px;
}

.live-stats__value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1.2;
}

.live-stats__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.live-stats__divider {
  width: 1px;
  height: 2rem;
  background: rgba(255, 255, 255, 0.1);
}

.live-stats.is-ready .skeleton--inline {
  display: none;
}

/* Main */

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* Toolbar */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.search-wrap {
  flex: 1 1 220px;
  min-width: 0;
}

.search-input,
.filter-select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus,
.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-group {
  flex: 1 1 140px;
  min-width: 120px;
}

.filter-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.filter-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a8a96'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.results-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Server grid */

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

/* Card */

.server-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.server-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 24px var(--accent-soft);
}

.server-card--offline {
  opacity: 0.55;
}

.server-card--offline:hover {
  transform: none;
  box-shadow: none;
}

.server-card--pending [data-live-players-text] {
  color: var(--text-muted);
}

.server-card--pending .player-bar-fill {
  opacity: 0.25;
  width: 0 !important;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.35;
  word-break: break-word;
  color: var(--text);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.badge--online {
  color: var(--success);
  background: rgba(45, 212, 160, 0.12);
  border-color: rgba(45, 212, 160, 0.3);
  box-shadow: 0 0 12px rgba(45, 212, 160, 0.35);
}

.badge--offline {
  color: var(--danger);
  background: rgba(255, 77, 90, 0.12);
  border-color: rgba(255, 77, 90, 0.35);
  box-shadow: 0 0 12px rgba(255, 77, 90, 0.35);
}

.badge--traffic {
  color: var(--warning);
  background: rgba(245, 185, 66, 0.12);
  border-color: rgba(245, 185, 66, 0.3);
}

.badge--weather {
  color: #7eb8ff;
  background: rgba(126, 184, 255, 0.12);
  border-color: rgba(126, 184, 255, 0.28);
}

.badge--mode {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(255, 107, 26, 0.35);
}

.card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.meta-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.meta-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.meta-value--players {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}

[data-live-players-text] {
  flex: 0 0 auto;
  min-width: 3.25rem;
  font-variant-numeric: tabular-nums;
}

.player-bar {
  flex: 1;
  max-width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.player-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff9a4d);
  border-radius: 2px;
  transition: width 0.45s ease;
}

[data-live-players-text].is-updating {
  opacity: 0.45;
  transform: translateY(2px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Skeleton */

.skeleton {
  display: block;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(255, 255, 255, 0.06) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton--inline {
  display: inline-block;
  width: 2.5rem;
  height: 1.1rem;
  vertical-align: middle;
}

.skeleton--players {
  width: 3.5rem;
  height: 0.85rem;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

.btn {
  flex: 1 1 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent) 0%, #ff8533 100%);
  box-shadow: 0 2px 12px var(--accent-soft);
}

.btn--primary:hover {
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  border-color: var(--border-hover);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Empty state */

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Footer */

.footer {
  text-align: center;
  padding: 1.5rem 1.25rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Responsive */

@media (max-width: 480px) {
  .hero {
    padding-top: 1.75rem;
  }

  .live-stats {
    gap: 0.75rem 1rem;
  }

  .live-stats__divider {
    display: none;
  }

  .live-stats__item {
    flex: 1 1 40%;
    min-width: 0;
  }

  .logo-mark {
    width: 3rem;
    height: 3rem;
    font-size: 0.95rem;
  }

  .server-grid {
    grid-template-columns: 1fr;
  }

  .card-meta {
    grid-template-columns: 1fr;
  }

  .card-actions {
    flex-direction: column;
  }

  .btn {
    flex: 1 1 auto;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
