/* NewsKFF v238-m90 — superadmin role mirror repair; alert CSS preserved. */
/* NewsKFF v238-m88 — compact alerts. Artwork is a quiet, blended background
   BETWEEN the physical-left open button and the right-side real news text. */
#kffFireEngineVisualAlert.kff-fire-alert-stage {
  --alert-accent: #ff4b5e;
  --alert-rgb: 255, 75, 94;
  --alert-text: #fff;
  --alert-muted: #e2e9f2;
  --alert-bg: rgba(24, 7, 19, .74);
  --alert-tint: rgba(48, 11, 22, .72);
  --alert-button: rgba(7, 10, 17, .38);
  --alert-art: url('images/kff-alert-update-incident-art.webp');
  position: fixed;
  inset: 0;
  z-index: 10000350;
  pointer-events: none;
  direction: rtl;
  isolation: isolate;
}
#kffFireEngineVisualAlert.is-prevention-alert {
  --alert-accent: #39baff;
  --alert-rgb: 57, 186, 255;
  --alert-bg: rgba(4, 19, 46, .73);
  --alert-tint: rgba(6, 43, 79, .73);
  --alert-art: url('images/kff-alert-update-prevention-art.webp');
}
/* Yellow update alerts use the dedicated reference-style artwork for each sector. */
#kffFireEngineVisualAlert.is-news-update {
  --alert-accent: #ffcb39;
  --alert-rgb: 255, 203, 57;
  --alert-bg: rgba(34, 28, 10, .76);
  --alert-tint: rgba(96, 74, 13, .74);
  --alert-button: rgba(9, 15, 25, .58);
}
#kffFireEngineVisualAlert.is-news-update.is-firefighting-alert {
  --alert-art: url('images/kff-alert-update-incident-art.webp');
}
#kffFireEngineVisualAlert.is-news-update.is-prevention-alert {
  --alert-art: url('images/kff-alert-update-prevention-art.webp');
}
#kffFireEngineVisualAlert,
#kffFireEngineVisualAlert * { box-sizing: border-box; }
#kffFireEngineVisualAlert .kff-fire-alert-card {
  position: absolute;
  top: max(13px, calc(env(safe-area-inset-top, 0px) + 9px));
  left: 50%;
  width: min(840px, calc(100vw - 28px));
  height: 120px;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px));
  border: 2px solid var(--alert-accent);
  border-radius: 21px;
  background:
    radial-gradient(ellipse at 96% 25%, rgba(var(--alert-rgb), .10), transparent 65%),
    linear-gradient(105deg, var(--alert-tint), var(--alert-bg));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 11px 21px rgba(0, 0, 0, .29),
              0 0 14px rgba(var(--alert-rgb), .17),
              inset 0 0 0 1px rgba(255, 255, 255, .10);
  font-family: 'Tajawal', 'Noto Sans Arabic', Tahoma, Arial, sans-serif;
  color: var(--alert-text);
  text-align: right;
  direction: rtl;
  isolation: isolate;
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity .22s ease, transform .24s ease;
}
#kffFireEngineVisualAlert.is-show .kff-fire-alert-card {
  opacity: 1;
  transform: translate(-50%, 0);
}
/* Transparent soft art, centered slightly to the physical left, not in a box. */
#kffFireEngineVisualAlert .kff-fire-alert-art {
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  left: 19%;
  width: 55%;
  background-image: var(--alert-art);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  opacity: .29;
  filter: blur(.5px) saturate(.84);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 24%, #000 77%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 24%, #000 77%, transparent 100%);
  pointer-events: none;
  user-select: none;
}
/* New incident and inspection alerts reuse the exact update photos, blended with
   their original red/blue sector colors instead of looking yellow. */
