/* ══════════════════════════════════════════════════════════════════════════════
   media-editor.css — §MEDIA-EDITOR-2026-09-25
   ══════════════════════════════════════════════════════════════════════════════
   Vollbild-Editor vor dem Versenden. Schwarzer Grund, damit das Bild und nicht
   die Oberfläche die Aufmerksamkeit bekommt.
   Safe-Areas sind hier Pflicht, nicht Kosmetik: die Werkzeugleiste liegt oben am
   Rand (Notch/Statusleiste) und die Sendeleiste unten (Gestenbalken). Ohne
   env(safe-area-inset-*) läge der Senden-Knopf unter dem Home-Indikator.
   ══════════════════════════════════════════════════════════════════════════════ */
.ec-me {
  position: fixed;
  inset: 0;
  z-index: 2147483100;                   /* über allen Modalen, unter dem Toast */
  display: flex;
  flex-direction: column;
  background: #000;
  /* Kein Auswahl-Rechteck beim Wischen auf dem Canvas. */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

/* §ME-WA-2026-10-18: Klassenregeln mit display:flex hebelten das hidden-Attribut
   aus — Palette und die alte Zuschneide-Leiste standen dauerhaft im Bild. */
.ec-me [hidden] { display: none !important; }

/* ── Obere Werkzeugleiste (WhatsApp-Stil: ✕ links, Icon-Reihe rechts) ───── */
.ec-me-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) calc(8px + env(safe-area-inset-right, 0px))
           8px calc(6px + env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, rgba(0, 0, 0, .7), rgba(0, 0, 0, 0));
  position: relative;
  z-index: 2;
}
.ec-me-tools { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.ec-me-tools::-webkit-scrollbar { display: none; }
.ec-me-ico {
  flex: 0 0 auto;
  width: 40px; height: 44px;              /* 44 px hoch = Touch-Mindestmaß */
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit; font-size: 16px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6));
}
.ec-me-svg { width: 23px; height: 23px; }
.ec-me-ico:active { transform: scale(.92); }
.ec-me-ico.active { background: rgba(255, 255, 255, .92); color: #111; filter: none; }
.ec-me-hd { font-size: 13px; letter-spacing: .02em; }
.ec-me-hd.active { background: #fff; color: #111; }
.ec-me-aa { font-size: 17px; }
.ec-me-close { width: 44px; }
.ec-me-close .ec-me-svg { width: 26px; height: 26px; }
.ec-me-apply { width: 44px; background: #a6a6a6; color: #101010; filter: none; }
/* Beim Zuschneiden: nur ✕ (Abbrechen) und ✓ (Uebernehmen) */
.ec-me.is-cropping .ec-me-tools { visibility: hidden; }

/* ── Bühne mit dem Bild ─────────────────────────────────────────────────── */
.ec-me-stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;                          /* sonst wächst Flex über den Rand */
}
.ec-me-canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  max-height: calc(100dvh - 160px);
  object-fit: contain;
  /* Schachbrett unter dem Bild wäre verwirrend — schlichter dunkler Grund. */
  background: #0a0a10;
  touch-action: none;
}

/* ── Zuschneide-Maske ───────────────────────────────────────────────────── */
.ec-me-crop {
  position: absolute;
  border: 2px solid #fff;
  /* Der Schatten nach außen verdunkelt alles jenseits der Auswahl — so ist
     sofort sichtbar, was wegfällt. */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55);
  pointer-events: none;
}
.ec-me-handle {
  position: absolute;
  width: 30px; height: 30px;              /* großzügig: Finger, nicht Maus */
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, .35);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}
.ec-me-handle.tl { left: -15px; top: -15px; }
.ec-me-handle.tr { right: -15px; top: -15px; }
.ec-me-handle.bl { left: -15px; bottom: -15px; }
.ec-me-handle.br { right: -15px; bottom: -15px; }

