/* Digitana Social - Profilbild-Overlay / Profilbildfenster
   Feinschliff 2026-05-20 V2
   Zweck: Profilbild-Overlay, Profilbildfenster-Kommentare, Profilbild-Ausschnitt,
   Overlay-Reaktionsbereich und Mini-Kamera/Overlay-Oeffner aus base.css auslagern.
   Wichtig: Fachliche Verschiebung aus base.css plus besprochener Scroll-Fix.
   Nachkorrektur V2: Scrollbarkeit im Profilbildfenster und klare Reaktionsblase.
   Nachkorrektur V3: Nur unterer Innenabstand im Profilbildfenster.
   Nachkorrektur V4: Sichtbarer unterer Spacer und mitlaufendes Schliessen-X.
   Nachkorrektur V5: Unterer Raum fuer Profilbild-Hauptreaktionsfenster.
   Keine Änderung an Upload-, Kommentar-, Live-, Datenbank- oder Service-Logik. */

/* Profilbild-Link / Oeffner */
.ds-profile-avatar-open {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
}

.ds-profile-avatar-image {
  object-position: var(--ds-avatar-x, 50%) var(--ds-avatar-y, 50%);
  transform: translate(var(--ds-avatar-shift-x, 0%), var(--ds-avatar-shift-y, 0%)) scale(var(--ds-avatar-zoom, 1));
  transform-origin: center center;
  will-change: transform;
  image-rendering: auto;
  object-fit: cover;
  backface-visibility: hidden;
}

.ds-profile-avatar-placeholder-large {
  width: 220px;
  height: 220px;
}

.ds-profile-avatar-wrap,
.ds-profile-avatar-image,
.ds-profile-avatar-placeholder {
  width: 108px;
  height: 108px;
}

/* Profilbild-Overlay Grundrahmen */
.ds-profile-image-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ds-profile-image-overlay:target,
.ds-profile-image-overlay.ds-profile-overlay-open {
  z-index: 9999;
  opacity: 1;
  pointer-events: auto;
  display: flex;
}

.ds-profile-overlay-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.78);
}

.ds-profile-overlay-card {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 34px));
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  margin: 0;
  padding: 18px 18px 44px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(30, 58, 78, 0.98), rgba(0, 0, 0, 0.99));
  box-shadow:
    0 25px 70px rgba(0, 0, 0, 0.78),
    0 0 34px color-mix(in srgb, var(--ds-profile-accent) 28%, transparent),
    inset 0 0 0 1px rgba(215, 237, 255, 0.14);
}

.ds-profile-overlay-close {
  position: sticky;
  top: 10px;
  z-index: 5400;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -6px 0 -22px auto;
  color: #dff5ff;
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
  text-shadow: 0 0 8px rgba(32, 169, 255, 0.42), 0 1px 0 #000000;
}

/* Profilbild im Overlay */
.ds-profile-overlay-imagebox {
  position: relative;
  width: 100%;
  height: clamp(220px, 42vh, 500px);
  min-height: 0;
  flex: 0 1 auto;
  margin: 0 0 10px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  background: #000000;
  box-shadow:
    inset 0 0 0 1px rgba(215, 237, 255, 0.10),
    inset 0 0 34px rgba(32, 169, 255, 0.05),
    0 16px 42px rgba(0, 0, 0, 0.42);
}

.ds-profile-overlay-imagebox img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center center;
  transform: translate(var(--ds-avatar-shift-x, 0%), var(--ds-avatar-shift-y, 0%)) scale(var(--ds-avatar-zoom, 1));
  transform-origin: center;
  border-radius: 0;
  box-shadow: none;
  will-change: transform;
  image-rendering: auto;
}

.ds-profile-overlay-avatar-upload .ds-profile-camera {
  left: 12px;
  right: auto;
  bottom: 12px;
  top: auto;
}

/* Profilbild-Ausschnitt */
.ds-profile-image-adjust {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 9px;
  padding: 8px 10px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(20, 42, 60, 0.72), rgba(0, 0, 0, 0.72));
  color: #bfe8ff;
  font-size: 0.76rem;
  box-shadow: inset 0 0 0 1px rgba(215, 237, 255, 0.08);
}

.ds-profile-image-adjust > span {
  color: #eaf6ff;
  letter-spacing: 0.04em;
}

.ds-profile-image-adjust label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.ds-profile-image-adjust input[type="range"] {
  width: clamp(92px, 12vw, 150px);
  accent-color: var(--ds-profile-accent, #20a9ff);
}

/* Profilbild-Aktionen und Kommentare im Overlay */
.ds-profile-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 12px;
  margin: 8px 0 12px;
}

.ds-profile-overlay-actions .ds-profile-inline-delete {
  margin-left: auto;
}

.ds-profile-overlay-card > .ds-profile-action-block,
.ds-profile-overlay-card > .ds-profile-image-action-block {
  flex: 0 0 auto;
}

/* Reaktionsblase bleibt im Profilbildfenster nutzbar, ohne Kommentare oder Textfeld zu verschieben. */
.ds-profile-image-action-block {
  position: relative;
  z-index: 5200;
  overflow: visible;
}

.ds-profile-overlay-card .ds-profile-reaction-picker {
  z-index: 1;
}

.ds-profile-overlay-card .ds-profile-reaction-picker[open] {
  z-index: 5200;
}

.ds-profile-overlay-card .ds-profile-reaction-popover {
  z-index: 5300;
  max-width: calc(100vw - 48px);
  opacity: 1;
  color: #eaf6ff;
  background-color: #020912;
  background:
    radial-gradient(ellipse at 16% 0%, rgba(215, 237, 255, 0.10), transparent 38%),
    linear-gradient(135deg, #0f2435 0%, #020912 44%, #000000 100%);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.82),
    0 0 24px rgba(32, 169, 255, 0.22),
    inset 0 0 0 1px rgba(215, 237, 255, 0.22);
  backdrop-filter: none;
}

.ds-profile-overlay-card .ds-profile-action-row,
.ds-profile-overlay-card .ds-profile-action-left,
.ds-profile-overlay-card .ds-profile-action-right {
  overflow: visible;
}

/* Mini-Kamera / Profilbild-Oeffner */
.ds-profile-avatar-upload-trigger {
  right: -8px;
  bottom: -7px;
  text-decoration: none;
}

.ds-profile-avatar-upload-trigger.ds-profile-avatar-open,
.ds-profile-avatar-wrap .ds-profile-avatar-upload-trigger {
  position: absolute;
  right: -8px;
  bottom: -7px;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  overflow: visible;
  border-radius: 4px;
  text-decoration: none;
}

.ds-profile-avatar-wrap .ds-profile-avatar-upload-trigger span[aria-hidden="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  line-height: 1;
}

@media (max-width: 820px) {
  .ds-profile-avatar-wrap,
  .ds-profile-avatar-image,
  .ds-profile-avatar-placeholder {
    width: 76px;
    height: 76px;
  }

  .ds-profile-image-overlay {
    padding: 12px;
  }

  .ds-profile-overlay-card {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    padding: 14px 14px 40px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .ds-profile-overlay-imagebox {
    height: clamp(180px, 38vh, 340px);
  }

  .ds-profile-image-adjust {
    gap: 7px 9px;
    font-size: 0.72rem;
  }


  .ds-profile-image-adjust input[type="range"] {
    width: min(112px, 30vw);
  }
}