#kffFireEngineVisualAlert:not(.is-news-update) .kff-fire-alert-art {
  opacity: .57;
  filter: grayscale(1) contrast(1.12);
  mix-blend-mode: luminosity;
}
/* The update image is visible in the middle, without creating a separate photo box. */
#kffFireEngineVisualAlert.is-news-update .kff-fire-alert-art {
  left: 19%;
  width: 57%;
  opacity: .76;
  filter: none;
  background-size: cover;
  background-position: center center;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 18%, #000 72%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 18%, #000 72%, transparent 100%);
}
#kffFireEngineVisualAlert.is-news-update .kff-fire-alert-card {
  background:
    radial-gradient(ellipse at 41% 78%, rgba(248, 190, 31, .18), transparent 56%),
    linear-gradient(105deg, var(--alert-tint), var(--alert-bg));
  box-shadow: 0 12px 25px rgba(0, 0, 0, .30),
              0 0 16px rgba(246, 195, 79, .21),
              inset 0 0 0 1px rgba(255, 225, 141, .17);
}
#kffFireEngineVisualAlert .kff-fire-alert-update-badge { display: none; }
#kffFireEngineVisualAlert.is-news-update .kff-fire-alert-update-badge {
  display: inline-flex;
  position: absolute;
  z-index: 3;
  top: 0;
  right: 18px;
  padding: 2px 13px 3px;
  min-width: 70px;
  height: 23px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(110deg, #ffe17d, #ffca26);
  border-radius: 0 0 12px 12px;
  color: #342600;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 9px rgba(0,0,0,.20);
  pointer-events: none;
}
#kffFireEngineVisualAlert.is-news-update .kff-fire-alert-copy { padding-top: 10px; }
#kffFireEngineVisualAlert.is-news-update .kff-fire-alert-kicker {
  color: #ffcf4c;
  text-shadow: 0 1px 3px rgba(0,0,0,.33);
}
#kffFireEngineVisualAlert.is-news-update .kff-fire-alert-open {
  background: rgba(5, 12, 23, .66);
  border-color: #ffcc44;
}
#kffFireEngineVisualAlert .kff-fire-alert-card::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  background: radial-gradient(ellipse at 100% 30%, rgba(var(--alert-rgb), .06), transparent 64%);
  pointer-events: none;
}
#kffFireEngineVisualAlert.lights-active .kff-fire-alert-card::before {
  animation: kffAlertTopSheen 2.5s ease-in-out 2;
}
@keyframes kffAlertTopSheen {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
#kffFireEngineVisualAlert .kff-fire-alert-copy {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 19px;
  left: 132px;
  transform: translateY(-50%);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  text-align: right;
  direction: rtl;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .40);
}
#kffFireEngineVisualAlert .kff-fire-alert-kicker {
  display: block;
  color: var(--alert-accent);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.3;
}
#kffFireEngineVisualAlert .kff-fire-alert-department {
  display: block;
  max-width: 100%;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  white-space: nowrap;
}
#kffFireEngineVisualAlert .kff-fire-alert-headline {
  display: block;
  max-width: 100%;
  color: var(--alert-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  white-space: nowrap;
}
#kffFireEngineVisualAlert .kff-fire-alert-open {
  position: absolute;
  z-index: 3;
  left: 14px; /* physical left, including on RTL phones */
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 101px;
  min-height: 38px;
  padding: 0 11px;
  border: 2px solid var(--alert-accent);
  border-radius: 13px;
  background: var(--alert-button);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
#kffFireEngineVisualAlert .kff-fire-alert-open:hover {
  background: rgba(var(--alert-rgb), .19);
}
#kffFireEngineVisualAlert .kff-fire-alert-close {
  position: absolute;
  z-index: 4;
  top: 4px;
  left: 5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  min-height: 22px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(1, 9, 18, .25);
  color: rgba(255, 255, 255, .82);
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
#kffFireEngineVisualAlert .kff-fire-alert-close:hover { background: rgba(var(--alert-rgb), .27); }
#kffFireEngineVisualAlert .kff-fire-alert-open:focus-visible,
#kffFireEngineVisualAlert .kff-fire-alert-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
@media (max-width: 600px) {
  #kffFireEngineVisualAlert .kff-fire-alert-card {
    top: max(10px, calc(env(safe-area-inset-top, 0px) + 8px));
    width: calc(100vw - 20px);
    height: 108px;
    border-radius: 19px;
  }
  #kffFireEngineVisualAlert .kff-fire-alert-art { left: 18%; width: 58%; opacity: .27; }
  #kffFireEngineVisualAlert:not(.is-news-update) .kff-fire-alert-art { opacity: .55; }
  #kffFireEngineVisualAlert.is-news-update .kff-fire-alert-art { left: 16%; width: 60%; opacity: .72; }
  #kffFireEngineVisualAlert.is-news-update .kff-fire-alert-copy { padding-top: 7px; }
  #kffFireEngineVisualAlert.is-news-update .kff-fire-alert-update-badge {
    right: 14px;
    height: 19px;
    min-width: 58px;
    font-size: 10px;
    padding: 2px 9px;
    border-radius: 0 0 10px 10px;
  }
  #kffFireEngineVisualAlert .kff-fire-alert-copy { right: 12px; left: 99px; gap: 2px; }
  #kffFireEngineVisualAlert .kff-fire-alert-kicker { font-size: 16px; }
  #kffFireEngineVisualAlert .kff-fire-alert-department { font-size: 16px; }
  #kffFireEngineVisualAlert .kff-fire-alert-headline { font-size: 11px; }
  #kffFireEngineVisualAlert .kff-fire-alert-open {
    left: 9px;
    min-width: 78px;
    min-height: 34px;
    padding: 0 6px;
    font-size: 11px;
    border-radius: 10px;
  }
}
@media (max-width: 360px) {
  #kffFireEngineVisualAlert .kff-fire-alert-card { height: 104px; }
  #kffFireEngineVisualAlert .kff-fire-alert-copy { right: 10px; left: 87px; }
  #kffFireEngineVisualAlert .kff-fire-alert-kicker { font-size: 14px; }
  #kffFireEngineVisualAlert .kff-fire-alert-department { font-size: 14px; }
  #kffFireEngineVisualAlert .kff-fire-alert-headline { font-size: 10px; }
  #kffFireEngineVisualAlert .kff-fire-alert-open { left: 7px; min-width: 70px; min-height: 32px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #kffFireEngineVisualAlert .kff-fire-alert-card { transition: none; }
  #kffFireEngineVisualAlert .kff-fire-alert-card::before { animation: none !important; }
}

/* v238-m89: if a dialog was opened by another entry point, never let an
   in-page notification swallow the news editor pencil/button tap. */
body.home-news-detail-open #kffFireEngineVisualAlert,
body.news-editor-open #kffFireEngineVisualAlert { pointer-events: none !important; }
body.home-news-detail-open #kffFireEngineVisualAlert .kff-fire-alert-card,
body.news-editor-open #kffFireEngineVisualAlert .kff-fire-alert-card { pointer-events: none !important; }
