/* ═══════════════════════════════════════════════
   LOADING OVERLAY – DAS EIGENTLICHE PLUGIN-ELEMENT
   ═══════════════════════════════════════════════ */

#jhdb-loading-overlay, #bitte-warten {
  position: fixed;
  inset: 0;
  z-index: 9999;

  /* Schwarzer, leicht transparenter Schleier */
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

#jhdb-loading-overlay.is-active,  #bitte-warten.is-active {
  opacity: 1;
  pointer-events: all;
}

/* ── Zentrale Karte ── */
.jhdb-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 0;
}

/* ── NETZWERK-ANIMATION ── */
.jhdb-net {
  position: relative;
  width: 140px;
  height: 140px;
}

/* SVG canvas */
.jhdb-net-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Verbindungslinien – geschwungen via stroke-dasharray Animation */
.jhdb-edge {
  fill: none;
  stroke: rgba(255,255,255,0.18);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: edge-draw 1.8s ease-in-out infinite alternate;
}
.jhdb-edge:nth-child(1) { animation-delay: 0.0s; }
.jhdb-edge:nth-child(2) { animation-delay: 0.2s; }
.jhdb-edge:nth-child(3) { animation-delay: 0.4s; }
.jhdb-edge:nth-child(4) { animation-delay: 0.6s; }
.jhdb-edge:nth-child(5) { animation-delay: 0.8s; }
.jhdb-edge:nth-child(6) { animation-delay: 1.0s; }

@keyframes edge-draw {
  0%   { stroke-dashoffset: 80; opacity: 0; }
  40%  { opacity: 1; }
  100% { stroke-dashoffset: 0;  opacity: 0.5; }
}

/* Knoten */
.jhdb-node-dot {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: white;
}

/* Zentraler Knoten – groß, grüner Glow */
.jhdb-node-dot--hub {
  width: 22px; height: 22px;
  top: 50%; left: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff, #c8f0c8);
  box-shadow:
    0 0 0 4px rgba(255,255,255,0.08),
    0 0 24px rgba(100, 220, 100, 0.55),
    0 0 48px rgba(100, 220, 100, 0.25);
  animation: hub-breathe 2.2s ease-in-out infinite;
}

@keyframes hub-breathe {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(255,255,255,0.08), 0 0 18px rgba(100,220,100,0.5), 0 0 40px rgba(100,220,100,0.2);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(255,255,255,0.05), 0 0 30px rgba(100,220,100,0.7), 0 0 60px rgba(100,220,100,0.35);
    transform: translate(-50%, -50%) scale(1.12);
  }
}

/* Satellitenknoten */
.jhdb-node-dot--sat {
  width: 11px; height: 11px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
  animation: sat-pulse 2.2s ease-in-out infinite;
}
.jhdb-node-dot--sat:nth-child(2) { top: 12%;  left: 50%;   animation-delay: 0.0s; }
.jhdb-node-dot--sat:nth-child(3) { top: 26%;  left: 82%;   animation-delay: 0.3s; }
.jhdb-node-dot--sat:nth-child(4) { top: 70%;  left: 88%;   animation-delay: 0.6s; }
.jhdb-node-dot--sat:nth-child(5) { top: 88%;  left: 55%;   animation-delay: 0.9s; }
.jhdb-node-dot--sat:nth-child(6) { top: 78%;  left: 15%;   animation-delay: 1.2s; }
.jhdb-node-dot--sat:nth-child(7) { top: 28%;  left: 10%;   animation-delay: 1.5s; }

@keyframes sat-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
  50%       { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}

/* Umlaufender Radar-Ring */
.jhdb-sweep-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.06);
}

.jhdb-sweep-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 300deg,
    rgba(130, 230, 130, 0.12) 330deg,
    rgba(130, 230, 130, 0.22) 355deg,
    transparent 360deg
  );
  animation: sweep-rotate 3s linear infinite;
}

@keyframes sweep-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Expanding pulse rings */
.jhdb-pulse-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(130, 230, 130, 0.6);
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: ring-expand 3s ease-out infinite;
}
.jhdb-pulse-ring:nth-child(2) { animation-delay: 1.0s; }
.jhdb-pulse-ring:nth-child(3) { animation-delay: 2.0s; }

@keyframes ring-expand {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.8; border-color: rgba(130,230,130,0.7); }
  100% { transform: translate(-50%, -50%) scale(5.2); opacity: 0;   border-color: rgba(130,230,130,0); }
}

/* ── Textblock ── */
.jhdb-overlay-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.jhdb-overlay-title {
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.03em;
}

.jhdb-overlay-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Animierte Fortschrittsleiste */
.jhdb-progress-track {
  width: 180px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.jhdb-progress-bar {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(130,230,130,0.8), transparent);
  border-radius: 2px;
  animation: progress-slide 1.8s ease-in-out infinite;
}