/* ── Schwebende Farb- und Emoji-Auswahl (nur im passenden Werkzeug) ────── */
.ec-me-palette,
.ec-me-emojis {
  position: absolute;
  /* left/right + fit-content statt left:50%/translate — sonst steht nur die
     halbe Breite zur Verfuegung und die Reihe wird abgeschnitten. */
  left: 12px; right: 12px;
  bottom: 12px;
  width: fit-content;
  margin-inline: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 2;
}
.ec-me-swatch {
  flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .55);
  cursor: pointer; padding: 0;
}
.ec-me-swatch.active {
  border-color: #fff;
  transform: scale(1.18);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
}
.ec-me-emo {
  flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 50%;
  border: 0; padding: 0; cursor: pointer;
  background: transparent; font-size: 24px; line-height: 1;
}
.ec-me-emo.active { background: rgba(255, 255, 255, .22); }
.ec-me-emojis { gap: 4px; padding-inline: 8px; }

/* ── Hinweis (schwebt oben über dem Bild) ───────────────────────────────── */
.ec-me-hint {
  position: absolute;
  top: 8px; left: 16px; right: 16px;
  width: fit-content;
  margin-inline: auto;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .55);
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, .85);
  pointer-events: none;
  z-index: 2;
}

/* ── Untere Leiste: Einmal-ansehen, Bildunterschrift, Senden ────────────── */
.ec-me-bottom {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px calc(10px + env(safe-area-inset-right, 0px)) 0 calc(10px + env(safe-area-inset-left, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0, 0, 0, .8), rgba(0, 0, 0, 0));
}
.ec-me-once {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .55);
  background: transparent;
  color: #fff; font-size: 18px; font-weight: 700; cursor: pointer;
}
.ec-me-once.active { background: #fff; color: #111; border-color: #fff; }
.ec-me-caption {
  flex: 1 1 auto; min-width: 0;
  height: 46px;
  padding: 0 16px;
  border-radius: 23px;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  /* 16 px Untergrenze: darunter zoomt iOS Safari beim Fokus in das Feld. */
  font: inherit; font-size: 16px;
  outline: none;
}
.ec-me-caption:focus { background: rgba(255, 255, 255, .18); }
.ec-me-caption::placeholder { color: rgba(255, 255, 255, .55); }
.ec-me-send {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  border: 0; cursor: pointer; padding: 0;
  background: linear-gradient(135deg, #717171, #6f6f6f);
  color: #fff;
  box-shadow: 0 6px 18px rgba(111, 111, 111, .45);
}
.ec-me-send .ec-me-svg { width: 24px; height: 24px; margin-left: -2px; }
.ec-me-send:active { transform: scale(.94); }
.ec-me-send[disabled] { opacity: .55; cursor: progress; }

/* Sehr flache Fenster (Landschaft am Handy): Hinweis kostet Platz. */
@media (max-height: 520px) {
  .ec-me-hint { display: none; }
  .ec-me-ico { height: 38px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   §MEDIA-EDITOR-2026-09-25 — "Einmal ansehen" im Chat
   ══════════════════════════════════════════════════════════════════════════════
   Die Verdeckung ist ein CSS-Blur — das ist hier ausdrücklich NUR eine Anzeige-
   maßnahme, kein Schutz: das Bild liegt vollständig im Speicher. Geschützt wird
   nicht gegen den Empfänger (der darf es ja sehen), sondern gegen den flüchtigen
   Blick eines Dritten über die Schulter, bevor der Empfänger bewusst antippt.
   Das eigentliche "danach weg" macht ecRevealOnce(): Nachricht serverseitig
   löschen, Blob-URL freigeben, Zeile entfernen.
   ══════════════════════════════════════════════════════════════════════════════ */
.ec-once-wrap { position: relative; }
.ec-once-wrap .msg-media.blurred {
  filter: blur(22px) saturate(.7);
  transform: scale(1.04);                /* verhindert helle Ränder durch den Blur */
}
.ec-once-wrap .reveal-btn {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  background: rgba(0, 0, 0, .42);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  padding: 10px;
}
.ec-once-wrap .reveal-btn span:first-child { font-size: 26px; }
.ec-once-timer {
  position: absolute;
  top: 8px; right: 8px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;    /* die Zahl soll nicht springen */
  pointer-events: none;
}
