/* Control de sesión en el header (login con Google). Complementa styles.css. */

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.auth-area {
  display: inline-flex;
  align-items: center;
}

.auth-btn {
  font-family: inherit;
  cursor: pointer;
}

/* Botón "Iniciar sesión" (genérico, sin marca de proveedor) */
.auth-btn-signin {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--copper);
  color: var(--white);
  padding: 9px 18px;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background-color 160ms ease;
}

.auth-btn-signin:hover,
.auth-btn-signin:focus-visible {
  background: var(--copper-dark);
}

/* Usuario logueado: botón con avatar que abre un menú de perfil.
   El menú agrupa las acciones del usuario (hoy "Cerrar sesión"; a futuro editar
   perfil, estadísticas…), separadas de la navegación de la página. */
.auth-user {
  position: relative;
  display: inline-flex;
}

.auth-user-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--white);
  padding: 4px 10px 4px 4px;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.auth-user-toggle:hover,
.auth-user-toggle:focus-visible,
.auth-user.is-open .auth-user-toggle {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.auth-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: var(--white);
  object-fit: cover;
}

.auth-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--copper);
  color: var(--white);
  font-weight: 800;
}

.auth-name {
  max-width: 150px;
  overflow: hidden;
  color: var(--white);
  font-size: 0.92rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-caret {
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
  transition: transform 160ms ease;
}

.auth-user.is-open .auth-caret {
  transform: rotate(180deg);
}

/* Menú desplegable del usuario (perfil), anclado al avatar. */
.auth-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: none;
  min-width: 230px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(8, 19, 28, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.auth-user.is-open .auth-menu {
  display: block;
}

.auth-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-menu-name {
  overflow: hidden;
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu-email {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--white);
  padding: 11px 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.auth-menu-item:hover,
.auth-menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
  .header-actions {
    gap: 12px;
  }

  /* La hamburguesa es solo navegación de la página; cuando no hay sesión la
     ocultamos (la home funciona por scroll / CTAs del hero). El perfil vive
     aparte, en el avatar. */
  .site-header.has-auth-ui.is-auth-signed-out .menu-toggle,
  .site-header.has-auth-ui.is-auth-signed-out .site-nav {
    display: none;
  }
}

@media (max-width: 620px) {
  /* En móvil ahorramos espacio: el botón muestra solo el avatar (+ flecha). */
  .auth-name {
    display: none;
  }

  .auth-user-toggle {
    gap: 4px;
    padding: 3px 6px 3px 3px;
  }

  .auth-btn-signin {
    padding: 8px 14px;
    font-size: 0.82rem;
  }
}

/* CTAs de los heroes de juego (home) */
.game-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 16px;
}

.game-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--copper);
  color: var(--white);
  padding: 13px 22px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.game-cta-btn:hover,
.game-cta-btn:focus-visible {
  background: var(--copper-dark);
}

.game-cta-btn[disabled] {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.5);
}

/* Variante secundaria (delineada) para la 2ª acción del hero, p. ej. "Jugar con un amigo". */
.game-cta-btn-secondary {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.42);
  color: var(--white);
}
.game-cta-btn-secondary:hover,
.game-cta-btn-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.72);
}

/* "Jugar en Equipo" plegable (genérico; lo usan home y /app/, ambas cargan auth.css). SOLO en móvil
   (≤560px) reemplaza los 2 botones sueltos 2v2/3v3 por UN botón con chevron: un <details> (sin JS) que
   despliega "Dos equipos de a 2/3". El <summary> reusa la base de botón de cada página (.game-cta-btn /
   .game-card-btn); el menú y el chevron son genéricos. En desktop se ven los 2 sueltos y esto se oculta. */
.team-dropdown { display: none; } /* desktop: oculto (manda los 2 botones sueltos) */
.team-dropdown > summary { list-style: none; cursor: pointer; }
.team-dropdown > summary::-webkit-details-marker { display: none; }
.team-chevron { width: 14px; height: 14px; flex: 0 0 auto; transition: transform 0.18s ease; }
.team-dropdown[open] .team-chevron { transform: rotate(180deg); }
.team-dropdown-menu { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.team-dropdown-item { width: 100%; justify-content: flex-start; }
@media (max-width: 560px) {
  .team-solo { display: none !important; } /* móvil: oculta los 2v2/3v3 sueltos */
  .team-dropdown { display: block; }        /* móvil: muestra el plegable */
}

/* Icono dentro de un botón (Font Awesome Free, SVG inline). Hereda el color del texto via
   currentColor y se dimensiona relativo a la tipografía. Lo cargan home y /app/ (ambas usan auth.css). */
.btn-icon {
  height: 1.15em;
  width: auto;
  flex: 0 0 auto;
}

.game-cta-soon {
  display: inline-flex;
  align-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.66);
  padding: 13px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.game-cta-soon-note {
  margin-left: 6px;
  color: #ffd2b2;
  font-size: 0.82em;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
