/* ===========================================================================
   THE OPERATION: FOOTWORK BOSS CAMPAIGN - PHASE 2: THE INTERCEPT
   Priority Intrusion Modal, 5-Second Glitch Pre-Roll, & Boss Map Beacon
   =========================================================================== */

/* ── 1. GLITCH PRE-ROLL ANIMATIONS ─────────────────────────────────────── */
.glitch-active {
  animation: fw-glitch-shake 0.12s steps(2) infinite alternate !important;
  position: relative !important;
}

@keyframes fw-glitch-shake {
  0% { transform: translate(0, 0) skew(0deg); filter: contrast(100%); }
  20% { transform: translate(-3px, 2px) skew(-1deg); filter: contrast(140%) hue-rotate(20deg); }
  40% { transform: translate(3px, -2px) skew(1deg); filter: contrast(160%) brightness(120%); }
  60% { transform: translate(-2px, -3px) skew(0.5deg); filter: invert(8%); }
  80% { transform: translate(2px, 3px) skew(-0.5deg); filter: contrast(180%); }
  100% { transform: translate(0, 0) skew(0deg); filter: contrast(120%); }
}

.glitch-map-desaturate #leaflet-canvas,
.glitch-map-desaturate #map-viewport {
  filter: grayscale(90%) contrast(150%) brightness(85%) !important;
  transition: filter 0.8s ease-in-out;
}

/* Fullscreen Glitch Scanline & Interference Layer */
.fw-glitch-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.4) 0px,
    rgba(0, 0, 0, 0.4) 2px,
    rgba(255, 0, 55, 0.15) 3px,
    rgba(0, 240, 255, 0.15) 4px
  );
  animation: fw-scanline-roll 8s linear infinite;
  opacity: 0.85;
}

@keyframes fw-scanline-roll {
  0% { background-position: 0 0; }
  100% { background-position: 0 100vh; }
}

/* Glitch Banner Announcement during pre-roll */
.fw-glitch-banner {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99998;
  width: 90%;
  max-width: 480px;
  background: rgba(180, 0, 40, 0.95);
  border: 2px solid #ff0055;
  box-shadow: 0 0 30px rgba(255, 0, 85, 0.6), inset 0 0 20px rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 16px;
  text-align: center;
  font-family: 'Chakra Petch', sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: fw-banner-pulse 0.25s infinite alternate;
  pointer-events: none;
}

.fw-glitch-banner .banner-sub {
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  color: #ffc0d0;
  margin-top: 4px;
  letter-spacing: 1px;
}

@keyframes fw-banner-pulse {
  0% { opacity: 0.9; transform: translateX(-50%) scale(0.99); }
  100% { opacity: 1; transform: translateX(-50%) scale(1.01); }
}

/* ── 2. FULLSCREEN PRIORITY INTERCEPT MODAL ─────────────────────────────── */
.fw-intercept-modal-root {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 12, 0.96);
  backdrop-filter: blur(16px);
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  box-sizing: border-box;
}

.fw-intercept-modal-root.modal-visible {
  opacity: 1;
}

.fw-intercept-shell {
  width: 100%;
  max-width: 520px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: #080d16;
  border: 1px solid var(--faction-glow, #ff0055);
  box-shadow: 0 0 35px rgba(255, 0, 85, 0.25), inset 0 0 40px rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

/* Decorative CRT Corner Accents */
.fw-intercept-shell::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  z-index: 10;
}

/* Header: Insignia & Signal Status */
.fw-intercept-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(12, 18, 30, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

.fw-intercept-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--faction-glow, #ff0055);
}

.fw-intercept-tag .signal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faction-glow, #ff0055);
  animation: fw-dot-blink 0.8s ease-in-out infinite alternate;
}

