/* ==========================================================================
   Nitro Simracing — Menú Simuladores (Game Selector)
   Referencia de diseño: panel-piloto.php / panel-hub.css
   ========================================================================== */

/* ──────────────────────────────────────────────
   1. HOST / CONTENEDOR — limpiar herencia Woodmart
   ────────────────────────────────────────────── */
.whb-general-header .wd-header-text.sn-menu-simuladores-stack > p,
.whb-general-header .wd-header-text.sn-menu-simuladores-stack > .wd-html-content > p {
  display: none !important;
}

.whb-general-header .wd-header-text.sn-menu-simuladores-stack,
.whb-general-header .wd-header-html:has(.menu-simuladores-nav),
.whb-general-header .wd-header-text:has(.menu-simuladores-nav),
.whb-column:has(.menu-simuladores-nav),
div:has(> .menu-simuladores-nav),
div:has(> div > .menu-simuladores-nav) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* ──────────────────────────────────────────────
   2. NAV WRAPPER
   ────────────────────────────────────────────── */
.menu-simuladores-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* ──────────────────────────────────────────────
   3. LISTA DESKTOP
   ────────────────────────────────────────────── */
.menu-simuladores-list {
  display: flex;
  flex-grow: 1;
  justify-content: center;
  align-items: center;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  gap: 4px; /* separación mínima — el padding del item da el espacio visual */
}

/* ──────────────────────────────────────────────
   4. ITEMS — estado por defecto
   ────────────────────────────────────────────── */
.menu-simuladores-item {
  position: relative;
  border-radius: var(--sn-radius);          /* 12px */
  overflow: visible;
  background: transparent;
  border: 1px solid transparent;
  margin: 0;
  transition: background 0.2s ease, border-color 0.2s ease,
              box-shadow 0.2s ease, transform 0.2s ease;
}

.menu-simuladores-item a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 6px 12px;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
  background: transparent;
  border: none;
  border-radius: inherit;
}

/* Imágenes — logos de simuladores */
.menu-simuladores-nav .menu-simuladores-item picture,
.menu-simuladores-nav .menu-simuladores-item img {
  max-width: none !important;
  width: auto !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: none !important;
  display: block !important;
  object-fit: contain !important;
  transition: transform 0.25s ease, filter 0.25s ease;
  filter: none;
}

/* El span nombre se oculta — el logo es el identificador */
.menu-simuladores-item .sim-nombre {
  display: none;
}

/* ──────────────────────────────────────────────
   5. HOVER + ACTIVO — fondo rojo glassmorphism
   ────────────────────────────────────────────── */
.menu-simuladores-item:hover {
  background: linear-gradient(
    180deg,
    rgba(201, 13, 5, 0.08) 0%,
    rgba(201, 13, 5, 0.18) 100%
  );
  border-color: rgba(201, 13, 5, 0.35);
  box-shadow: 0 4px 18px rgba(201, 13, 5, 0.14);
  transform: translateY(-2px);
}

.menu-simuladores-item.active {
  background: linear-gradient(
    180deg,
    rgba(201, 13, 5, 0.12) 0%,
    rgba(201, 13, 5, 0.24) 100%
  );
  border-color: rgba(201, 13, 5, 0.55);
  box-shadow:
    0 4px 18px rgba(201, 13, 5, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Indicador inferior del item activo */
.menu-simuladores-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--sn-theme-primary-accent);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 -1px 8px rgba(201, 13, 5, 0.55);
}

/* Efecto en el logo al hover/active */
.menu-simuladores-item:hover picture,
.menu-simuladores-item:hover img,
.menu-simuladores-item.active picture,
.menu-simuladores-item.active img {
  filter: drop-shadow(0 0 6px rgba(255, 80, 60, 0.25));
  transform: scale(1.06);
}

/* ──────────────────────────────────────────────
   6. BOTÓN FILTRAR (solo usuarios logueados)
   ────────────────────────────────────────────── */
