/* ===== Reset básico ===== */
@font-face {
  font-family: 'mc-reg';
  src: url('fonts/1_Minecraft-Regular.otf') format('truetype');
}

* {
  font-family: 'mc-reg';
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at top left, rgba(34, 211, 238, 0.2), transparent 34%),
    radial-gradient(circle at bottom right, rgba(168, 85, 247, 0.18), transparent 32%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  transition: background 0.3s, color 0.3s;
}

h3 {
  margin-bottom: 10px;
}

/* ===== Variables de color ===== */
:root {
  /* Light mode */
  --bg: #08111f;
  --card-bg: rgba(11, 22, 38, 0.82);
  --text: #ecfeff;
  --text-muted: #93c5fd;
  --accent: #22d3ee; /* azul intermedio */
  --button-bg: #0891b2; /* azul intermedio */
  --button-hover: #0e7490;
  --border: rgba(103, 232, 249, 0.18);
}

/* Dark mode */
body.dark-mode {
  --bg: #030712;
  --card-bg: rgba(8, 13, 28, 0.9);
  --text: #fff;
  --text-muted: #a5b4fc;
  --accent: #67e8f9;
  --button-bg: #7c3aed;
  --button-hover: #6d28d9;
  --border: rgba(167, 139, 250, 0.22);
}

/* ===== Contenedor principal ===== */
.container {
  width: 90%;
  max-width: 920px;
  padding: 40px;
  border-radius: 24px;
  background: var(--card-bg);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  transition: background 0.3s, border 0.3s;
  margin: 32px 0;
}

/* ===== Header ===== */
.header {
  text-align: center;
  margin-bottom: 22px;
}

.header h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 700;
  background: linear-gradient(90deg, #67e8f9, #a78bfa, #f0abfc);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  color: white;
  font-size: 1.6rem;
  box-shadow: 0 16px 48px rgba(34, 211, 238, 0.22);
}

.site-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.site-tab {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
  text-decoration: none;
}

.site-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.8), rgba(124, 58, 237, 0.74));
}

.store-preview {
  padding: 22px;
  border-radius: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(168, 85, 247, 0.12));
}

.store-preview h2 {
  margin: 8px 0;
  font-size: 1.35rem;
}

.store-preview p {
  color: var(--text-muted);
  line-height: 1.5;
}

.section-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: -2px 0 12px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.title-img {
  width: 80%; /* ajusta según tu diseño */
  display: block;
  margin: 0 auto 20px;
}

.title-dark {
  display: none; /* por defecto no mostrar dark */
}

body.dark-mode .title-light {
  display: none; /* ocultar light en modo dark */
}

body.dark-mode .title-dark {
  display: block; /* mostrar dark */
}

/* ===== Inputs y secciones ===== */
.section {
  margin-bottom: 32px;
}

.input-field {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s;
  margin-top: 10px;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.input-field.locked {
  opacity: 0.86;
  cursor: not-allowed;
}

/* ===== Status Text ===== */
.status-text {
  margin-top: 8px;
  font-size: 0.875rem;
  text-align: center;
  color: var(--text-muted);
}

.ui-icon {
  width: 1.1em;
  height: 1.1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

.ui-icon svg,
.participant-icon svg,
.volume-indicator svg {
  width: 100%;
  height: 100%;
  display: block;
}

.heading-icon {
  margin-right: 8px;
}

.auth-code-card {
  margin: 14px 0;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(34, 211, 238, 0.1);
  text-align: center;
}

.auth-code-card span {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.auth-code-card strong {
  display: block;
  font-size: 2rem;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.auth-code-card code {
  display: block;
  margin: 10px auto;
  padding: 12px 14px;
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
  color: #ffffff;
  background: rgba(2, 6, 23, 0.62);
  border: 1px solid var(--border);
  font-family: monospace;
  letter-spacing: 0.02em;
}

.auth-code-card p {
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.45;
}

/* ===== Botones ===== */
.primary-btn, .control-btn, .secondary-btn {
  width: 100%;
  padding: 14px 28px;
  font-weight: 600;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  color: #fff;
  background: linear-gradient(135deg, var(--button-bg), #7c3aed);
}

.primary-btn:hover, .control-btn:hover, .secondary-btn:hover {
  background: linear-gradient(135deg, var(--button-hover), #6d28d9);
  transform: scale(1.03);
}

.secondary-btn {
  width: auto;
  margin: 4px auto 0;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.1);
}

.danger-btn {
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.12);
}

.boombox-audio-btn {
  display: block;
  margin: 8px 0 8px;
}

.library-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.library-track-meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(10px);
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
}

.modal-close-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255,255,255,0.1);
  font-size: 1.4rem;
  line-height: 1;
}

.track-library-modal .participants-list {
  max-height: 320px;
  overflow: auto;
}

.control-btn.exit {
  background: #ef4444;
}

.control-btn.exit:hover {
  background: #dc2626;
}

#connectToRoomBtn {
  margin-top: 10px;
}

