/* =====================================================
   WO LIEGT WAS? - STYLES
   ===================================================== */

/* CSS Variables */
:root {
  --bg-dark: #0f0f1a;
  --bg-card: rgba(30, 30, 50, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.1);
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-glass);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.logo-icon {
  font-size: 32px;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-stats {
  display: flex;
  gap: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
}

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

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-light);
}

/* Scoreboard */
.scoreboard {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.scoreboard h2 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-card {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.player-card.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.player-card.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.player-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
  margin-right: 12px;
}

.player-rank.gold {
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
  color: #1f2937;
}

.player-rank.silver {
  background: linear-gradient(135deg, #e5e7eb, #9ca3af);
  color: #1f2937;
}

.player-rank.bronze {
  background: linear-gradient(135deg, #fbbf24, #b45309);
  color: #1f2937;
}

.player-info {
  flex: 1;
}

.player-name {
  font-weight: 500;
  font-size: 0.9375rem;
}

.player-distance {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.player-score {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent-light);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-glass);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
}

/* Map Container */
.map-container {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background: #1a1a2e;
}

/* Target Display */
.target-display {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 16px 32px;
  text-align: center;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.target-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.target-name {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.target-country {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Current Player Indicator */
.current-player {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 24px;
  z-index: 1000;
  box-shadow: 0 0 20px var(--accent-glow);
}

.current-player-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.current-player-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 32px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.player-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.player-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-input-row span {
  width: 80px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.player-input-row input {
  flex: 1;
}

/* Result Modal */
.result-content {
  text-align: center;
}

.result-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.result-target {
  margin-bottom: 24px;
}

.result-target-name {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-target-country {
  font-size: 1rem;
  color: var(--text-secondary);
}

.result-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.result-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
}

.result-player.winner {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.result-player-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-player-rank {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.result-player.winner .result-player-rank {
  background: var(--success);
  color: white;
}

.result-player-name {
  font-weight: 500;
}

.result-player-stats {
  text-align: right;
}

.result-player-distance {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.result-player-points {
  font-weight: 600;
  color: var(--accent-light);
}

/* Animations */
@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Custom Leaflet Marker Styles */

/* Needle-style draggable pin */
.needle-marker {
  background: transparent !important;
  border: none !important;
}

.needle-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.1s ease;
}

.needle-pin:active {
  cursor: grabbing;
}

.needle-head {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--pin-color, var(--accent));
  border: 3px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.needle-shaft {
  width: 4px;
  height: 20px;
  background: linear-gradient(to bottom, var(--pin-color, var(--accent)), #666);
  border-radius: 0 0 2px 2px;
}

.needle-tip {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 10px solid #444;
}

/* Final placed pin (smaller) */
.needle-pin.final .needle-head {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
}

.needle-pin.final .needle-shaft {
  width: 3px;
  height: 16px;
}

.needle-pin.final .needle-tip {
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 8px solid #444;
}

/* Target marker */
.target-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--success), #059669);
  border: 4px solid white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  color: white;
  font-size: 24px;
}

/* Confirm Pin Button */
.btn-confirm {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  transition: var(--transition);
  animation: pulse 2s infinite;
}

.btn-confirm:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border-glass);
  }

  .scoreboard {
    max-height: 120px;
  }

  .map-container {
    height: 60vh;
  }

  .target-display {
    padding: 12px 20px;
  }

  .target-name {
    font-size: 1.25rem;
  }
}

/* Leaflet Overrides */
.leaflet-container {
  background: #1a1a2e;
  font-family: inherit;
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-glass) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-glass) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  color: var(--text-primary);
  margin: 12px 16px;
}

.leaflet-popup-tip {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}