@keyframes progress-slide {
  0%   { left: -50%; width: 40%; }
  100% { left: 110%; width: 40%; }
}

/* Punkte */
.jhdb-dots {
  display: flex;
  gap: 6px;
}
.jhdb-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  animation: dot-fade 1.5s ease-in-out infinite;
}
.jhdb-dots span:nth-child(2) { animation-delay: 0.3s; }
.jhdb-dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes dot-fade {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50%       { opacity: 1;   transform: scale(1.2); }
}

/* ═══════════════════════════════════════════════
   LADESCREEN FREIPLATZAMPEL
   ═══════════════════════════════════════════════

   Gehoert zu templates/ladescreen-fpa.php. Die Regeln haengen alle
   an .fpa-ladescreen und sind damit fuer jedes andere Portal wirkungslos,
   auch wenn diese Datei ueberall geladen wird.

   Motiv: die Ampel aus dem Portalnamen. Rot, Gelb, Gruen schalten der
   Reihe nach durch - fuer die Wartezeit ein Bild, das man nicht erklaeren
   muss, und dasselbe Motiv wie das Logo der Seite.
   ═══════════════════════════════════════════════ */

.fpa-ladescreen .fpa-ampel {
    position: relative;
    width: 96px;
    height: 168px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Weicher Schein hinter dem Gehaeuse - nimmt der schwarzen Flaeche
   die Haerte, ohne von den Lampen abzulenken. */
.fpa-ladescreen .fpa-ampel-schein {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 150px;
    height: 150px;
    margin-left: -75px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(120, 200, 140, 0.22), rgba(120, 200, 140, 0) 68%);
    animation: fpa-schein 2.4s ease-in-out infinite;
}

@keyframes fpa-schein {
    0%, 100% { transform: scale(0.94); opacity: 0.75; }
    50%      { transform: scale(1.06); opacity: 1; }
}

