/* ============================================================
   Galaxy Forge — App CSS
   Custom Properties + Komponenten-Klassen
   Mobile First
   ============================================================ */

:root {
  --bg-base:        #030712;
  --bg-surface:     rgba(8, 15, 32, 0.85);
  --bg-elevated:    rgba(12, 20, 42, 0.90);
  --bg-hover:       rgba(20, 32, 64, 0.95);
  --accent:         #0066cc;
  --accent-soft:    #003d7a;
  --accent-glow:    #00f2ff;
  --cyan:           #00f2ff;
  --gold:           #f59e0b;
  --text-primary:   #dde8f0;
  --text-secondary: #7aa8c4;
  --text-muted:     #3a5068;
  --success:        #00e676;
  --warning:        #f59e0b;
  --danger:         #ff3d71;
  --border:         rgba(0, 180, 220, 0.12);
  --border-glow:    rgba(0, 242, 255, 0.08);
}

/* Basis */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Exo 2', 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 180, 220, 0.20); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 242, 255, 0.35); }

/* ============================================================
   Panel-Komponenten
   ============================================================ */

.panel {
  background: rgba(8, 16, 36, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 200, 240, 0.14);
  border-radius: 3px;
  padding: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 24px rgba(0, 0, 0, 0.6),
    0 0 12px rgba(0, 100, 200, 0.06),
    inset 0 1px 0 rgba(0, 242, 255, 0.18);
  clip-path: polygon(
    0 10px, 10px 0,
    calc(100% - 10px) 0, 100% 10px,
    100% calc(100% - 10px), calc(100% - 10px) 100%,
    10px 100%, 0 calc(100% - 10px)
  );
}

/* Leuchtende Eck-Akzente */
.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(135deg, rgba(0,242,255,0.12) 0%, transparent 25%) 0 0 / 48px 48px no-repeat,
    linear-gradient(225deg, rgba(0,242,255,0.08) 0%, transparent 20%) 100% 0 / 48px 48px no-repeat,
    linear-gradient(315deg, rgba(0,242,255,0.06) 0%, transparent 20%) 100% 100% / 48px 48px no-repeat,
    linear-gradient(45deg,  rgba(0,242,255,0.06) 0%, transparent 20%) 0 100% / 48px 48px no-repeat;
}

.panel-accent {
  border-color: rgba(0, 242, 255, 0.25);
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.12), inset 0 0 0 1px rgba(0, 242, 255, 0.08);
}

.panel-accent::after {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,242,255,0.45), transparent);
  pointer-events: none;
}

.panel-danger {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.1);
}

.panel-warning {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.1);
}

/* ============================================================
   Ressourcen-Badge
   ============================================================ */

.resource-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0, 242, 255, 0.04);
  border: 1px solid rgba(0, 242, 255, 0.08);
  border-radius: 3px;
  padding: 0.15rem 0.5rem 0.15rem 0.35rem;
  min-height: 36px;
}

button.resource-badge {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
button.resource-badge:hover,
button.resource-badge:focus-visible {
  border-color: rgba(0, 242, 255, 0.3);
  box-shadow: 0 0 8px rgba(0, 242, 255, 0.12);
  outline: none;
}

.resource-badge.warning {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.15);
}

