/* acceso-equipo.css — "Acceso equipo" de la cabecera pública: icono / menú de usuario y ventana de acceso.
   Marcado en includes/acceso_equipo.php; comportamiento en assets/js/acceso-equipo.js. */

/* ---------- Cabecera: icono discreto (sin sesión) o menú de usuario (con sesión) ---------- */
/* Dónde va el icono según el ancho (el <template> queda entre el icono y el hamburguesa, por eso "~" y no "+"):
     ≥1200 px   en línea, al final del menú
     901–1199   esquina superior derecha: a estos anchos el menú original ya no cabe (el antiguo "Login" quedaba fuera)
     ≤900       2.9c: una sola fila, logo | usuario | ☰, los dos botones de 44 px (antes, a ≤440 px el icono iba encima del ☰) */
.catalogo-header .acceso-equipo { order: 3; flex: 0 0 auto; margin-left: 14px; position: relative; }
.catalogo-header .acceso-equipo ~ nav { margin-left: auto; }
@media (min-width: 901px) and (max-width: 1199.98px) {
  .catalogo-header .acceso-equipo { position: absolute; top: 8px; right: 12px; margin: 0; }
  .catalogo-header .acceso-equipo ~ nav { margin-left: 0; }
}

.acceso-equipo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 36px; padding: 0 8px; box-sizing: border-box;
  border-radius: 999px; color: #8a8a8a; background: transparent; text-decoration: none; cursor: pointer;
  transition: color .15s, background-color .15s;
}
.acceso-equipo-btn:hover, .acceso-equipo-btn:focus-visible { color: #f7921e; background: rgba(247, 146, 30, .09); }
.acceso-equipo-btn:focus-visible { outline: 3px solid #1F8A85; outline-offset: 2px; }
.acceso-equipo-svg { display: block; flex: 0 0 auto; }

.acceso-menu > summary { list-style: none; }
.acceso-menu > summary::-webkit-details-marker { display: none; }
.acceso-menu[open] > summary { color: #f7921e; }
.acceso-menu-nombre {
  max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .9rem; font-weight: 600; color: #5E534B;
}
.acceso-menu-lista {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 1100;
  display: flex; flex-direction: column; min-width: 210px; padding: 6px;
  background: #fff; border-radius: 14px; box-shadow: 0 12px 32px rgba(30, 26, 24, .18);
}
.acceso-menu-usuario {
  padding: 8px 12px 10px; margin-bottom: 4px; border-bottom: 1px solid #f1e8dc;
  font-size: .85rem; color: #5E534B; overflow-wrap: anywhere;
}
.acceso-menu-usuario strong { color: #1E1A18; }
.acceso-menu-lista a {
  padding: 10px 12px; border-radius: 10px; color: #1E1A18; text-decoration: none; font-weight: 600; font-size: .95rem;
}
.acceso-menu-lista a:hover, .acceso-menu-lista a:focus-visible { background: #FFF8EE; outline: none; box-shadow: inset 0 0 0 2px #1F8A85; }

@media (max-width: 900px) {
  /* 2.9c: cabecera del móvil en una fila. El logo se ajusta al ancho (cabe a 320 px); a la derecha, el usuario y el ☰ alineados y del mismo
     tamaño (zona táctil de 44 px), sin el borde gris ni la sombra del ☰. Con sesión, el icono abre el mismo menú que en escritorio. */
  .catalogo-header { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; padding: 10px 8px 10px 14px; }
  .catalogo-header .logo-container { flex: 1 1 auto; min-width: 0; }
  .catalogo-header .logo { font-size: clamp(1.3rem, 6.8vw, 2.1rem) !important; line-height: 1.05; letter-spacing: -1px; white-space: nowrap; margin: 0; padding: 0; }
  .catalogo-header .logo-container .logo-sub { font-size: clamp(.6rem, 2.85vw, .95rem); letter-spacing: .5px; margin: 2px 0 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .catalogo-header .acceso-equipo { order: 2; position: relative; flex: none; margin: 0 0 0 auto; }
  .catalogo-header .acceso-equipo-btn { width: 44px; min-width: 44px; height: 44px; padding: 0; border-radius: 12px; }
  .catalogo-header .acceso-equipo-svg { width: 22px; height: 22px; }
  .acceso-menu-nombre { display: none; }
  .catalogo-header .menu-toggle, .catalogo-header .acceso-equipo ~ .menu-toggle {
    order: 3; flex: none; display: flex !important; flex-direction: column; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 12px; background: transparent; box-shadow: none; cursor: pointer;
  }
  .catalogo-header .menu-toggle span { display: block; width: 22px; height: 2.5px; margin: 2.5px 0; border-radius: 2px; background: #1E1A18; transition: transform .25s, opacity .2s; }
  .catalogo-header .menu-toggle:hover { background: rgba(247, 146, 30, .09); }
  .catalogo-header .menu-toggle:focus-visible { outline: 3px solid #1F8A85; outline-offset: 2px; }
  .catalogo-header .menu-toggle.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .catalogo-header .menu-toggle.active span:nth-child(2) { opacity: 0; }
  .catalogo-header .menu-toggle.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
  .catalogo-header .acceso-menu-lista { right: -52px; max-width: calc(100vw - 16px); }
}

/* ---------- Ventana de acceso ---------- */
html.ae-abierto { overflow: hidden; }

.ae-modal {
  /* Paleta a juego con la foto del banner */
  --crema: #FFF8EE;      /* fondo del formulario */
  --naranja: #F7921E;    /* botón principal y acentos */
  --naranja-sombra: #C96F0A;
  --turquesa: #1F8A85;   /* anillo de foco y casilla marcada */
  --turquesa-texto: #1C807B; /* enlaces: #1F8A85 sobre crema da 3,96:1; este tono da 4,5:1 (WCAG AA) */
  --rojo: #D62828;       /* errores y borde superior de la franja */
  --tinta: #1E1A18;      /* texto */
  --tinta-suave: #5E534B;/* texto secundario (7:1 sobre crema) */
  --borde: #E8DCCB;
  --boton-texto: var(--tinta); /* blanco sobre --naranja da 2,31:1 y no cumple AA; tinta da 7,47:1 */

  position: fixed; inset: 0; z-index: 10050;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; box-sizing: border-box; overflow-y: auto;
  background: rgba(20, 14, 10, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  color: var(--tinta); font-family: inherit; line-height: 1.4; text-align: left;
  opacity: 0; transition: opacity .2s ease;
}
.ae-modal[hidden] { display: none; }
.ae-modal.ae-visible { opacity: 1; }
.ae-modal *, .ae-modal *::before, .ae-modal *::after { box-sizing: border-box; }

.ae-caja {
  position: relative; width: 100%; max-width: 960px; margin: auto;
  background: var(--crema); border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(30, 26, 24, .35), 0 8px 24px rgba(30, 26, 24, .18);
  transform: translateY(14px) scale(.985); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.ae-visible .ae-caja { transform: none; }

/* Banner: foto o, si no carga, degradado naranja → rojo; siempre con el degradado oscuro bajo el texto */
.ae-banner {
  position: relative; height: 320px; overflow: hidden; border-radius: 20px 20px 0 0;
  background: linear-gradient(120deg, var(--naranja) 0%, var(--rojo) 100%);
}
.ae-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 40%;
  opacity: 0; transition: opacity .3s ease;
}
.ae-img.ae-cargada { opacity: 1; }
.ae-banner::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, .75) 0%, rgba(0, 0, 0, .55) 32%, rgba(0, 0, 0, 0) 68%);
}
/* Sin foto: degradado oscuro más suave (blanco sobre el naranja oscurecido sigue por encima de 4,5:1) */
.ae-sin-imagen::after { background: linear-gradient(to top, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .3) 35%, rgba(0, 0, 0, 0) 70%); }
.ae-banner-texto { position: absolute; left: 28px; right: 84px; bottom: 22px; z-index: 1; color: #fff; }
.ae-titulo {
  margin: 0; font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.ae-lema { margin: 4px 0 0; font-size: 1rem; color: rgba(255, 255, 255, .8); text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }

.ae-cerrar {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .72); color: var(--tinta);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .2); transition: background-color .15s;
}
.ae-cerrar:hover { background: rgba(255, 255, 255, .95); }
.ae-cerrar:focus-visible { outline: 3px solid var(--turquesa); outline-offset: 2px; }

/* Franja del formulario: crema con un patrón de puntos al 6 % y un filo rojo arriba */
.ae-franja { position: relative; padding: 22px 28px 20px; background-color: var(--crema); border-top: 3px solid var(--rojo); }
.ae-franja::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .06;
  background-image: radial-gradient(var(--tinta) 1.1px, transparent 1.4px); background-size: 14px 14px;
}
.ae-franja > * { position: relative; }

.ae-intro { margin: 0 0 14px; font-weight: 600; color: var(--tinta); }
.ae-error {
  margin: 0 0 14px; padding: 10px 14px; border: 2px solid var(--rojo); border-radius: 12px;
  background: #fff; color: var(--rojo); font-weight: 700;
}
.ae-error[hidden] { display: none; }

.ae-paso[hidden] { display: none !important; }
.ae-paso { animation: ae-entra-paso .24s ease both; }
@keyframes ae-entra-paso { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

.ae-fila { display: grid; gap: 10px 14px; align-items: end; }
.ae-fila-1 { grid-template-columns: 1fr 1fr auto; }
.ae-fila-1 .ae-recordar { grid-column: 1 / -1; }
.ae-fila-2 { grid-template-columns: minmax(200px, 280px) auto auto 1fr; }
.ae-fila-2 .ae-ayuda { grid-column: 1 / -1; }
.ae-fila-enrolar { grid-template-columns: 1fr auto auto; align-items: center; }

.ae-campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ae-label { font-size: .9rem; font-weight: 700; color: var(--tinta); }
.ae-input {
  width: 100%; height: 48px; margin: 0; padding: 0 14px;
  border: 2px solid var(--borde); border-radius: 14px; background: #fff; color: var(--tinta);
  font: inherit; font-size: 1rem; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.ae-input:focus { box-shadow: 0 0 0 3px var(--turquesa); }
.ae-input[aria-invalid="true"] { border-color: var(--rojo); }
.ae-codigo { font-size: 1.3rem; font-weight: 700; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }

.ae-pass { position: relative; }
.ae-pass .ae-input { padding-right: 50px; }
.ae-ver {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--tinta-suave); cursor: pointer;
}
.ae-ver:hover { color: var(--tinta); }
.ae-ver:focus-visible { outline: 3px solid var(--turquesa); outline-offset: 0; }
.ae-ver .ae-ojo-cerrado { display: none; }
.ae-ver[aria-pressed="true"] .ae-ojo-abierto { display: none; }
.ae-ver[aria-pressed="true"] .ae-ojo-cerrado { display: block; }

/* Botón principal: píldora con sombra sólida que se "hunde" al pulsar */
.ae-enviar {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; margin: 0 0 4px; padding: 0 30px; border: 0; border-radius: 999px;
  background: var(--naranja); color: var(--boton-texto);
  font: inherit; font-size: 1rem; font-weight: 700; white-space: nowrap; text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 0 var(--naranja-sombra);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
}
.ae-enviar:hover { filter: brightness(1.04); }
.ae-enviar:active { transform: translateY(4px); box-shadow: 0 0 0 var(--naranja-sombra); }
.ae-enviar:focus-visible { outline: 3px solid var(--turquesa); outline-offset: 3px; }
.ae-enviar:disabled { cursor: progress; filter: saturate(.85); }
.ae-spinner {
  display: none; width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: ae-giro .7s linear infinite;
}
.ae-enviando .ae-spinner { display: inline-block; }
@keyframes ae-giro { to { transform: rotate(360deg); } }

.ae-volver {
  height: 48px; margin: 0 0 4px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--turquesa-texto); font: inherit; font-weight: 700; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; justify-self: start;
}
.ae-volver:focus-visible { outline: 3px solid var(--turquesa); }

.ae-recordar { display: inline-flex; align-items: center; gap: 8px; justify-self: start; font-size: .92rem; color: var(--tinta); cursor: pointer; }
.ae-recordar input { width: 18px; height: 18px; margin: 0; accent-color: var(--turquesa); cursor: pointer; }
.ae-recordar input:focus-visible { outline: 3px solid var(--turquesa); outline-offset: 2px; }
.ae-ayuda { margin: 0; font-size: .85rem; color: var(--tinta-suave); }
/* 2.11b: «Confiar en este dispositivo 30 días» (paso 2, encima del código) */
.ae-fila-2 .ae-confiar { grid-column: 1 / -1; align-items: flex-start; }
.ae-confiar input { margin-top: 1px; flex: none; }
.ae-confiar-ayuda { color: var(--tinta-suave); font-size: .85rem; }
.ae-enrolar-texto { margin: 0; font-weight: 600; }

.ae-pie {
  display: flex; flex-wrap: wrap; gap: 4px 28px; margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--borde); font-size: .88rem; color: var(--tinta-suave);
}
.ae-pie p { margin: 0; }
.ae-franja a:not(.ae-enviar) { color: var(--turquesa-texto); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.ae-franja a:not(.ae-enviar):focus-visible { outline: 3px solid var(--turquesa); outline-offset: 2px; border-radius: 4px; }

/* Móvil: banner de 150 px y formulario en vertical, a pantalla casi completa */
@media (max-width: 767.98px) {
  .ae-modal { padding: 8px; align-items: flex-start; }
  .ae-caja { display: flex; flex-direction: column; min-height: calc(100vh - 16px); min-height: calc(100dvh - 16px); border-radius: 18px; }
  .ae-banner { flex: 0 0 150px; height: 150px; border-radius: 18px 18px 0 0; }
  .ae-img { object-position: 50% 40%; }
  .ae-banner-texto { left: 18px; right: 64px; bottom: 14px; }
  .ae-titulo { font-size: 1.3rem; }
  .ae-lema { font-size: .88rem; }
  .ae-cerrar { top: 10px; right: 10px; }
  .ae-franja { flex: 1 1 auto; padding: 18px 18px 22px; }
  .ae-fila-1, .ae-fila-2, .ae-fila-enrolar { grid-template-columns: 1fr; align-items: stretch; gap: 12px; }
  .ae-fila-2 .ae-ayuda { grid-row: 3; } /* 2.11b: la fila 1 es «Confiar en este dispositivo» */
  .ae-enviar { width: 100%; }
  .ae-volver { justify-self: center; }
  .ae-pie { flex-direction: column; gap: 6px; }
  .ae-input { font-size: 16px; } /* evita el zoom automático de iOS */
  .ae-codigo { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ae-modal, .ae-caja, .ae-img, .ae-paso, .ae-enviar { transition: none !important; animation: none !important; }
  .ae-caja { transform: none; }
  .ae-spinner { animation: ae-giro 1.6s linear infinite !important; }
}

/* ---------- 2.11b: la misma caja como página completa (panel_control/acceso.php) ---------- */
html.ae-pagina-html { min-height: 100%; background: #2B211B; }
body.ae-pagina-body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 50% 0%, #5A3B26 0%, #2B211B 60%) #2B211B;
  font-family: 'Montserrat', Arial, Helvetica, sans-serif; -webkit-text-size-adjust: 100%; }
.ae-modal.ae-pagina { position: relative; inset: auto; z-index: auto; flex-direction: column; min-height: 100vh; min-height: 100dvh; opacity: 1; transition: none;
  background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.ae-pagina .ae-caja { transform: none; transition: none; }
.ae-pagina .ae-banner-texto { right: 28px; }
.ae-pagina-sinjs { max-width: 960px; margin: 0 auto 18px; padding: 12px 16px; border-radius: 12px; background: #FFF8EE; color: #1E1A18; font-weight: 600; }
.ae-pagina-sinjs a { color: #1C807B; }
@media (max-width: 767.98px) {
  .ae-pagina .ae-banner-texto { right: 18px; }
}
