/*
 * Copyright (c) Biovisuals Private Limited. All rights reserved.
 *
 * Portalled slide action menu (Responsive Studio — Packet C polish, Part 4).
 *
 * Rendered into document.body by utils/slideMenuPortal.js, so it is NOT subject
 * to the slide panel's `overflow-y: auto` clip. `position: fixed` plus a
 * top-level z-index puts it above the slide panel, the canvas, the Fabric
 * wrapper and the floating canvas controls.
 *
 * Stacking reference (existing surfaces this must beat):
 *   .slider-container        10
 *   #right-panel             ~30
 *   .bv-panbar               999
 *   .floating-zoom           1000
 *   #openCallPanelBtn        9999
 */

.bv-slide-menu {
  position: fixed;
  /* Above the support button (9999), which is the highest existing surface. */
  z-index: 10050;
  width: 196px; /* within the required 180-210px range */
  box-sizing: border-box;
  padding: 5px;
  background: #ffffff;
  border: 1px solid rgba(16, 24, 40, 0.09);
  border-radius: 10px;
  box-shadow:
    0 10px 24px rgba(16, 24, 40, 0.14),
    0 2px 6px rgba(16, 24, 40, 0.08);
  font-family: Inter, Arial, sans-serif;
  /* Positioned imperatively from the trigger rect; never animate geometry. */
  transition: none;
}

/* ------------------ RENAME HEADER ------------------ */
/* Compact header above a subtle divider: the complete current slide title plus a
   pencil affordance. Activating it swaps this block for an inline input. */
.bv-slide-menu-header {
  padding: 1px;
}

.bv-slide-menu-rename {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  min-height: 32px;
  padding: 0 9px;
  background: none;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  color: #1f2429;
  cursor: text;   /* it becomes a text field, so signal that */
  transition: background-color 0.12s ease;
}

.bv-slide-menu-rename:hover,
.bv-slide-menu-rename:focus-visible {
  background: #f4f5f7;
  outline: none;
}

.bv-slide-menu-rename:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.16);
}

/* One line, truncated if exceptionally long. The COMPLETE title is always
   available through the button's aria-label and title attribute. */
.bv-slide-menu-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* "Add slide title" reads as a prompt, not as a real title. */
.bv-slide-menu-title.is-placeholder {
  color: #8a9099;
  font-weight: 500;
}

.bv-slide-menu-rename > i {
  flex: 0 0 auto;
  /* An explicit box so the pencil is a stable hit target even before the icon
     font has loaded (without this it collapses to zero height, because the glyph
     comes from Font Awesome's ::before content). */
  width: 12px;
  min-height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  color: #8a9099;
  transition: color 0.12s ease;
}

.bv-slide-menu-rename:hover > i,
.bv-slide-menu-rename:focus-visible > i {
  color: #4b5158;
}

/* Inline editor. Sized to match the header it replaces so the menu does not
   change height when editing starts. */
.bv-slide-menu-rename-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 32px;
  padding: 0 8px;
  background: #ffffff;
  border: 1px solid var(--bv-thumb-accent, #ffb803);
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(255, 184, 3, 0.16);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  color: #1f2429;
  outline: none;
}

.bv-slide-menu-rename-input::placeholder {
  color: #a2a8b0;
  font-weight: 500;
}

/* Subtle separator between the header and the actions. */
.bv-slide-menu-divider {
  height: 1px;
  margin: 4px 5px;
  background: rgba(16, 24, 40, 0.08);
}

.bv-slide-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  /* Comfortable row height for pointer and touch. */
  min-height: 34px;
  padding: 0 10px;
  background: none;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  color: #2f3439;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.bv-slide-menu-item > i {
  flex: 0 0 auto;
  width: 14px;
  font-size: 12px;
  text-align: center;
  color: #7b828a;
  transition: color 0.12s ease;
}

.bv-slide-menu-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Keyboard shortcut hint, right-aligned and clearly subordinate to the label. */
.bv-slide-menu-hint {
  flex: 0 0 auto;
  margin-left: 8px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #9aa0a8;
}

.bv-slide-menu-item--danger .bv-slide-menu-hint {
  color: #c98d86;
}

/* Duplicate stays neutral. */
.bv-slide-menu-item--neutral:hover,
.bv-slide-menu-item--neutral:focus-visible {
  background: #f4f5f7;
  outline: none;
}

/* Delete gets restrained destructive styling — red text/icon on a soft tint,
   not a saturated red block. */
.bv-slide-menu-item--danger {
  color: #b42318;
}

.bv-slide-menu-item--danger > i {
  color: #d0473b;
}

.bv-slide-menu-item--danger:hover,
.bv-slide-menu-item--danger:focus-visible {
  background: #fef3f2;
  color: #912018;
  outline: none;
}

.bv-slide-menu-item--danger:hover > i,
.bv-slide-menu-item--danger:focus-visible > i {
  color: #b42318;
}

.bv-slide-menu-item:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.16);
}

@media (prefers-reduced-motion: reduce) {
  .bv-slide-menu-item,
  .bv-slide-menu-item > i {
    transition: none;
  }
}