.resource-badge.critical {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.resource-badge .rate-positive { color: var(--success); }
.resource-badge .rate-negative { color: var(--danger); }
.resource-badge .rate-warning  { color: var(--warning); }

/* ============================================================
   Status-Badges
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-active  { background: rgba(34, 197, 94, 0.15);  color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger  { background: rgba(239, 68, 68, 0.15);  color: var(--danger); }
.badge-info    { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-accent  { background: rgba(0,242,255,0.1);  color: var(--cyan);    border: 1px solid rgba(0,242,255,0.25); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--gold);    border: 1px solid rgba(245,158,11,0.25); }
.badge-muted   { background: rgba(20,35,60,0.6);   color: var(--text-muted); border: 1px solid rgba(0,100,140,0.15); }

/* Pulsierende Badge für Angriff/Kritisch */
.badge-pulse {
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-weight: 500;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  cursor: pointer;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: none;
  font-size: 0.875rem;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(0, 60, 150, 0.85), rgba(0, 100, 200, 0.7));
  color: var(--cyan);
  border: 1px solid rgba(0, 242, 255, 0.45);
  text-shadow: 0 0 8px rgba(0, 242, 255, 0.4);
  box-shadow: 0 0 12px rgba(0, 120, 255, 0.25);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.75rem;
  clip-path: polygon(0 4px, 4px 0, calc(100% - 4px) 0, 100% 4px,
             100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px));
}
.btn-primary:hover {
  background: linear-gradient(135deg, rgba(0, 80, 180, 0.95), rgba(0, 130, 240, 0.85));
  box-shadow: 0 0 22px rgba(0, 180, 255, 0.45), 0 0 40px rgba(0, 100, 255, 0.15);
  color: #ffffff;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-sm {
  min-height: 44px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  min-height: 52px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

/* ============================================================
   Tab-Navigation
   ============================================================ */

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  gap: 0;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-item {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  min-height: 44px;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  flex-shrink: 0;
}
.tab-item.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 242, 255, 0.4);
}
.tab-item:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

/* ============================================================
   Fortschrittsbalken
   ============================================================ */

.progress-bar {
  background: rgba(5,15,35,0.8);
  border: 1px solid rgba(0,180,220,0.1);
  border-radius: 9999px;
  overflow: hidden;
  height: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(0,80,200,0.9), var(--cyan));
  box-shadow: 0 0 6px rgba(0,242,255,0.35);
  border-radius: 9999px;
  transition: width 0.5s ease;
}

.progress-fill-success {
  background: linear-gradient(90deg, #16a34a, var(--success));
}

.progress-fill-warning {
  background: linear-gradient(90deg, #d97706, var(--warning));
}

.progress-fill-danger {
  background: linear-gradient(90deg, #dc2626, var(--danger));
}

/* ============================================================
   Skeleton-Loading
   ============================================================ */

.skeleton {
  background: var(--bg-elevated);
  border-radius: 0.375rem;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ============================================================
   Toast-Benachrichtigungen
   ============================================================ */

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  animation: toast-in 0.2s ease forwards;
  border: 1px solid transparent;
  line-height: 1.4;
}
.toast-error   { background: #2d1212; border-color: #7f1d1d; color: #fca5a5; }
.toast-success { background: #0d2d1a; border-color: #14532d; color: #86efac; }
.toast-info    { background: #0d1a2d; border-color: #1e3a5f; color: #93c5fd; }
.toast-warning { background: #2d1d08; border-color: #78350f; color: #fcd34d; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ============================================================
   Fehler- und Info-Banner
   ============================================================ */

.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  clip-path: polygon(0 4px, 4px 0, calc(100% - 4px) 0, 100% 4px,
             100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px));
}

.warning-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.success-banner {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

/* ============================================================
   Input-Felder
   ============================================================ */

.input {
  background: rgba(8, 16, 36, 0.8);
  border: 1px solid rgba(0, 180, 220, 0.2);
  color: var(--text-primary);
  border-radius: 0.375rem;
  padding: 0.625rem 0.75rem;
  width: 100%;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: 'Exo 2', 'Inter', sans-serif;
  min-height: 44px;
}
.input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 242, 255, 0.1);
}
.input::placeholder {
  color: var(--text-muted);
}
.input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.input-error-text {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.25rem;
}

/* ============================================================
   Polling-Indikator
   ============================================================ */

.poll-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 4px var(--cyan);
  flex-shrink: 0;
  animation: poll-idle 3s ease-in-out infinite;
}
@keyframes poll-idle {
  0%, 100% { opacity: 0.5; box-shadow: 0 0 3px var(--cyan); }
  50%       { opacity: 0.9; box-shadow: 0 0 7px var(--cyan); }
}
.poll-dot.loading {
  animation: poll-blink 0.8s ease-in-out infinite;
}
@keyframes poll-blink {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 1; box-shadow: 0 0 10px var(--cyan), 0 0 20px rgba(0,242,255,0.3); }
}

/* ============================================================
   Glow-Linie (Trennelemente)
   ============================================================ */

.glow-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 242, 255, 0.30), transparent);
  border: none;
}

