/* =====================================================
   Winperium - TI4 Dark Space Theme
   ===================================================== */

:root {
  --bg-deep: #0a0a1a;
  --bg-purple: #1a0a2e;
  --gold: #c4a017;
  --gold-light: #f0c840;
  --purple: #4a3f7a;
  --purple-light: #6a5f9a;
  --text-light: #e8e0ff;
  --text-muted: #9988bb;
  --danger: #cc3344;
  --success: #22aa66;
  --warning: #cc8811;
  --border: rgba(196, 160, 23, 0.3);
  --card-bg: rgba(26, 10, 46, 0.8);
  --input-bg: rgba(10, 10, 26, 0.8);
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text-light);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(74, 63, 122, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(196, 160, 23, 0.05) 0%, transparent 40%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3 {
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
h1 { font-size: 2rem; color: var(--gold); text-shadow: 0 0 20px rgba(196, 160, 23, 0.5); }
h2 { font-size: 1.4rem; color: var(--gold); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; color: var(--text-light); margin-bottom: 0.5rem; }

/* ===== LAYOUT ===== */
.site-gate {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a1a 70%);
}

.gate-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 40px rgba(196, 160, 23, 0.1);
}

.gate-logo {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.gate-box h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.gate-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

nav {
  background: rgba(10, 10, 26, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 1rem 0;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  flex: 1;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--gold);
  background: rgba(196, 160, 23, 0.1);
}

.nav-user {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #a08010);
  color: #0a0a1a;
}
.btn-gold:hover { background: linear-gradient(135deg, var(--gold-light), var(--gold)); transform: translateY(-1px); }

.btn-purple {
  background: var(--purple);
  color: var(--text-light);
}
.btn-purple:hover { background: var(--purple-light); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #ee4455; }

.btn-success {
  background: var(--success);
  color: white;
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.btn-ja { background: var(--success); color: white; }
.btn-ja.active { box-shadow: 0 0 10px rgba(34, 170, 102, 0.5); transform: scale(1.05); }
.btn-vielleicht { background: var(--warning); color: white; }
.btn-vielleicht.active { box-shadow: 0 0 10px rgba(204, 136, 17, 0.5); transform: scale(1.05); }
.btn-nein { background: var(--danger); color: white; }
.btn-nein.active { box-shadow: 0 0 10px rgba(204, 51, 68, 0.5); transform: scale(1.05); }

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, select, textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  color: var(--text-light);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(196, 160, 23, 0.15);
}

select option { background: var(--bg-purple); }

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-open { background: rgba(74, 63, 122, 0.5); color: var(--text-light); }
.badge-confirmed { background: rgba(34, 170, 102, 0.2); color: var(--success); border: 1px solid var(--success); }
.badge-closed { background: rgba(100, 100, 100, 0.2); color: var(--text-muted); }
.badge-gold { background: rgba(196, 160, 23, 0.2); color: var(--gold); border: 1px solid var(--border); }

/* ===== ABSTIMMUNG ===== */
.vote-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.vote-date { flex: 1; font-size: 0.9rem; }
.vote-counts { display: flex; gap: 0.5rem; font-size: 0.8rem; }
.vote-count { padding: 0.2rem 0.5rem; border-radius: 4px; }
.count-ja { background: rgba(34, 170, 102, 0.2); color: var(--success); }
.count-vielleicht { background: rgba(204, 136, 17, 0.2); color: var(--warning); }
.count-nein { background: rgba(204, 51, 68, 0.2); color: var(--danger); }
.vote-btns { display: flex; gap: 0.3rem; }

/* ===== FRAKTIONEN ===== */
.fraktion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.fraktion-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.fraktion-card:hover { border-color: var(--gold); }
.fraktion-card.blacklisted { opacity: 0.4; border-color: var(--danger); }
.fraktion-card.selected { border-color: var(--gold); background: rgba(196, 160, 23, 0.1); box-shadow: 0 0 15px rgba(196, 160, 23, 0.2); }
.fraktion-card.taken { opacity: 0.5; border-color: var(--danger); }

.fraktion-emoji { font-size: 1.5rem; margin-bottom: 0.3rem; }
.fraktion-name { font-size: 0.85rem; font-weight: 600; }
.fraktion-expansion { font-size: 0.7rem; color: var(--text-muted); }
.fraktion-count { font-size: 0.7rem; color: var(--gold); }
.fraktion-taken-by { font-size: 0.7rem; color: var(--danger); }

/* ===== MATCH ARCHIV ===== */
.match-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.match-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.match-date { font-size: 1.1rem; font-weight: 700; color: var(--gold); }
.match-duration { font-size: 0.85rem; color: var(--text-muted); }

.spieler-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.spieler-chip {
  background: rgba(74, 63, 122, 0.4);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.spieler-chip.gewonnen {
  border-color: var(--gold);
  background: rgba(196, 160, 23, 0.15);
}

.winner-crown { font-size: 1rem; }

/* ===== WISSEN ===== */
.wissen-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.wissen-icon { font-size: 1.5rem; flex-shrink: 0; }
.wissen-info { flex: 1; }
.wissen-title { font-weight: 600; color: var(--text-light); }
.wissen-title a { color: inherit; text-decoration: none; }
.wissen-title a:hover { color: var(--gold); }
.wissen-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.wissen-actions { flex-shrink: 0; }

/* ===== TAB SYSTEM ===== */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== STATS TABLE ===== */
.stats-table {
  width: 100%;
  border-collapse: collapse;
}
.stats-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.stats-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.9rem;
}
.stats-table tr:hover td { background: rgba(255,255,255,0.03); }

/* ===== ALERTS ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: rgba(204, 51, 68, 0.2); border: 1px solid var(--danger); color: #ff8899; }
.alert-success { background: rgba(34, 170, 102, 0.2); border: 1px solid var(--success); color: #88ffcc; }
.alert-info { background: rgba(74, 63, 122, 0.3); border: 1px solid var(--purple); color: var(--text-light); }

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* ===== LOADER ===== */
.loader {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-purple);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0,0,0,0.8);
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
}
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ===== EXPANSIONS ===== */
.expansion-label {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.3rem;
}
.exp-base { background: rgba(74, 63, 122, 0.4); color: var(--text-muted); }
.exp-pok { background: rgba(196, 160, 23, 0.2); color: var(--gold); }
.exp-edge { background: rgba(34, 170, 102, 0.2); color: var(--success); }

/* ===== ADMIN TABLE ===== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.admin-table th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }
.admin-table tr:hover td { background: rgba(255,255,255,0.03); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { flex-direction: column; padding: 1rem; gap: 0.5rem; }
  .nav-links { justify-content: center; }
  h1 { font-size: 1.5rem; }
  .main-content { padding: 1rem; }
  .card-grid { grid-template-columns: 1fr; }
  .fraktion-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