@keyframes fw-dot-blink {
  0% { opacity: 0.3; transform: scale(0.85); box-shadow: none; }
  100% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 10px var(--faction-glow, #ff0055); }
}

.fw-intercept-timer-box {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.fw-intercept-timer-box .timer-digits {
  color: #ffb700;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Body: Portrait & Dialogue Section */
.fw-intercept-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  overflow-y: auto;
  position: relative;
}

/* Tactical Portrait Block */
.fw-portrait-card {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: 6px;
  overflow: hidden;
  background: #020509;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fw-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: contrast(110%) brightness(95%);
  transition: transform 0.4s ease;
}

/* Fallback Cyber Glyph for Bosses without local images yet */
.fw-portrait-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(20, 32, 50, 0.9), #050810);
  color: var(--faction-glow, #ff0055);
}

.fw-portrait-fallback .glyph-icon {
  font-size: 3.5rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 16px var(--faction-glow, #ff0055));
  animation: fw-glyph-breathe 2s ease-in-out infinite alternate;
}

@keyframes fw-glyph-breathe {
  0% { transform: scale(0.96); opacity: 0.85; }
  100% { transform: scale(1.04); opacity: 1; }
}

.fw-portrait-fallback .glyph-tier {
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 2px;
  color: #cbd5e1;
}

/* CRT Scanlines on the video frame */
.fw-portrait-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.3) 0px,
    rgba(0, 0, 0, 0.3) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 3;
}

/* Video HUD Overlay Brackets */
.fw-portrait-brackets {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border-top: 2px solid var(--faction-glow, #ff0055);
  border-bottom: 2px solid var(--faction-glow, #ff0055);
  z-index: 4;
}

.fw-portrait-badges {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}

.fw-threat-badge {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--faction-glow, #ff0055);
  padding: 2px 7px;
  border-radius: 3px;
  font-family: 'Space Mono', monospace;
  font-size: 0.62rem;
  color: var(--faction-glow, #ff0055);
  letter-spacing: 1px;
  font-weight: 700;
}

.fw-codec-badge {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px 7px;
  border-radius: 3px;
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: #94a3b8;
}

/* Transmission Dossier Details */
.fw-dossier-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fw-boss-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.fw-boss-name {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.fw-boss-role {
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  color: var(--faction-glow, #ff0055);
  letter-spacing: 0.08em;
  font-weight: 600;
}

.fw-arena-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
  width: fit-content;
}

/* Typewritten Dialogue Console */
.fw-dialogue-console {
  background: rgba(4, 7, 13, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 12px 14px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
}

.fw-dialogue-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #e2e8f0;
  letter-spacing: 0.03em;
  word-break: break-word;
}

.fw-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  vertical-align: sub;
  background: var(--faction-glow, #ff0055);
  animation: fw-cursor-blink 0.7s step-end infinite;
  margin-left: 3px;
}

@keyframes fw-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Modal Actions Footer */
.fw-intercept-footer {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(8, 12, 20, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.fw-btn-hangup {
  flex: 1;
  background: rgba(220, 20, 60, 0.15);
  border: 1px solid #ff1744;
  color: #ff5252;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 11px 12px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.fw-btn-hangup:hover,
.fw-btn-hangup:active {
  background: rgba(220, 20, 60, 0.35);
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 23, 68, 0.4);
}

.fw-btn-accept {
  flex: 1.6;
  background: var(--faction-glow, #ff0055);
  border: 1px solid #fff;
  color: #000;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 11px 14px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 0 18px var(--faction-glow, #ff0055);
  transition: all 0.18s ease;
}

.fw-btn-accept:hover,
.fw-btn-accept:active {
  filter: brightness(1.2);
  transform: translateY(-1px);
  box-shadow: 0 0 25px var(--faction-glow, #ff0055);
}

.fw-btn-acknowledge {
  flex: 1;
  background: #00ff9d;
  border: 1px solid #fff;
  color: #000;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 12px 14px;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 255, 157, 0.6);
  transition: all 0.18s ease;
}

/* ── 3. MAP BOSS NODE BEACON & ENGAGEMENT POPUP ─────────────────────────── */
.boss-node-beacon {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.boss-node-beacon .beacon-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid #ff0055;
  animation: fw-beacon-pulse 1.4s cubic-bezier(0.2, 0.8, 0.4, 1) infinite;
}

.boss-node-beacon .beacon-ring-2 {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 0, 85, 0.6);
  animation: fw-beacon-rotate 6s linear infinite;
}

@keyframes fw-beacon-pulse {
  0% { transform: scale(0.6); opacity: 1; box-shadow: 0 0 0 0 rgba(255, 0, 85, 0.8); }
  70% { transform: scale(1.3); opacity: 0.2; box-shadow: 0 0 18px 6px rgba(255, 0, 85, 0); }
  100% { transform: scale(1.5); opacity: 0; }
}

@keyframes fw-beacon-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.boss-node-beacon .beacon-core {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff0055 30%, #990022 100%);
  border: 2px solid #fff;
  box-shadow: 0 0 14px #ff0055;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  z-index: 2;
}

.boss-node-beacon .beacon-label {
  position: absolute;
  bottom: -22px;
  white-space: nowrap;
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(10, 14, 24, 0.92);
  border: 1px solid #ff0055;
  border-radius: 3px;
  padding: 1px 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Custom Tactical Leaflet Popup for Boss Node */
.leaflet-popup-content-wrapper.fw-boss-popup {
  background: rgba(6, 10, 18, 0.96) !important;
  border: 1px solid #ff0055 !important;
  box-shadow: 0 0 25px rgba(255, 0, 85, 0.4) !important;
  border-radius: 6px !important;
  color: #fff !important;
  padding: 0 !important;
}

.leaflet-popup-content-wrapper.fw-boss-popup .leaflet-popup-content {
  margin: 10px 12px !important;
  line-height: 1.3 !important;
}

.fw-popup-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 190px;
}

.fw-popup-header {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ff0055;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fw-popup-body {
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem;
  color: #cbd5e1;
}

.fw-popup-arena {
  color: #94a3b8;
  font-size: 0.62rem;
  margin-top: 2px;
}

.fw-popup-btn {
  background: #ff0055;
  border: 1px solid #fff;
  color: #fff;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  margin-top: 4px;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.5);
}

.fw-popup-btn:hover {
  background: #ff2d6b;
}
