/*!
 * bug-report.css
 * Floating bug-report FAB + modal. Tokens from rankedin_prototype.css :root.
 * Markup: tema/rankedin_new/partials/bug-report-widget.tpl
 */

/* ── FAB ── */
.bug-report-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1400;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}
.bug-report-fab-icon { position: relative; z-index: 1; }
.bug-report-fab:hover,
.bug-report-fab:focus-visible {
  transform: translateY(-3px) scale(1.06);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 12px 28px var(--teal-glow-lg);
  outline: none;
}
.bug-report-fab:active { transform: translateY(-1px) scale(0.98); }

/* soft pulse ring, purely decorative — remove/hide via JS once user interacted */
.bug-report-fab-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 var(--teal-glow-lg);
  animation: bugReportPulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes bugReportPulse {
  0%   { box-shadow: 0 0 0 0 var(--teal-glow-lg); opacity: 1; }
  70%  { box-shadow: 0 0 0 14px transparent; opacity: 0; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 0; }
}

/* Keep FAB clear of a potential bottom tab bar (none exists in main.tpl today,
   but this guards future mobile bottom nav without a code change there). */
@media (max-width: 640px) {
  .bug-report-fab { right: 16px; bottom: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 52px; height: 52px; }
}
body:has(.mobile-tabbar) .bug-report-fab,
body:has(.bottom-nav) .bug-report-fab {
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* ── Modal ── */
/* Разметка и открытие — как у «Ввести результаты» (results-modal-backdrop):
   .modal-overlay.d-none + глобальные openBugModal/closeBugModal
   (classList d-none + body.modal-open). Никаких !important. */

/* bootstrap4 CDN на турнирных страницах (.modal { display:none }) прячет
   внутренний контейнер — перебиваем, как #results-modal-backdrop
   в theme-extension.css:4216. */
html body #bug-report-modal.modal-overlay .modal {
  display: block !important;
  margin: auto !important;
  overflow: hidden !important;
  overflow-y: hidden !important;
  max-height: 95vh !important;
  height: auto !important;
}

/* ── Screenshot preview ── */
.bug-report-preview-wrap {
  position: relative;
  margin-bottom: 18px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: var(--surface-hover);
}
.bug-report-preview-skeleton {
  height: 160px;
  width: 100%;
  border-radius: 0;
}
.bug-report-preview {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: var(--surface-hover);
}
.bug-report-retake {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  color: var(--text);
  background: var(--surface-glass);
  backdrop-filter: blur(6px);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.bug-report-retake:hover { border-color: var(--teal); color: var(--teal); }

/* ── Description field ── */
.bug-report-field { position: relative; }
.bug-report-textarea { min-height: 110px; }
.bug-report-counter {
  position: absolute;
  right: 4px;
  bottom: -18px;
  font-size: 11px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.bug-report-counter.is-near-limit { color: var(--warn-text); }
.bug-report-counter.is-at-limit { color: var(--danger-text); font-weight: 700; }

/* ── Status area ── */
.bug-report-status {
  margin-top: 22px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-sm);
  padding: 0;
  min-height: 0;
  overflow: hidden;
  transition: all var(--transition);
}
.bug-report-status:empty { display: none; }
.bug-report-status.is-success { padding: 10px 14px; background: var(--good-bg); color: var(--good-text); }
.bug-report-status.is-error   { padding: 10px 14px; background: var(--danger-bg); color: var(--danger-text); }
.bug-report-status.is-info    { padding: 10px 14px; background: var(--info-bg); color: var(--info-text); }

/* ── Submit button states ── */
.bug-report-submit { position: relative; min-width: 128px; }
.bug-report-submit-spinner,
.bug-report-submit-check { display: none; }

.bug-report-submit.is-loading { cursor: wait; opacity: 0.85; pointer-events: none; }
.bug-report-submit.is-loading .bug-report-submit-label { visibility: hidden; }
.bug-report-submit.is-loading .bug-report-submit-spinner {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-color: rgba(255,255,255,0.35);
  border-top-color: #fff;
}

.bug-report-submit.is-success {
  background: var(--good-text, #16a34a);
  border-color: var(--good-text, #16a34a);
  pointer-events: none;
}
.bug-report-submit.is-success .bug-report-submit-label { visibility: hidden; }
.bug-report-submit.is-success .bug-report-submit-check {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
}

.bug-report-submit.is-error {
  background: var(--danger-text);
  border-color: var(--danger-text);
}

@media (max-width: 480px) {
  #bug-report-modal .modal--sm { border-bottom-left-radius: 0; border-bottom-right-radius: 0; max-height: 90vh; }
}