.menu-simuladores-item.sim-edit-btn {
  position: static !important;    /* en el flujo normal — NO absolute */
  margin-left: auto;              /* empuja al extremo derecho del flex */
  margin-right: 0;
  background: transparent !important;
  border: none !important;
  overflow: visible;
  z-index: 10;
  height: auto;
}

.sn-filter-dropdown-trigger,
button.sn-filter-dropdown-trigger {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  padding: 7px 14px !important;
  color: rgba(255, 255, 255, 0.8) !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--sn-radius-sm, 8px) !important;
  outline: none !important;
  cursor: pointer !important;
  min-height: auto !important;
  box-shadow: none !important;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}

.sn-filter-dropdown-trigger:hover,
button.sn-filter-dropdown-trigger:hover,
.sn-filter-dropdown-trigger.active,
button.sn-filter-dropdown-trigger.active {
  background: rgba(201, 13, 5, 0.16) !important;
  border-color: rgba(201, 13, 5, 0.45) !important;
  color: #fff !important;
  outline: none !important;
  filter: none !important;
  box-shadow: none !important;
}

/* Caret anima al abrir */
.sn-filter-dropdown-trigger .sn-caret {
  transition: transform 0.2s ease;
}
.sn-filter-dropdown-trigger.active .sn-caret {
  transform: rotate(180deg);
}

/* ──────────────────────────────────────────────
   7. DROPDOWN DEL FILTRO
   ────────────────────────────────────────────── */
.sn-filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: rgba(18, 22, 32, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--sn-radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: var(--sn-z-dropdown);
  overflow: hidden;
}

.sn-filter-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sn-filter-header {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.sn-filter-header span {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sn-filter-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 6px 0;
}

.sn-filter-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.sn-filter-toggle-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sn-filter-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: #e2e8f0;
}

/* Toggle switch */
.sn-toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.sn-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sn-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  transition: background 0.3s;
}

.sn-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}

input:checked + .sn-slider {
  background: var(--sn-theme-primary-accent);
}

input:focus + .sn-slider {
  box-shadow: 0 0 0 2px rgba(201, 13, 5, 0.3);
}

input:checked + .sn-slider::before {
  transform: translateX(16px);
}

input:disabled + .sn-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.sn-filter-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px;
}

.sn-filter-edit-link {
  display: block;
  text-align: center;
  padding: 10px 14px;
  color: var(--sn-theme-primary);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.15);
  transition: background 0.2s, color 0.2s;
}

.sn-filter-edit-link:hover {
  background: rgba(201, 13, 5, 0.1);
  color: #fff;
}

/* ──────────────────────────────────────────────
   8. TRIGGER MÓVIL — oculto en desktop
   ────────────────────────────────────────────── */
.menu-simuladores-nav .mobile-trigger {
  display: none;
}

/* ──────────────────────────────────────────────
   9. RESPONSIVE — menú desplegable 2 columnas
   Breakpoint 991px para coincidir con header de Woodmart
   ────────────────────────────────────────────── */
