/* panel-ayudas.css: the helpers on top of every tab: the save-failure toast,
   the invite list, keyboard focus, the skip link, the ⓘ bubbles, the phone
   bar's buttons, the notices in place of alert() and "Cargando tu panel".
   Loaded right after the file before it; the order of every panel file is in
   panel-login.css. */

/* Auto-save failure notice: non-blocking toast in the dashboard corner */
.save-error-notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  max-width: min(420px, calc(100vw - 48px));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(24, 10, 12, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--panel-gris-claro);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.3s ease;
}

.save-error-notice.hidden {
  display: none !important;
}

.save-error-notice-close {
  background: transparent;
  border: none;
  color: var(--panel-gris);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.save-error-notice-close:hover,
.save-error-notice-close:focus-visible {
  color: var(--panel-gris-claro);
}

/* Invites Badges and List */
.invite-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.invite-badge.status-available {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.invite-badge.status-used {
  background: rgba(100, 116, 139, 0.12);
  color: var(--panel-gris);
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.invite-row:hover {
  background: rgba(255, 255, 255, 0.01);
}

.invites-list-wrapper table th {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

.invites-list-wrapper table td {
  padding: 12px 16px;
}

.menu-item:focus-visible,
.switch-toggle:focus-within {
  outline: 2px solid var(--accent-color, #e11d48);
  outline-offset: 2px;
  border-radius: 6px;
}

/* The dashboard fields remove their outline on :focus (a border color change
   is all that is left), which hid the keyboard focus. Same specificity, later
   in the file, so these win for keyboard focus only. */
.input-field input:focus-visible,
.settings-group input[type]:focus-visible,
.settings-group select:focus-visible,
.settings-group textarea:focus-visible,
.slider-item input[type="range"]:focus-visible {
  outline: 2px solid var(--accent-color, #e11d48);
  outline-offset: 2px;
}

/* iOS Safari zooms the page when a field under 16px gets focus. */

@media (pointer: coarse) {
  body .input-field input,
  body .settings-group input[type="text"],
  body .settings-group input[type="email"],
  body .settings-group input[type="password"],
  body .settings-group input[type="url"],
  body .settings-group select,
  body .settings-group textarea,
  body .sidebar-search input,
  body .badges-filter,
  body .badges-style-field .badges-filter {
    font-size: 16px;
  }
}

/* Skip link: oculto hasta recibir foco por teclado */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--accent-color, #e11d48);
  color: #ffffff;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Dashboard: an "ⓘ" that explains, in a bubble on hover or focus, why
   something may not show (reduced motion, a setting it needs...). */
.info-tip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.info-tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fbbf24;
  cursor: help;
}

.info-tip-btn svg {
  width: 16px;
  height: 16px;
}

.info-tip-btn:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 1px;
}

.info-tip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 50;
  width: max-content;
  max-width: min(260px, 70vw);
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: #16130b;
  color: #fde68a;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  /* Hidden bubbles take no room at all: a hidden but laid-out bubble near the
     right edge made the whole dashboard scroll sideways. */
  display: none;
  transform: translate(-50%, 0);
  pointer-events: none;
}

.info-tip:hover .info-tip-text,
.info-tip:focus-within .info-tip-text {
  display: block;
  animation: infoTipIn 0.15s ease;
}

/* Next to a label at the start of a row: the bubble opens to the right. */
.info-tip.tip-start .info-tip-text {
  left: -8px;
  transform: none;
}

/* public/info-tip.js slides a bubble back inside the screen, and opens it
   below its button when there is no room above (the first ⓘ of a tab sits
   right under the header, which would cut it). */
.info-tip.tip-below .info-tip-text {
  top: calc(100% + 8px);
  bottom: auto;
}

@media (prefers-reduced-motion: reduce) {
  .info-tip:hover .info-tip-text,
  .info-tip:focus-within .info-tip-text { animation: none; }
}

/* Phone-only buttons of the bottom bar (public/barra-movil.js). */

@media (min-width: 769px) {
  .menu-item.mobile-only {
    display: none;
  }
}

/* Notices in place of alert() (public/avisos.js). */
.toast-region {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

/* On phones the notices sit above the bottom bar, not on it. Here, after the
   rule above, so it wins (in panel-movil.css, loaded earlier, it lost). */
@media (max-width: 768px) {
  .toast-region {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--panel-gris-tenue);
  border-radius: 12px;
  background: #15171f;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
}

.toast-error {
  border-left-color: #ef4444;
}

.toast-success {
  border-left-color: #22c55e;
}

.toast-text {
  flex: 1;
  overflow-wrap: anywhere;
}

.toast-action {
  flex: none;
  padding: 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.14);
}

.toast-close {
  flex: none;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast.is-leaving { transition: none; }
}

/* "Cargando tu panel" (public/carga-panel.js): the logo and a ring while the
   session loads, centered over the background; .hidden removes it once a
   screen opens. The ring stays still under reduced motion. */
.panel-loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
}

.panel-loading-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.panel-loading-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: panel-loading-spin 0.9s linear infinite;
}

@keyframes panel-loading-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .panel-loading-spinner {
    animation: none;
  }
}

/* Administración → "Bot de Discord": a link that looks like a button. */
.admin-bot-link {
  text-decoration: none;
  align-self: flex-start;
}
