/*
 * BDR · Estilos compartidos para autenticación, reporte de bug y elementos
 * agregados al header (botón bug, badge de usuario, botón cerrar sesión,
 * enlace Admin). Mantiene la misma identidad visual que `index3.css` y
 * delega el aspecto base de los modales a `styles.css` / `index3.css` para
 * que las ventanas nuevas se vean exactamente igual que las existentes
 * (snippet, save, exportar BD, crear BD).
 */

/* ----------------------------------------------------------
 * Botón de bug en el header
 * ---------------------------------------------------------- */
.icon-button.bug-toggle {
  position: relative;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.design-index3 .icon-button.bug-toggle {
  width: 30px;
  height: 30px;
}

.bug-mark {
  display: inline-block;
  width: 19px;
  height: 19px;
  /* En modo claro el icono se renderiza en negro, igual que el resto de
     iconos de header en design-index3. */
  background-color: #07110e;
  -webkit-mask: url("../media/alerta.svg") center / contain no-repeat;
          mask: url("../media/alerta.svg") center / contain no-repeat;
  transition: transform 140ms ease, background-color 140ms ease;
}

.icon-button.bug-toggle:hover .bug-mark {
  transform: scale(1.05);
  background-color: var(--red, #f25757);
}

/* En modo oscuro mantiene el tono cálido que ya usa design-index3 para los
   acentos del header. */
body.theme-dark .bug-mark,
body.design-index3.theme-dark .bug-mark {
  background-color: var(--header-strong, #c98d98);
}

body.theme-dark .icon-button.bug-toggle:hover .bug-mark,
body.design-index3.theme-dark .icon-button.bug-toggle:hover .bug-mark {
  background-color: var(--red, #ff6b6b);
}

/* ----------------------------------------------------------
 * Botón cerrar sesión y badge de usuario
 * ---------------------------------------------------------- */
.session-button.logout {
  background: var(--red, #f45757);
  color: #ffffff;
}

body.design-index3 .session-button.logout {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 21px;
  font-size: 13px;
  box-shadow: none;
}

.session-user-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  height: 34px;
  border-radius: 999px;
  background: var(--surface-2, #edf1ef);
  color: var(--text, #17201c);
  font-size: 12px;
  font-weight: 700;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line, #d8dfda);
}

/* Mensaje invitando a iniciar sesión cuando el usuario está en modo
   invitado o sin sesión. Aparece a la izquierda del botón "Iniciar
   sesión". En pantallas estrechas se oculta para no apretar el header. */
.session-guest-hint {
  font-size: 12px;
  color: #ffffff;
  font-style: italic;
  white-space: nowrap;
  margin-right: 4px;
  animation: hint-pulse 2s infinite ease-in-out;
}

@keyframes hint-pulse {
  0%, 100% { color: #ffffff; opacity: 1; }
  50% { color: #cccccc; opacity: 0.9; }
}

@media (max-width: 900px) {
  .session-guest-hint { display: none; }
}

body.theme-dark .session-guest-hint,
body.design-index3.theme-dark .session-guest-hint {
  color: #ffffff;
}

body.theme-dark .session-user-badge,
body.design-index3.theme-dark .session-user-badge {
  background: var(--surface-2, #222c29);
  border-color: var(--line, #34423f);
}

/* ----------------------------------------------------------
 * Enlace Admin (solo visible cuando rol=admin)
 * ---------------------------------------------------------- */
.module-link[data-module="admin"] {
  color: var(--header-strong, #d97957);
}

body.theme-dark .module-link[data-module="admin"],
body.design-index3.theme-dark .module-link[data-module="admin"] {
  color: var(--header-strong, #ff9d74);
}

/* ----------------------------------------------------------
 * Auth modal (login/registro) y bug modal
 *
 * IMPORTANTE: el aspecto base de la ventana, el header, los botones del
 * footer y el botón de cerrar (cerrar.svg) ya están definidos en
 * `styles.css` y `index3.css` para todos los modales con la clase
 * `.modal`. Aquí solo añadimos lo que es propio de los modales nuevos
 * (feedback, miniaturas de captura, hint de registro). NO se redefine el
 * fondo de `.modal-header` ni el de `.modal-actions` ni se dibuja un
 * icono de cerrar adicional, para no duplicar/sobreescribir el visual
 * existente.
 * ---------------------------------------------------------- */
.auth-modal,
.bug-modal {
  width: min(520px, 100%);
}

.auth-form .auth-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #62706a);
}

.auth-feedback {
  margin: 0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface-2, #edf1ef);
  border: 1px solid var(--line, #d8dfda);
}

.auth-feedback.is-error {
  background: rgba(244, 87, 87, 0.12);
  border-color: rgba(244, 87, 87, 0.5);
  color: var(--red, #f25757);
}

.auth-feedback.is-ok {
  background: rgba(0, 187, 66, 0.10);
  border-color: rgba(0, 187, 66, 0.45);
  color: var(--green, #00bb42);
}

.auth-reset-button {
  margin-right: auto;
  background: color-mix(in srgb, var(--red, #f25757) 88%, #ffffff);
  color: #ffffff;
  border-color: color-mix(in srgb, var(--red, #f25757) 72%, #17201c);
}

.auth-reset-button:hover {
  background: var(--red, #f25757);
}

.auth-session-reload-backdrop {
  z-index: 5000;
}

.auth-session-reload-modal {
  max-width: 460px;
}

.auth-session-reload-text {
  margin: 0;
  line-height: 1.55;
  color: var(--text, #17201c);
}

body.theme-dark .auth-session-reload-text,
body.design-index3.theme-dark .auth-session-reload-text {
  color: var(--text, #f4f7f5);
}

/* ----------------------------------------------------------
 * Bug report: miniaturas de capturas
 * ---------------------------------------------------------- */
.bug-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bug-thumb {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line, #d8dfda);
  background: var(--surface-2, #edf1ef);
}

.bug-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bug-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 0;
  background: rgba(17, 24, 23, 0.65);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.bug-thumb-remove:hover {
  background: rgba(244, 87, 87, 0.9);
}


/* ----------------------------------------------------------
 * Modal de fusión invitado → cuenta real
 * ---------------------------------------------------------- */
.auth-merge-modal {
  max-width: 540px;
}

.auth-merge-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-merge-intro {
  margin: 0;
  line-height: 1.5;
}

.auth-merge-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--card-border, rgba(0, 0, 0, 0.12));
  border-radius: 8px;
  background: var(--surface-2, rgba(0, 0, 0, 0.03));
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-merge-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95em;
}

.auth-merge-icon {
  display: none;
}

.auth-merge-tipo {
  font-weight: 600;
  opacity: 0.75;
  min-width: 70px;
}

.auth-merge-name {
  font-weight: 500;
}

.auth-merge-empty {
  font-style: italic;
  opacity: 0.75;
}

.auth-merge-actions {
  flex-wrap: wrap;
  gap: 8px;
}

body.dark-theme .auth-merge-list {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}
