/* =====================================================================
   guide-certificates.css
   The medal on a guide card (#playdate-info .supervision-badge) and the
   popover it opens. The medal is public — a guest sees it whenever the
   guide has certificates, and clicking it shows what the guide uploaded.
   Replaces certificate.css + proofcertificate.css, which styled the old
   profile-level "Certified by:" chips.
   Loaded after custom-whats-included.css.
   ===================================================================== */

/* Mirrors the delete "×" in the opposite corner of the card. The card is
   already position:relative. */
#playdate-info .guide-cert-medal {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  background: var(--ft-coral-soft, #fff1f1);
  border: 1px solid var(--ft-border-2, rgba(15, 23, 42, 0.12));
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
#playdate-info .guide-cert-medal[hidden] { display: none !important; }
#playdate-info .guide-cert-medal:hover,
#playdate-info .guide-cert-medal:focus-visible,
#playdate-info .guide-cert-medal.is-open {
  transform: scale(1.08);
  border-color: var(--ft-coral, #ff5a5f);
  box-shadow: 0 0 0 3px var(--ft-coral-soft, #fff1f1);
}
#playdate-info .guide-cert-medal.is-busy {
  opacity: 0.5;
  pointer-events: none;              /* no double-uploads on a slow connection */
}

/* ------------------------------------------------------------- popover
   Anchored under the medal and floated above the card. The card is only
   200px wide, so the panel is allowed to overhang it rather than squeezing
   certificate names into a column too narrow to read. */
#playdate-info .guide-cert-panel {
  position: absolute;
  top: 36px;
  left: 6px;
  z-index: 20;
  width: 190px;
  padding: 10px;
  text-align: left;
  background: var(--ft-surface, #fff);
  border: 1px solid var(--ft-border, rgba(15, 23, 42, 0.08));
  border-radius: var(--ft-radius-sm, 10px);
  box-shadow: var(--ft-shadow-lg, 0 12px 32px rgba(15, 23, 42, 0.10));
  cursor: default;
}
#playdate-info .guide-cert-panel[hidden] { display: none !important; }

#playdate-info .guide-cert-panel__head {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ft-coral, #ff5a5f);
  margin-bottom: 6px;
}

#playdate-info .guide-cert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  max-height: 160px;                 /* a guide with ten certificates scrolls */
  overflow-y: auto;
}
#playdate-info .guide-cert-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* The certificate itself — a full-width button, because the whole row opening
   the scan is the main thing this panel is for. */
#playdate-info .guide-cert-open {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  padding: 5px 8px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ft-coral, #ff5a5f);
  background: var(--ft-coral-soft, #fff1f1);
  border: 1px solid var(--ft-coral, #ff5a5f);
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}
#playdate-info .guide-cert-open:hover {
  background: var(--ft-coral, #ff5a5f);
  color: #fff;
}
/* PDFs open in a tab rather than as an image — say so before the click. */
#playdate-info .guide-cert-open.is-pdf::after {
  content: " · PDF";
  font-size: 0.62rem;
  opacity: 0.75;
}

/* A certificate with no scan attached yet is real, but there's nothing to
   open — so it reads as a plain label rather than pretending to be a link. */
#playdate-info .guide-cert-open.has-no-file {
  color: var(--ft-muted, #6b7280);
  background: var(--ft-soft, #f7f9fc);
  border-color: var(--ft-border-2, rgba(15, 23, 42, 0.12));
  border-style: dashed;
  cursor: default;
}
#playdate-info .guide-cert-open.has-no-file:hover {
  background: var(--ft-soft, #f7f9fc);
  color: var(--ft-muted, #6b7280);
}

/* 📎 attach / 🔄 replace — owner only, sits between the label and the × */
#playdate-info .guide-cert-file {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0.65;
}
#playdate-info .guide-cert-file:hover { opacity: 1; }

#playdate-info .guide-cert-remove {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--ft-faint, #9ca3af);
  background: none;
  border: 0;
  cursor: pointer;
}
#playdate-info .guide-cert-remove:hover { color: var(--ft-coral, #ff5a5f); }

#playdate-info .guide-cert-empty {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ft-faint, #9ca3af);
}

/* ------------------------------------------------- step 1: name it
   Typed straight into the panel. This used to be a browser prompt(), which
   is unstyleable, can't validate as you type, and reads like an error. */
#playdate-info .guide-cert-new {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--ft-border, rgba(15, 23, 42, 0.08));
}
#playdate-info .guide-cert-input {
  width: 100%;
  padding: 6px 9px;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ft-ink, #1f2937);
  background: #fff;
  border: 1px solid var(--ft-border-2, rgba(15, 23, 42, 0.12));
  border-radius: 8px;
}
#playdate-info .guide-cert-input:focus {
  outline: none;
  border-color: var(--ft-coral, #ff5a5f);
  box-shadow: 0 0 0 3px rgba(255, 90, 95, 0.15);
}
#playdate-info .guide-cert-new__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
#playdate-info .guide-cert-save {
  padding: 5px 14px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--ft-coral, #ff5a5f);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
#playdate-info .guide-cert-save:hover { background: var(--ft-coral-dark, #e14e50); }
#playdate-info .guide-cert-cancel {
  padding: 5px 4px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ft-muted, #6b7280);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

#playdate-info .guide-cert-add {
  width: 100%;
  margin-top: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ft-muted, #6b7280);
  background: #fff;
  border: 1px dashed var(--ft-border-2, rgba(15, 23, 42, 0.12));
  border-radius: 999px;
  cursor: pointer;
}
#playdate-info .guide-cert-add:hover {
  color: var(--ft-coral, #ff5a5f);
  border-color: var(--ft-coral, #ff5a5f);
}

@media (prefers-reduced-motion: reduce) {
  #playdate-info .guide-cert-medal,
  #playdate-info .guide-cert-open { transition: none; }
  #playdate-info .guide-cert-medal:hover,
  #playdate-info .guide-cert-medal.is-open { transform: none; }
}