/* Display face for headings/badges — vendored, latin + latin-ext (Czech diacritics). */
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("vendor/chakra-petch-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("vendor/chakra-petch-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Neutrals are tinted toward the amber brand hue (warm dark, not blue-gray). */
  --bg-color: #161410;
  --card-bg-color: #1e1a14;
  --accent-color: #e8a33d;
  --accent-hover: #f0b55a;
  --text-color: #f4f0e6;
  --text-muted: #a89e8a;
  --border-color: rgba(232, 189, 122, 0.12);
  --border-radius: 10px;
  --success-color: #2e7d32;
  --success-badge: #66bb6a;
  --danger-color: #c62828;
  --danger-badge: #ef5350;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Chakra Petch", var(--font-family);
}

/* Visible keyboard focus everywhere (buttons, links, the minimap trigger). */
:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Respect users who opt out of motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  line-height: 1.5;
  padding-bottom: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Header */
header {
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(30, 26, 20, 0.6) 0%, rgba(22, 20, 16, 0) 100%);
  padding: 2rem 1.5rem;
  text-align: center;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

header h1 {
  font-size: clamp(1.6rem, 1rem + 3vw, 2.4rem);
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.last-updated {
  font-size: 0.875rem;
  color: var(--accent-color);
  background: rgba(232, 163, 61, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  display: inline-block;
  border: 1px solid rgba(232, 163, 61, 0.2);
}

/* Error Banner */
.error-banner {
  background-color: var(--danger-color);
  color: var(--text-color);
  padding: 0.75rem 1.5rem;
  text-align: center;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  animation: slideDown 0.3s ease-out;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* Main Content Wrapper */
main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 2rem auto 0 auto;
  padding: 0 1.5rem;
}

/* Loading state */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 0;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* Servers Container */
.servers-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
}

@media (min-width: 1100px) {
  .servers-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Server Card */
.server-card {
  background-color: var(--card-bg-color);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: border-color 0.25s ease;
}

.server-card:hover {
  border-color: rgba(232, 163, 61, 0.3);
}

/* Offline state desaturation */
.server-card.offline {
  opacity: 0.75;
  filter: grayscale(20%);
}

/* Server Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.server-title-area {
  flex: 1;
}

.server-title-area h2 {
  font-size: 1.35rem;
  color: var(--text-color);
  line-height: 1.3;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.online {
  background-color: rgba(46, 125, 50, 0.2);
  color: var(--success-badge);
  border: 1px solid rgba(46, 125, 50, 0.4);
}

.status-badge.offline {
  background-color: rgba(198, 40, 40, 0.2);
  color: var(--danger-badge);
  border: 1px solid rgba(198, 40, 40, 0.4);
}

.last-seen {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Connection Address Widget */
.connection-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.connection-area label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.connection-area code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--accent-color);
  flex: 1;
  word-break: break-all;
}

.copy-btn {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  min-height: 2.75rem; /* 44px touch target */
}

.copy-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn.copied {
  background-color: rgba(46, 125, 50, 0.2);
  border-color: var(--success-badge);
  color: var(--success-badge);
}

/* Meta Data Grid */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 0.25rem 0;
}

@media (max-width: 480px) {
  .meta-grid {
    grid-template-columns: 1fr;
  }
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.meta-value {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Sections in Card */
.card-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-section h3 {
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  color: var(--accent-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Connected Players List */
.players-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-item {
  background-color: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-name {
  font-weight: 600;
}

.player-company {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.player-company.spectator {
  background-color: rgba(255, 255, 255, 0.03);
  font-style: italic;
}

.empty-players {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Companies Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: rgba(0, 0, 0, 0.15);
}

.companies-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
  min-width: 650px;
}

.companies-table th, 
.companies-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.companies-table th {
  background-color: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.companies-table tr:last-child td {
  border-bottom: none;
}

.color-swatch {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.cell-company-name {
  font-weight: 600;
}

.val-positive {
  color: var(--success-badge);
}

.val-negative {
  color: var(--danger-badge);
}

.vehicles-summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Minimap styling */
.minimap-wrapper {
  text-align: center;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem;
  background-color: rgba(0, 0, 0, 0.2);
}

.minimap-img {
  max-width: 100%;
  height: auto;
  max-height: 300px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: block;
  margin: 0 auto;
}

.minimap-img:hover {
  transform: scale(1.02);
}

/* Unstyled button wrapper that makes the minimap keyboard-accessible. */
.minimap-btn {
  background: none;
  border: none;
  padding: 0;
  display: block;
  width: 100%;
  cursor: zoom-in;
  border-radius: 4px;
}

/* Lightbox Overlay */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(10, 12, 16, 0.95);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
  cursor: zoom-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 3rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.lightbox-close:hover {
  color: var(--accent-color);
}

#lightbox-img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  border: 1px solid var(--border-color);
  cursor: default;
}

/* Charts Wrapper */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
}

.chart-card {
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
}

.chart-card h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 220px;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

footer a {
  font-weight: 500;
}
