/* ============================================================================
   CEPHOS REPORT — Menu de Contexto Inteligente (Padrão Visual Cephos Nexus)
   ============================================================================ */

.cf-context-menu {
  position: fixed;
  z-index: 95000;
  zoom: var(--cf-ui-zoom, 1);
  background: var(--cf-bg-surface-elevated, rgba(9, 15, 28, 0.96));
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  border: 1px solid var(--cf-border-strong, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  padding: 6px;
  min-width: 285px;
  max-width: 375px;
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: cfCtxFadeIn 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top left;
  -webkit-user-select: none;
  user-select: none;
  font-family: var(--cf-font-sans, 'Inter', 'Segoe UI', sans-serif);
}

.cf-context-menu.visible {
  display: flex;
}

@keyframes cfCtxFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.cf-ctx-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--cf-text-accent, #38bdf8);
  text-transform: uppercase;
  letter-spacing: 0.85px;
  padding: 6px 10px 6px 8px;
  border-bottom: 1px solid var(--cf-border-subtle, rgba(255, 255, 255, 0.08));
  margin-bottom: 3px;
  opacity: 0.95;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cf-ctx-header-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cf-primary, #0ea5e9);
  box-shadow: 0 0 8px var(--cf-primary, #0ea5e9);
  flex-shrink: 0;
}

.cf-ctx-header-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cf-ctx-item {
  padding: 5px 9px;
  display: flex;
  align-items: center;
  color: var(--cf-text-primary, #f1f5f9);
  font-size: 12px;
  font-weight: 450;
  cursor: pointer;
  border-radius: 7px;
  position: relative;
  transition: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  min-height: 29px;
  box-sizing: border-box;
  background: transparent;
  text-align: left;
  width: 100%;
}

.cf-ctx-item:hover {
  background: var(--cf-bg-hover, rgba(56, 189, 248, 0.12));
  border-color: var(--cf-border-active, rgba(56, 189, 248, 0.28));
  color: var(--cf-text-primary, #ffffff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cf-ctx-item.danger:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.cf-ctx-item.danger:hover .cf-ctx-icon {
  color: #ef4444;
}

.cf-ctx-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.cf-ctx-item.active {
  color: var(--cf-text-accent, #38bdf8);
  font-weight: 600;
  background: var(--cf-bg-active, rgba(56, 189, 248, 0.14));
  border-color: var(--cf-border-active, rgba(56, 189, 248, 0.25));
}

.cf-ctx-icon {
  width: 20px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--cf-text-muted, #94a3b8);
  transition: color 0.12s ease, transform 0.12s ease;
}

.cf-ctx-item:hover .cf-ctx-icon,
.cf-ctx-item.active .cf-ctx-icon {
  color: var(--cf-primary, #0ea5e9);
}

.cf-ctx-label {
  flex: 1;
  margin-left: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  letter-spacing: 0.1px;
}

.cf-ctx-shortcut {
  margin-left: 10px;
  font-size: 10px;
  font-weight: 600;
  color: var(--cf-text-muted, #94a3b8);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--cf-border-subtle, rgba(255, 255, 255, 0.08));
  letter-spacing: 0.4px;
  font-family: var(--cf-font-mono, monospace);
  flex-shrink: 0;
}

.cf-ctx-item:hover .cf-ctx-shortcut {
  color: var(--cf-text-primary, #ffffff);
  background: rgba(255, 255, 255, 0.12);
}

.cf-ctx-arrow {
  margin-left: auto;
  font-size: 10px;
  color: var(--cf-text-muted, #94a3b8);
  opacity: 0.7;
  padding-left: 8px;
  transition: transform 0.15s ease, color 0.15s ease;
}

.cf-ctx-parent:hover > .cf-ctx-arrow {
  opacity: 1;
  color: var(--cf-primary, #0ea5e9);
  transform: translateX(2px);
}

.cf-ctx-submenu {
  display: none;
  position: absolute;
  left: calc(100% - 2px);
  top: -5px;
  background: var(--cf-bg-surface-elevated, rgba(9, 15, 28, 0.97));
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  border: 1px solid var(--cf-border-strong, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  padding: 6px;
  min-width: 260px;
  max-width: 430px;
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  flex-direction: column;
  gap: 2px;
  z-index: 95001;
  animation: cfCtxFadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Ponte invisível anti-perda de hover ao mover o cursor na diagonal para o submenu */
.cf-ctx-submenu::before {
  content: '';
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -14px;
  right: -14px;
  z-index: -1;
}

.cf-ctx-parent:hover > .cf-ctx-submenu {
  display: flex;
}

.cf-context-menu.open-left .cf-ctx-submenu,
.cf-ctx-submenu.open-left {
  left: auto;
  right: calc(100% - 2px);
}

.cf-ctx-submenu.open-up {
  top: auto;
  bottom: -5px;
}

.cf-ctx-divider {
  height: 1px;
  background: var(--cf-border-subtle, rgba(255, 255, 255, 0.08));
  margin: 4px 6px;
}

.cf-ctx-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
}

/* Efeito de pulso quando o menu de contexto navega até um parágrafo A4 ou campo */
@keyframes cfTargetPulse {
  0% {
    box-shadow: 0 0 0 0 var(--cf-primary, #0ea5e9);
    background-color: rgba(14, 165, 233, 0.18);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(14, 165, 233, 0);
    background-color: rgba(14, 165, 233, 0.08);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0);
    background-color: transparent;
  }
}

.cf-ctx-pulse-highlight {
  animation: cfTargetPulse 1.3s ease-out;
  border-radius: 6px;
}