@media (max-width: 991px) {

  /* Mostrar botón trigger */
  .menu-simuladores-nav .mobile-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 16px;
    background: rgba(18, 22, 32, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sn-radius-lg);
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.2s ease, background 0.2s ease;
    outline: none;
  }

  .menu-simuladores-nav .mobile-trigger:hover,
  .menu-simuladores-nav.mobile-open .mobile-trigger {
    border-color: rgba(201, 13, 5, 0.45);
    background: rgba(22, 26, 38, 0.96);
  }

  /* Caret del trigger gira cuando está abierto */
  .menu-simuladores-nav .mobile-trigger .fa-chevron-down {
    transition: transform 0.25s ease;
  }
  .menu-simuladores-nav.mobile-open .mobile-trigger .fa-chevron-down {
    transform: rotate(180deg);
  }

  /* Lista oculta por defecto */
  .menu-simuladores-list {
    display: none !important;  /* ocultar en reposo */
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(14, 18, 28, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--sn-radius-lg);
    padding: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    z-index: var(--sn-z-dropdown);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  /* Se activa con clase del nav (manejada por JS) O con is-open en el ul (manejada por PHP onclick) */
  .menu-simuladores-nav.mobile-open .menu-simuladores-list,
  .menu-simuladores-list.is-open {
    display: grid !important;
    animation: snSlideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  /* Items en el desplegable — más grandes, con fondo */
  .menu-simuladores-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--sn-radius-sm);
  }

  .menu-simuladores-item a {
    padding: 14px 10px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
  }

  .menu-simuladores-item picture,
  .menu-simuladores-item img {
    height: 22px !important;
    width: auto !important;
    flex-shrink: 0;
  }

  /* Mostrar nombre en móvil */
  .menu-simuladores-item .sim-nombre {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #d2dcf0;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hover/activo en móvil */
  .menu-simuladores-item:hover,
  .menu-simuladores-item.active {
    background: rgba(201, 13, 5, 0.14);
    border-color: rgba(201, 13, 5, 0.4);
    transform: none; /* sin float en móvil */
    box-shadow: none;
  }

  .menu-simuladores-item.active::after {
    display: none; /* sin línea inferior en móvil */
  }

  /* Botón filtrar — span completo abajo */
  .menu-simuladores-item.sim-edit-btn {
    grid-column: 1 / -1;
    position: static !important;
    transform: none !important;
    top: auto !important;
    right: auto !important;
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--sn-radius-sm);
    width: 100%;
  }

  .menu-simuladores-item.sim-edit-btn:hover {
    background: rgba(201, 13, 5, 0.08) !important;
    border-color: rgba(201, 13, 5, 0.3) !important;
    transform: none !important;
    box-shadow: none !important;
  }

  .sn-filter-dropdown-trigger {
    width: 100%;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 10px;
    font-size: 0.85rem;
  }

  .sn-filter-dropdown-trigger:hover,
  .sn-filter-dropdown-trigger.active {
    background: transparent;
    border-color: transparent;
  }

  /* Dropdown del filtro — estático en móvil */
  .sn-filter-dropdown-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    margin-top: 4px;
    border-radius: 0 0 var(--sn-radius-sm) var(--sn-radius-sm);
    transform: none !important;
    display: none;
  }

  .sn-filter-dropdown-menu.active {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: none !important;
  }
}

/* ──────────────────────────────────────────────
   10. LABEL OPCIONAL
   ────────────────────────────────────────────── */
.menu-simuladores-label {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-right: 8px;
}

/* ──────────────────────────────────────────────
   11. ANIMACIÓN
   ────────────────────────────────────────────── */
@keyframes snSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Drawer de simuladores en simulador.php */
.ntr-drawer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.ntr-drawer.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.ntr-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 14, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ntr-drawer__panel {
  position: relative;
  width: min(100%, 760px);
  max-height: min(82vh, 720px);
  margin: 0;
  border-radius: 24px 24px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 0;
  background: linear-gradient(180deg, rgba(13, 17, 26, 0.98), rgba(9, 12, 19, 0.98));
  box-shadow: 0 -20px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transform: translateY(24px);
  transition: transform 0.24s ease;
}

.ntr-drawer.is-open .ntr-drawer__panel {
  transform: translateY(0);
}

.ntr-drawer__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  z-index: 2;
}

.ntr-drawer__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ntr-drawer__content {
  padding: 18px;
  overflow-y: auto;
  max-height: inherit;
}

#simuladores-drawer .menu-simuladores-nav {
  width: 100%;
  margin: 0;
  border-radius: 24px;
}

@media (max-width: 767px) {
  .ntr-drawer__panel {
    width: 100%;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
  }

  .ntr-drawer__content {
    padding: 16px 14px 18px;
  }
}