/* ============================================================
   Scrollbar verstecken
   ============================================================ */

.scrollbar-hide {
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ============================================================
   Sternenkarte — Login-Hintergrund
   ============================================================ */

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  pointer-events: none;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.1; }
  50%       { opacity: var(--max, 0.6); }
}

/* ============================================================
   Rassen-Karten (Registrierung)
   ============================================================ */

.race-card {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.race-card:hover {
  border-color: var(--accent-soft);
  background: var(--bg-hover);
}
.race-card.selected {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.1);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.2);
}

/* ============================================================
   Avatar-Auswahl (Registrierung)
   ============================================================ */

.avatar-option {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-option:hover {
  border-color: var(--accent-soft);
}
.avatar-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
}

/* ============================================================
   Wizard-Schritte (Registrierung)
   ============================================================ */

.wizard-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wizard-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.wizard-dot.active {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.2);
  color: var(--accent-glow);
}
.wizard-dot.done {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.wizard-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  transition: background 0.2s ease;
}
.wizard-line.done {
  background: var(--accent-soft);
}

/* ============================================================
   Navigations-Item (Sidebar)
   ============================================================ */

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  color: var(--text-primary);
  background: rgba(0, 242, 255, 0.04);
  border-color: rgba(0, 242, 255, 0.08);
}
.nav-item {
  font-family: 'Exo 2', sans-serif;
  letter-spacing: 0.03em;
}
.nav-item.active {
  color: var(--cyan);
  background: rgba(0, 242, 255, 0.08);
  border-color: rgba(0, 242, 255, 0.2);
  text-shadow: 0 0 8px rgba(0, 242, 255, 0.3);
}

/* ============================================================
   Bottom Nav Aktiv-Indikator
   ============================================================ */

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-height: 56px;
  padding: 0.5rem 0.25rem 0.375rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
  position: relative;
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active { color: var(--cyan); }
.bottom-nav-item .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 1.25rem;
  line-height: 1;
}
.bottom-nav-item .nav-label {
  font-size: 0.6875rem;
  font-weight: 500;
}
.bottom-nav-indicator {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--cyan);
}

/* ============================================================
   Typ-Utilities
   ============================================================ */

.text-tabular {
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   Responsive Visibility Helpers
   ============================================================ */

@media (min-width: 1024px) {
  .mobile-only { display: none !important; }
}
@media (max-width: 1023px) {
  .desktop-only { display: none !important; }
}

@media (max-width: 640px) {
  .panel {
    padding: 0.875rem;
  }

  .tab-item {
    padding: 0.7rem 0.85rem;
    font-size: 0.8125rem;
  }

  .resource-badge {
    font-size: 0.75rem;
  }
}

input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============================================================
   Fade-In Animation
   ============================================================ */

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fade-in-up 0.2s ease forwards;
}

/* ============================================================
   Drawer Slide-Up
   ============================================================ */

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

.slide-up {
  animation: slide-up 0.25s ease forwards;
}

/* ============================================================
   Planet-Hintergrund
   ============================================================ */

.planet-bg {
  position: fixed;
  bottom: -220px;
  right: -160px;
  width: 650px;
  height: 650px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.planet-sphere {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%,
    #1a3a5c 0%, #0e2340 30%, #071628 60%, #02080f 100%);
  animation: planet-rotate 140s linear infinite;
  position: relative;
  overflow: hidden;
}

.planet-sphere::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 28% 38%, rgba(0,80,180,0.3) 0%, transparent 48%),
    radial-gradient(ellipse at 68% 58%, rgba(0,50,120,0.2) 0%, transparent 38%),
    radial-gradient(ellipse at 50% 70%, rgba(0,100,160,0.15) 0%, transparent 30%);
  animation: cloud-drift 90s linear infinite;
}

.planet-atmosphere {
  position: absolute;
  inset: -25px;
  border-radius: 50%;
  background: radial-gradient(circle,
    transparent 44%,
    rgba(0,80,200,0.04) 56%,
    rgba(0,140,255,0.10) 70%,
    rgba(0,200,255,0.06) 80%,
    transparent 88%);
  filter: blur(10px);
}

@keyframes planet-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes cloud-drift {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}
