/* ─── 1. RESET ─────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── 2. CSS VARIABLES ─────────────────────────────────────────────────────── */

:root {
  --color-bg:       #f4f4f4;
  --color-card:     #eeeeee;
  --color-accent:   #4a90e2;
  --color-text:     #333333;
  --color-online:   #2ecc71;
  --color-offline:  #e74c3c;
  --font-base:      'Segoe UI', Tahoma, Arial, sans-serif;
  --bg-image:       url("apbackground_light.png");
}

/* Dark‐mode overrides on the html element */
html[data-theme="dark"] {
  --color-bg:       #1e1e1e;
  --color-card:     #2a2a2a;
  --color-accent:   #5e9cff;
  --color-text:     #f0f0f0;
  --bg-image:       url("apbackground_dark.png");
}

/* Smooth global transitions */
* {
  transition: 
    background-color 0.3s ease, 
    color            0.3s ease, 
    transform        0.2s ease, 
    box-shadow       0.2s ease;
}

/* ─── 3. GLOBAL STYLES ─────────────────────────────────────────────────────── */

body {
  font-family:      var(--font-base);
  background-color: var(--color-bg);
  background-image: var(--bg-image);
  background-repeat: no-repeat;
  background-size:   cover;
  color:            var(--color-text);
  margin:           0;
  padding:          20px;
  line-height:      1.5;
}

h1, h2 {
  color:            var(--color-accent);
  margin-bottom:    0.5rem;
}

/* ─── 4. HEADER & NAVBAR ─────────────────────────────────────────────────── */

.site-header {
  color:      white;
}

.header-content {
  max-width: 900px;
  margin:    auto;
  display:   flex;
  align-items: center;
  justify-content: space-between;
  padding:   1rem 0;
}

.logo-title {
  display:     flex;
  align-items: center;
  gap:         0.75rem;
}

.logo {
  width:  48px;
  height: 48px;
}

.navbar {
  display:      flex;
  align-items:  center;
  gap:          1rem;
}

.nav-links {
  list-style: none;
  display:    flex;
  gap:        1rem;
}

.nav-links a {
  color:           white;
  text-decoration: none;
  font-weight:     500;
  padding:         0.25rem 0.5rem;
  border-radius:   4px;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.2);
}

.theme-toggle {
  background: none;
  border:     none;
  font-size:  1.25rem;
  cursor:     pointer;
  color:      white;
}

.theme-toggle:hover {
  transform: rotate(20deg);
}

/* ─── 5. MAIN CONTAINER ──────────────────────────────────────────────────── */

.container {
  max-width: 900px;
  margin:    2rem auto;
  padding:   1.5rem;
  background: var(--color-card);
  border-radius: 8px;
  box-shadow:    0 4px 16px rgba(0,0,0,0.1);
  display:       flex;
  flex-direction: column;
  gap:          2rem;
}

/* ─── 6. STATUS CARD & ANIMATIONS ───────────────────────────────────────── */

.status-card {
  display:        flex;
  justify-content: space-around;
  background:     var(--color-bg);
  padding:        1rem;
  border-radius:  8px;
  position:       relative;
  overflow:       hidden;
}

.status-item {
  display:       flex;
  flex-direction: column;
  align-items:   center;
}

.status-label {
  font-size:  0.9rem;
  opacity:    0.7;
  margin-bottom: 0.25rem;
}

.status-value {
  font-size:  1.25rem;
  font-weight:bold;
}

#server-status.online {
  color: var(--color-online);
}

#server-status.offline {
  color: var(--color-offline);
}

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.status-card.pulse .status-value {
  animation: pulse 0.6s ease-in-out;
}

/* ─── 7. PLAYERS GRID ────────────────────────────────────────────────────── */

.players-section h2 {
  text-align: center;
  font-size: 1.5rem;
}

.player-list {
  display:       flex;
  flex-wrap:     wrap;
  justify-content: center;
  gap:           1rem;
}

.player {
  width:         120px;
  background:    var(--color-card);
  border-radius: 8px;
  box-shadow:    0 2px 8px rgba(0,0,0,0.05);
  text-align:    center;
  padding:       0.75rem;
}

.player:hover {
  transform:     translateY(-4px);
  box-shadow:    0 6px 16px rgba(0,0,0,0.1);
}

.player img {
  width:        64px;
  height:       64px;
  border-radius:50%;
  margin-bottom: 0.5rem;
}

.player .name {
  font-weight: 600;
  font-size:   0.95rem;
  word-break:  break-word;
}

/* ─── 8. RESPONSIVE ───────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .status-card {
    flex-direction: column;
    gap:            1rem;
  }
  .player {
    flex: 1 1 40%;
  }
  .nav-links {
    display: none;
  }
}

/* ─── COPY-IP LINK STYLES ─────────────────────────────────────────────────── */

.link-section {
  margin-top: 2rem;
}

.link-container {
  display: flex;
  justify-content: center;
  position: relative; /* for popup positioning */
}

.copy-ip-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--color-accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s;
}

.copy-ip-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.copy-ip-text--primary {
  font-size: 1rem;
  font-weight: 600;
}

.copy-ip-text--secondary {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.25rem;
}

/* popup “Copied!” message */
.copy-popup {
  position: absolute;
  top: -2.5rem;
  background: var(--color-accent);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.9rem;
  pointer-events: none;
  animation: fadeInOut 1s ease forwards;
}

@keyframes fadeInOut {
  0%   { opacity: 0; transform: translateY(-10px); }
  10%  { opacity: 1; transform: translateY(0); }
  90%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}