/* static/css/create_game.css */

:root {
  --bg: #1d1b3a;
  --panel: #2c294d;
  --highlight: #00f0ff;
  --accent: #ffcc00;
  --success: #4bdc65;
  --text: #ffffff;
  --muted: #888;
  --touch-target: 44px;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  font-family: 'Rubik', sans-serif;
  color: var(--text);
  margin: 0;
  padding: 16px;
  min-height: 100vh;
}

h1 {
  font-family: 'Orbitron', sans-serif;
  color: var(--highlight);
  text-align: center;
  margin-bottom: 24px;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.container {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

section {
  background: var(--panel);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 240, 255, 0.1);
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: var(--accent);
  font-size: 1rem;
}

input, button {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  min-height: var(--touch-target);
  transition: all 0.2s ease;
}

input {
  background: #1b1a2e;
  color: var(--text);
  border: 2px solid transparent;
}

input:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

button {
  background: var(--highlight);
  color: #000;
  font-weight: bold;
  cursor: pointer;
  border: 2px solid var(--highlight);
  text-transform: none;
  font-family: inherit;
}

button:hover, button:focus {
  background: #00ccff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 240, 255, 0.2);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background: #555;
  color: #aaa;
  cursor: not-allowed;
  border-color: #555;
  transform: none;
  box-shadow: none;
}

/* ===== GAME CODE DISPLAY ===== */
.game-code-container {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 20px 0;
}

.game-code-input {
  flex: 2; /* Nimmt 2/3 der verfügbaren Breite */
  padding: 12px 16px;
  background: #1b1a2e;
  color: var(--text);
  border: 2px solid var(--highlight);
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  min-height: 44px;
  box-sizing: border-box;
  margin-bottom: 0;
}

.game-code-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.1);
}

.copy-code-btn {
  flex: 1; /* Nimmt 1/3 der verfügbaren Breite */
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: bold;
  cursor: pointer;
  min-height: 44px;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0; /* Override default button margin */
}

.copy-code-btn:hover {
  background: #e6b800;
  transform: translateY(-1px);
}

.copy-code-btn:active {
  transform: translateY(0);
}

.copy-btn {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.copy-btn:hover, .copy-btn:focus {
  background: #e6b800;
  border-color: #e6b800;
}

.copy-btn.secondary {
  background: var(--panel);
  border-color: var(--highlight);
  color: var(--highlight);
  margin-top: 8px;
}

.copy-btn.secondary:hover, .copy-btn.secondary:focus {
  background: var(--highlight);
  color: #000;
  border-color: var(--highlight);
}

#qrContainer {
  text-align: center;
  margin-top: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

#qrcode {
  margin: 16px auto;
  padding: 16px;
  background: white;
  border-radius: 12px;
  display: inline-block;
}

.qr-label {
  color: var(--text);
  margin-bottom: 12px;
  font-weight: bold;
}

.hidden {
  display: none;
}

#hint {
  font-size: 0.9em;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

#muteBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel);
  color: var(--highlight);
  border: 2px solid var(--highlight);
  padding: 0;
  border-radius: 50%;
  font-size: 1.2em;
  cursor: pointer;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  margin: 0;
  min-width: unset;
  min-height: unset;
}

#muteBtn:hover, #muteBtn:focus {
  background: var(--highlight);
  color: var(--panel);
  transform: scale(1.1);
}

#muteBtn:active {
  transform: scale(0.95);
}

/* Custom Toast Notifications */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  color: var(--text);
  padding: 20px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border: 2px solid var(--highlight);
  z-index: 10000;
  min-width: 280px;
  max-width: 90vw;
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  animation: toastSlideIn 0.3s ease-out;
}

.toast.success {
  border-color: var(--success);
  background: var(--panel);
}

.toast.error {
  border-color: #ff3260;
  background: var(--panel);
}

.toast .toast-icon {
  font-size: 2em;
  margin-bottom: 8px;
}

.toast .toast-message {
  font-size: 1rem;
  margin-bottom: 16px;
}

.toast .toast-close {
  background: var(--highlight);
  color: #000;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  min-height: auto;
  width: auto;
  margin: 0;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Lobby styles */
.lobby-player {
  display: flex;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border-left: 4px solid var(--highlight);
}

.lobby-player.master {
  border-left-color: var(--accent);
}

.lobby-player .player-name {
  flex: 1;
  font-weight: bold;
}

.lobby-player .player-status {
  font-size: 0.9em;
  color: var(--muted);
}

/* Responsive improvements */
@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  section {
    padding: 16px;
    margin-bottom: 16px;
  }

  h1 {
    margin-bottom: 16px;
  }

  input, button {
    padding: 14px 16px;
    font-size: 16px;
  }

  #qrContainer {
    padding: 16px;
    margin-top: 16px;
  }

  #muteBtn {
    bottom: 16px;
    right: 16px;
  }

  /* Game Code responsive */
  .game-code-container {
    flex-direction: column;
    gap: 16px;
  }

  .game-code-input,
  .copy-code-btn {
    flex: none;
    width: 100%;
  }

  .game-code-input {
    font-size: 20px;
    letter-spacing: 3px;
  }
}

/* Improved focus visibility */
button:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Loading state */
.loading {
  position: relative;
  color: transparent !important;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 3px solid transparent;
  border-top: 3px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}