:root {
  --background: #0c0c0c;
  --foreground: #ffffff;
  --card: #111111;
  --card-foreground: #ffffff;
  --popover: #141414;
  --popover-foreground: #ffffff;
  --primary: #307ed7;
  --primary-light: #78abe5;
  --primary-foreground: #ffffff;
  --secondary: #1a1a1a;
  --secondary-foreground: #ffffff;
  --muted: #181818;
  --muted-foreground: #a0a0a0;
  --subtle: #6e6e6e;
  --accent: #202020;
  --accent-foreground: #ffffff;
  --destructive: #ef4444;
  --success: #10b981;
  --warning: #f0c94d;
  --border: #232323;
  --card-ring: rgba(255, 255, 255, 0.08);
  --input: #2e2e2e;
  --ring: #307ed7;
  --brand: #296bb7;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.625rem;
  --radius-xl: 0.875rem;
  --chart-grid: rgba(255, 255, 255, 0.05);
  --chart-tick: #6e6e6e;
  color-scheme: dark;
}

html[data-theme="light"] {
  --background: #f4f6f9;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary: #296bb7;
  --primary-light: #307ed7;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --muted: #e2e8f0;
  --muted-foreground: #64748b;
  --subtle: #94a3b8;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --destructive: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --border: #e2e8f0;
  --card-ring: rgba(15, 23, 42, 0.08);
  --input: #cbd5e1;
  --ring: #307ed7;
  --brand: #296bb7;
  --chart-grid: rgba(15, 23, 42, 0.06);
  --chart-tick: #64748b;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--background);
  color: var(--foreground);
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  color: var(--foreground);
  background-image: radial-gradient(circle at 50% 0%, rgba(48, 126, 215, 0.08) 0%, transparent 55%);
  background-attachment: fixed;
}

::selection {
  background: rgba(48, 126, 215, 0.4);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--input);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Lucide SVG Icon helper */
.icon {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

.icon-sm {
  width: 0.875rem;
  height: 0.875rem;
}

.icon-lg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background-color: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--foreground);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.brand-suffix {
  font-weight: 400;
  color: var(--muted-foreground);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  list-style: none;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.nav-link:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.nav-link.active {
  color: var(--foreground);
  background-color: var(--accent);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0.625rem;
  right: 0.625rem;
  bottom: 0.2rem;
  height: 2px;
  border-radius: 999px;
  background-color: var(--brand);
}

.nav-link.active .icon {
  color: var(--primary-light);
}

.nav-divider {
  width: 1px;
  height: 1.25rem;
  background-color: var(--border);
  margin: 0 0.25rem;
}

.theme-btn {
  padding: 0.5rem;
  width: 2.125rem;
  height: 2.125rem;
  justify-content: center;
}

.theme-btn.active-theme {
  color: var(--primary-light);
  background-color: var(--secondary);
}

/* Main Content */
main.container {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 3rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--foreground);
}

.section-icon {
  display: inline-grid;
  place-items: center;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: var(--radius-md);
  background-color: var(--secondary);
  color: var(--primary-light);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

.live-dot.offline {
  background-color: var(--destructive);
  box-shadow: 0 0 8px var(--destructive);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Grids & Cards (matching DoseMTA UCP Card component) */
.grid-servers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.875rem;
}

.card {
  background-color: var(--card);
  color: var(--card-foreground);
  border-radius: var(--radius-xl);
  box-shadow: 0 0 0 1px var(--card-ring);
  padding: 1.125rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  box-shadow: 0 0 0 1px rgba(48, 126, 215, 0.32);
}

/* Server Card */
.server-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.server-name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.status-indicator {
  display: inline-grid;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: var(--radius-sm);
  background-color: var(--secondary);
}

.status-indicator.online {
  color: var(--success);
  background-color: rgba(16, 185, 129, 0.12);
}

.status-indicator.offline {
  color: var(--destructive);
  background-color: rgba(239, 68, 68, 0.12);
}

.server-online-text {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.server-online-text strong {
  color: var(--foreground);
  font-weight: 700;
}

/* Progress Bar */
.progress {
  position: relative;
  height: 1.375rem;
  width: 100%;
  background-color: var(--secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.progress-bar {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1), filter 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  min-width: 1.5rem;
}

.progress-bar:hover {
  filter: brightness(1.1);
}

.server-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}

.footer-timestamp {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.server-meta-pills {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted-foreground);
}

.meta-pill .icon {
  color: var(--primary-light);
}

/* Charts Card */
.chart-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chart-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.chart-wrap {
  position: relative;
  height: 420px;
  width: 100%;
}

.card-divider {
  border: 0;
  height: 1px;
  background-color: var(--border);
  margin: 0.5rem 0;
}

/* Redesigned Rekordok & Mérföldkövek (DoseMTA UCP StatCard + Hero Banner style) */
.records-layout {
  display: grid;
  grid-template-columns: 1.15fr 1.85fr;
  gap: 0.875rem;
}

.record-spotlight {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(48, 126, 215, 0.18), transparent 60%),
    var(--card);
  justify-content: space-between;
  padding: 1.375rem 1.5rem;
}

.spotlight-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.spotlight-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  background-color: rgba(240, 201, 77, 0.14);
  color: var(--warning);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spotlight-icon-box {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-lg);
  background-color: var(--secondary);
  box-shadow: 0 0 0 1px var(--card-ring);
  display: grid;
  place-items: center;
  color: var(--warning);
}

.spotlight-value-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.5rem 0;
}

.spotlight-number {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}

.spotlight-unit {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-left: 0.25rem;
}

.spotlight-caption {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.spotlight-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}

.spotlight-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* UCP StatCard grid (matching src/components/stat-card.tsx) */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
}

.stat-card {
  flex-direction: row;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
}

.stat-card-icon {
  width: 2.625rem;
  height: 2.625rem;
  border-radius: var(--radius-md);
  background-color: var(--secondary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.tone-primary {
  color: var(--primary-light);
}

.tone-success {
  color: var(--success);
}

.tone-warning {
  color: var(--warning);
}

.stat-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.stat-card-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.stat-card-value {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card-hint {
  font-size: 0.75rem;
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Custom Tooltip (UCP Popover style) */
.ucp-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  background-color: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.45;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.ucp-tooltip.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background-color: color-mix(in srgb, var(--card) 60%, transparent);
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--foreground);
}

@media (max-width: 900px) {
  .records-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-divider {
    width: 100%;
    height: 1px;
    margin: 0.25rem 0;
  }

  .chart-wrap {
    height: 320px;
  }

  .stat-cards-grid {
    grid-template-columns: 1fr;
  }
}