/* Gehaeuse */
.fpa-ladescreen .fpa-ampel-kasten {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 12px 11px;
    border-radius: 16px;
    background: linear-gradient(160deg, #33403a 0%, #1e2a25 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09),
                0 10px 26px rgba(0, 0, 0, 0.45);
}

/* Mast - nur angedeutet, damit die Ampel steht und nicht schwebt. */
.fpa-ladescreen .fpa-ampel-mast {
    width: 10px;
    height: 34px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(180deg, #33403a, #1e2a25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Lampen.
   Jede Lampe bringt ihre eigene Farbe als Variable mit; die Keyframes
   weiter unten sind fuer alle drei dieselben und lesen sie aus. So gibt
   es einen Bewegungsablauf statt drei fast gleicher. */
.fpa-ladescreen .fpa-lampe {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--fpa-lampe, #ffffff);
    opacity: 0.22;
    /* Der eingesetzte Schatten laesst die dunkle Lampe wie eine Linse im
       Gehaeuse wirken statt wie ein flacher Punkt. Er bleibt auch waehrend
       des Leuchtens stehen - deshalb steht er hier und nicht in den
       Keyframes, die nur den aeusseren Schein setzen. */
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
    animation: fpa-leuchten 2.4s ease-in-out infinite;
}

.fpa-ladescreen .fpa-lampe--rot   { --fpa-lampe: #e23b2e; --fpa-schein: rgba(226, 59, 46, 0.75);  animation-delay: 0s; }
.fpa-ladescreen .fpa-lampe--gelb  { --fpa-lampe: #f2b705; --fpa-schein: rgba(242, 183, 5, 0.75);  animation-delay: 0.8s; }
.fpa-ladescreen .fpa-lampe--gruen { --fpa-lampe: #3faa4a; --fpa-schein: rgba(63, 170, 74, 0.75);  animation-delay: 1.6s; }

/* Eine Lampe leuchtet knapp ein Drittel des Umlaufs und geht dann
   wieder zurueck - dadurch wandert das Licht sichtbar von oben nach
   unten, statt dass drei Lampen unabhaengig blinken. */
@keyframes fpa-leuchten {
    0%   { opacity: 0.22; transform: scale(1);
           box-shadow: inset 0 1px 2px rgba(0,0,0,0.45); }
    6%   { opacity: 1;    transform: scale(1.08);
           box-shadow: inset 0 1px 2px rgba(0,0,0,0.25),
                       0 0 14px var(--fpa-schein), 0 0 34px var(--fpa-schein); }
    28%  { opacity: 1;    transform: scale(1.08);
           box-shadow: inset 0 1px 2px rgba(0,0,0,0.25),
                       0 0 14px var(--fpa-schein), 0 0 34px var(--fpa-schein); }
    40%  { opacity: 0.22; transform: scale(1);
           box-shadow: inset 0 1px 2px rgba(0,0,0,0.45); }
    100% { opacity: 0.22; transform: scale(1);
           box-shadow: inset 0 1px 2px rgba(0,0,0,0.45); }
}

/* Fortschrittsleiste und Text in den Farben des Portals. */
.fpa-ladescreen .jhdb-progress-bar {
    background: linear-gradient(90deg, transparent, rgba(63, 170, 74, 0.9), transparent);
}

.fpa-ladescreen .jhdb-overlay-title {
    letter-spacing: 0.02em;
}

/* Wer Bewegung im Betriebssystem abbestellt hat, bekommt eine ruhige
   Ampel: gruen, ohne Wechsel. Der Ladescreen bleibt lesbar, es zappelt
   nur nichts mehr. */
@media (prefers-reduced-motion: reduce) {
    .fpa-ladescreen .fpa-lampe,
    .fpa-ladescreen .fpa-ampel-schein,
    .fpa-ladescreen .jhdb-progress-bar,
    .fpa-ladescreen .jhdb-dots span {
        animation: none;
    }
    .fpa-ladescreen .fpa-lampe--gruen {
        opacity: 1;
        box-shadow: 0 0 14px var(--fpa-schein), 0 0 34px var(--fpa-schein);
    }
}

/* ═══════════════════════════════════════════════
   LADESCREEN BERUFSVORMUND
   ═══════════════════════════════════════════════

   Gehoert zu templates/ladescreen-bv.php. Alle Regeln haengen an
   .bv-ladescreen und sind fuer jedes andere Portal wirkungslos.

   Motiv aus dem Logo der Seite: gruener Kreis, darin ein Bildschirm
   mit Haken. Der Ring laeuft einmal herum, dann zeichnet sich der
   Haken hinein - das Bild sagt "wird geprueft" und nicht nur
   "irgendetwas dreht sich".
   ═══════════════════════════════════════════════ */

.bv-ladescreen .bv-zeichen {
    width: 132px;
    height: 132px;
}

.bv-ladescreen .bv-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Ruhende Spur - macht den Kreis auch dann sichtbar, wenn der
   laufende Ring gerade auf der anderen Seite ist. */
.bv-ladescreen .bv-spur {
    fill: none;
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 3;
}

/* Laufender Ring.
   Umfang bei r=50 sind rund 314. Das Muster aus 70 Strich und 244
   Luecke ergibt ein knappes Viertel, das umlaeuft. Die Drehung sitzt
   auf dem Element selbst, deshalb transform-origin in der Mitte. */
.bv-ladescreen .bv-lauf {
    fill: none;
    stroke: #4bbf72;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 70 244;
    transform-origin: 60px 60px;
    animation: bv-ring 1.6s linear infinite;
    filter: drop-shadow(0 0 6px rgba(75, 191, 114, 0.55));
}

@keyframes bv-ring {
    from { transform: rotate(-90deg); }
    to   { transform: rotate(270deg); }
}

/* Bildschirm und Fuss - ruhig, sie sind das Gehaeuse fuer den Haken. */
.bv-ladescreen .bv-schirm {
    fill: none;
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 3;
}

.bv-ladescreen .bv-fuss {
    fill: none;
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 3;
    stroke-linecap: round;
}

/* Der Haken zeichnet sich hinein, bleibt kurz stehen und verschwindet
   wieder. Die Laenge des Pfades betraegt rund 34; dasharray und
   dashoffset arbeiten mit etwas Reserve. */
.bv-ladescreen .bv-haken {
    fill: none;
    stroke: #4bbf72;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: bv-haken 3.2s ease-in-out infinite;
}

@keyframes bv-haken {
    0%        { stroke-dashoffset: 36; opacity: 0; }
    12%       { opacity: 1; }
    38%, 68%  { stroke-dashoffset: 0;  opacity: 1; }
    86%, 100% { stroke-dashoffset: 0;  opacity: 0; }
}

/* Fortschrittsleiste in der Portalfarbe. */
.bv-ladescreen .jhdb-progress-bar {
    background: linear-gradient(90deg, transparent, rgba(75, 191, 114, 0.9), transparent);
}

/* Ohne Bewegung: fertiger Haken, stehender Ring. */
@media (prefers-reduced-motion: reduce) {
    .bv-ladescreen .bv-lauf,
    .bv-ladescreen .bv-haken,
    .bv-ladescreen .jhdb-progress-bar,
    .bv-ladescreen .jhdb-dots span {
        animation: none;
    }
    .bv-ladescreen .bv-haken {
        stroke-dashoffset: 0;
        opacity: 1;
    }
    .bv-ladescreen .bv-lauf {
        transform: rotate(-90deg);
    }
}
