/* ==========================================================================
   PalRaccoons Dashboard – "Basecamp" Theme
   Palette: Nachtcamp-Dunkelblau, Pal-Sphere-Orange, Ember-Rot, Mondlicht-Mint
   ========================================================================== */

:root {
  --bg-deep:      #12161c;
  --bg-panel:     #1a2029;
  --bg-panel-alt: #202836;
  --border:       #2b3444;
  --border-soft:  #232b38;

  --text-main:    #eef1f6;
  --text-muted:   #8b96a8;

  --accent:       #ff7a3d;   /* Pal-Sphere Orange */
  --accent-dark:  #d85e28;
  --ember:        #e6483a;   /* Warnung / Ban */
  --mint:         #3ddc97;   /* Erfolg / Online */
  --dusk:         #5b6ee8;   /* sekundär, Links/Info */

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --font-display: 'Rajdhani', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(255,122,61,0.08), transparent 40%),
    radial-gradient(circle at 85% 100%, rgba(91,110,232,0.08), transparent 40%);
}

a { color: inherit; text-decoration: none; }
.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }
.muted-list { color: var(--text-muted); padding-left: 1.2rem; }
.muted-list li { margin-bottom: 0.4rem; }
code {
  font-family: var(--font-mono);
  background: var(--bg-panel-alt);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ---------------- Pal-Sphere Signature Element ---------------- */
.pal-sphere {
  --size: 34px;
  display: inline-block;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    linear-gradient(to bottom, var(--accent) 0 48%, #fff 48% 52%, var(--text-main) 52% 100%);
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 0 2px var(--border), 0 4px 14px rgba(255,122,61,0.35);
  position: relative;
  flex-shrink: 0;
}
.pal-sphere::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 9px; height: 9px;
  background: var(--bg-deep);
  border: 2px solid var(--border);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.pal-sphere-lg { --size: 64px; }

/* ---------------- App Shell ---------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1.1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 2rem;
}
.sidebar-brand strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  display: block;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.sidebar-nav a {
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.93rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a .icon { font-size: 0.5rem; opacity: 0.5; }
.sidebar-nav a:hover { background: var(--bg-panel-alt); color: var(--text-main); }
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(255,122,61,0.16), transparent);
  color: var(--text-main);
  border-left: 3px solid var(--accent);
  padding-left: calc(0.8rem - 3px);
}

.sidebar-footer {
  border-top: 1px solid var(--border-soft);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.user-chip { display: flex; align-items: center; gap: 0.6rem; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1006;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
}
.user-chip div { display: flex; flex-direction: column; line-height: 1.25; }

/* ---------------- Content ---------------- */
.content {
  flex: 1;
  padding: 2rem 2.4rem 3rem;
  max-width: 1180px;
}

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.8rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.content-header h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  margin: 0 0 0.15rem;
  letter-spacing: 0.01em;
}
.content-header p { margin: 0; }

.status-pill {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
}
.status-pill .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-muted);
}
.status-pill .dot.online { background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.status-pill .dot.offline { background: var(--ember); box-shadow: 0 0 8px var(--ember); }

/* ---------------- Stat Grid ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.8rem;
}
.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--dusk));
}
.stat-label { color: var(--text-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; }

/* ---------------- Panels ---------------- */
.panel-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.2rem;
  align-items: start;
}
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.2rem;
}
.panel h2 { font-family: var(--font-display); margin: 0 0 1rem; font-size: 1.2rem; }
.panel h3 { font-size: 0.95rem; margin: 1.1rem 0 0.5rem; }
.divider { border: none; border-top: 1px solid var(--border-soft); margin: 1.2rem 0; }

.kv-list { display: flex; flex-direction: column; gap: 0.6rem; margin: 0; }
.kv-list > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed var(--border-soft);
}
.kv-list dt { color: var(--text-muted); font-size: 0.88rem; }
.kv-list dd { margin: 0; font-weight: 600; text-align: right; }
.settings-list dd[data-setting-type="bool"].on { color: var(--mint); }
.settings-list dd[data-setting-type="bool"].off { color: var(--ember); }

.player-list { display: flex; flex-direction: column; gap: 0.5rem; }
.player-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-panel-alt);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}
.player-row .name { font-weight: 600; }
.player-row .meta { color: var(--text-muted); font-size: 0.82rem; }

/* ---------------- Tables ---------------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th {
  text-align: left; color: var(--text-muted); font-weight: 600;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 0.6rem; border-bottom: 1px solid var(--border-soft); }
.data-table select {
  background: var(--bg-panel-alt); color: var(--text-main);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem; font-size: 0.85rem;
}

.badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700;
}
.badge-success { background: rgba(61,220,151,0.15); color: var(--mint); }
.badge-muted { background: rgba(139,150,168,0.15); color: var(--text-muted); }

/* ---------------- Forms ---------------- */
label { display: block; font-size: 0.85rem; color: var(--text-muted); margin: 0.7rem 0 0.3rem; font-weight: 600; }
input[type="text"], input[type="password"], select {
  width: 100%;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem;
  font-family: var(--font-body);
}
input:focus, select:focus, button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-sm);
  padding: 0.7rem 1.3rem;
  font-weight: 700; font-size: 0.92rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #1a1006; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--dusk); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-ghost:hover { background: var(--bg-panel-alt); }
.btn-small { padding: 0.45rem 0.9rem; font-size: 0.82rem; }
.btn-danger { background: var(--ember); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.stacked-form { display: flex; flex-direction: column; }
.stacked-form button { margin-top: 1.1rem; }
.inline-form { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.inline-form input { flex: 1; }
.inline-form-tight { display: inline; }

/* ---------------- Alerts ---------------- */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.alert-error { background: rgba(230,72,58,0.12); border-color: rgba(230,72,58,0.4); color: #ff9d92; }
.alert-success { background: rgba(61,220,151,0.12); border-color: rgba(61,220,151,0.4); color: var(--mint); }

/* ---------------- Auth pages ---------------- */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.auth-brand { text-align: center; margin-bottom: 1.6rem; }
.auth-brand .pal-sphere { margin-bottom: 0.8rem; }
.auth-brand h1 { font-family: var(--font-display); font-size: 1.6rem; margin: 0.3rem 0 0.2rem; }
.auth-form button { width: 100%; margin-top: 1.4rem; }

/* ---------------- Live map ---------------- */
.livemap-panel { min-height: 420px; display: flex; align-items: center; justify-content: center; }
.livemap-placeholder { text-align: center; max-width: 440px; }
.livemap-placeholder h2 { font-family: var(--font-display); margin: 1rem 0 0.6rem; }
.livemap-placeholder ul { text-align: left; }

/* ---------------- Responsive ---------------- */
@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-footer { margin-left: auto; }
  .content { padding: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