/* ===== Call Controls ===== */
.call-controls {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.controls-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== Microphone Selector ===== */
.mic-selector-container {
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(0,0,0,0.1);
  transition: background 0.3s, border 0.3s;
}

.mic-selector-container label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.mic-selector {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.2);
  background-color: rgba(255,255,255,0.2);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'mc-reg';
}

.mic-selector:hover {
  background-color: rgba(255,255,255,0.3);
  border-color: var(--accent);
}

.mic-selector:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.mic-selector option {
  background-color: var(--card-bg);
  color: var(--text);
  padding: 10px;
}

/* ===== Volume & Participants ===== */
.volume-control, .participants-section, #gameStatus {
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(0,0,0,0.1);
  transition: background 0.3s, border 0.3s;
}

.volume-slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider {
  flex: 1;
  height: 6px;
  border-radius: 5px;
  background: rgba(0,0,0,0.2);
}

.slider::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: background 0.2s;
}

.slider::-webkit-slider-thumb:hover {
  background: var(--button-bg);
}

/* ===== Participants ===== */
.participants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Бумбоксы отображаются правее */
#boomboxAudioList {
  align-items: flex-end;
}

#boomboxAudioList .participant {
  margin-left: auto;
  transform: translateX(24px);
}

.participant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  transition: background 0.2s;
}

.participant:hover {
  background: rgba(255,255,255,0.2);
}

/* NUEVO: Estilos para las skins de Minecraft */
.participant-skin {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  image-rendering: pixelated; /* Mantener el estilo pixelado de Minecraft */
  background: rgba(0,0,0,0.1);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.participant:hover .participant-skin {
  transform: scale(1.1);
}

.participant-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.participant-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.volume-indicator {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

#darkModeToggle {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px;
  background: var(--accent);
  border-radius: 12px;
  cursor: pointer;
  border: none;
  z-index: 1000;
  transition: background 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#darkModeToggle:hover {
  background: var(--button-hover);
  transform: scale(1.1);
}

#darkModeToggle img {
  display: block;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .controls-row {
    flex-direction: column;
  }

  .library-add-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Push to Talk ===== */
.ptt-container {
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(0,0,0,0.1);
  transition: background 0.3s, border 0.3s;
}

.ptt-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.ptt-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.ptt-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.ptt-key-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.ptt-key-selector label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.ptt-key-button {
  padding: 12px 20px;
  border-radius: 8px;
  border: 2px solid rgba(0,0,0,0.2);
  background-color: rgba(255,255,255,0.2);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
  font-family: 'mc-reg';
}

.ptt-key-button:hover {
  background-color: rgba(255,255,255,0.3);
  border-color: var(--accent);
  transform: scale(1.05);
}

.ptt-key-button:active {
  transform: scale(0.98);
}

.ptt-key-button.listening {
  border-color: var(--accent);
  background-color: rgba(99,102,241,0.2);
  animation: pulse 1.5s infinite;
}

.ptt-key-input {
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid rgba(0,0,0,0.2);
  background-color: rgba(255,255,255,0.2);
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ptt-key-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.ptt-key-input.listening {
  border-color: var(--accent);
  background-color: rgba(99,102,241,0.1);
  animation: pulse 1.5s infinite;
}

.ptt-key-display {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Indicador visual cuando Push-to-Talk está activo */
.ptt-active-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1000;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}