/* ===================================================
   Media Galerie Addon – Styles
   =================================================== */

/* -------------------- Gemeinsam -------------------- */
.mga-item {
    position: relative;
    display: block;
}

.mga-item img,
.mga-video-wrap {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* -------------------- Video -------------------- */
.mga-video-wrap {
    position: relative;
    background: #000;
    overflow: hidden;
}

/* Auto-Vorschaubild via Canvas */
.mga-video-poster-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.mga-video-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.mga-video-player.mga-playing {
    opacity: 1;
    pointer-events: all;
}

/* Play-Button */
.mga-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    transition: background 0.2s ease, transform 0.2s ease;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.mga-play-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: translate(-50%, -50%) scale(1.1);
}

.mga-play-btn.mga-hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Standard SVG Icon */
.mga-play-btn svg.mga-play-icon-svg {
    width: 45%;
    height: 45%;
    fill: #fff;
    margin-left: 3px; /* optischer Ausgleich */
    flex-shrink: 0;
}

/* Eigenes hochgeladenes Icon */
.mga-play-btn img.mga-play-icon {
    width: 45%;
    height: 45%;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

/* -------------------- Grid -------------------- */
.mga-grid {
    width: 100%;
}

.mga-grid .mga-item {
    width: 100%;
    height: 100%;
}

/* -------------------- Slider -------------------- */
.mga-slider-wrapper {
    position: relative;
    width: 100%;
    /* overflow управляется родителем страницы (body overflow-x:hidden),
       чтобы слайды одинаково выходили за пределы и слева, и справа */
}

.mga-slider-track-outer {
    width: 100%;
    overflow: hidden;
}

/* Slider überschreitet rechten Rand des Containers */
.mga-slider-track-outer.mga-overflow-visible {
    overflow: visible;
}

.mga-slider-track {
    display: flex;
    align-items: flex-start;
    transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

.mga-slide {
    flex-shrink: 0;
    /* Breite wird per JS gesetzt */
}

.mga-slide img,
.mga-slide .mga-video-wrap {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Режим фиксированной высоты (по умолчанию) */
.mga-slide.mga-fixed-height img,
.mga-slide.mga-fixed-height .mga-video-wrap {
    height: 100%;
    object-fit: cover;
}

/* Wenn das Slide ein Bild enthält – natürliche Breite */
.mga-slide.mga-natural-size {
    width: auto !important;
}

/* -------------------- Slider Kopfzeile (Titel + Pfeile) -------------------- */
.mga-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.mga-slider-title {
    margin: 0;
    line-height: 1.2;
    flex: 1;
}

.mga-slider-title-empty {
    flex: 1;
    display: block;
}

/* -------------------- Pfeile -------------------- */
.mga-slider-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.mga-arrow {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
    padding: 0;
    flex-shrink: 0;
    color: #333333;
}

.mga-arrow:hover {
    background: #ddd;
    transform: scale(1.08);
}

.mga-arrow svg {
    width: 16px;
    height: 17px;
    pointer-events: none;
    display: block;
}

/* Editor-Vorschau */
.elementor-editor-active .mga-slider-track {
    transition: none;
}


/* ===================================================
   Vorher / Nachher Slider Widget
   =================================================== */

/* ---- Slider-Wrapper ---- */
.mga-ba-slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden; /* Verhindert horizontalen Seitenscroll */
}

.mga-ba-track-outer {
    width: 100%;
    overflow: hidden;
}

.mga-ba-track-outer.mga-ba-overflow-visible {
    overflow: visible;
}

.mga-ba-track {
    display: flex;
    align-items: stretch;
    transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

.mga-ba-slide {
    flex-shrink: 0;
    /* Breite wird per JS gesetzt */
}

/* ---- Karte (die eigentliche Vorher/Nachher-Box) ---- */
.mga-ba-card {
    width: 100%;
    height: 380px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
}

/* Layer */
.mga-ba-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.mga-ba-layer img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    display: block;
}

.mga-ba-after { z-index: 1; }
.mga-ba-before { z-index: 2; }

/* Labels */
.mga-ba-label {
    position: absolute;
    bottom: 14px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}

.mga-ba-label-before { left: 12px; }
.mga-ba-label-after  { right: 12px; }

/* Trennlinie */
.mga-ba-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ffffff;
    z-index: 10;
    transform: translateX(-50%);
    pointer-events: none;
}

/* Griff */
.mga-ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid rgba(255,255,255,0.5);
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    cursor: col-resize;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.mga-ba-handle:hover,
.mga-ba-handle:focus {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 4px 18px rgba(0,0,0,0.3);
    outline: none;
}

.mga-ba-handle svg {
    width: 55%;
    height: 55%;
    stroke: #333;
    stroke-width: 2;
    fill: none;
    pointer-events: none;
}

/* ---- Navigations-Pfeile (links unten, gleich wie Galerie-Slider) ---- */
.mga-ba-slider-controls {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    justify-content: flex-start;
}

.mga-ba-nav-arrow {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
    padding: 0;
    flex-shrink: 0;
    color: #333333;
}

.mga-ba-nav-arrow:hover {
    background: #ddd;
    transform: scale(1.08);
}

.mga-ba-nav-arrow svg {
    width: 16px;
    height: 17px;
    pointer-events: none;
    display: block;
}


/* ===================================================
   Filter-Leiste (gemeinsam für beide Widgets)
   =================================================== */

.mga-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.mga-filter-btn {
    padding: 7px 18px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    background: #f0f0f0;
    color: #333;
    border-radius: 20px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    line-height: 1;
    white-space: nowrap;
}

.mga-filter-btn:hover {
    transform: translateY(-1px);
    opacity: 0.85;
}

.mga-filter-btn.mga-active {
    background: #333;
    color: #fff;
}

/* Slide beim Ausblenden per Filter */
.mga-slide[data-tags],
.mga-ba-slide[data-tags],
.mga-item[data-tags] {
    transition: opacity 0.25s ease;
}

.mga-slide.mga-filtered-out,
.mga-ba-slide.mga-filtered-out,
.mga-item.mga-filtered-out {
    display: none;
}



/* ===================================================
   Stapel-Scroller — wirkt auf Elementor-Sektionen
   mit der CSS-Klasse "mga-stack-section"
   =================================================== */

/* Konfigurations-Widget verstecken im Frontend */
.mga-stack-config {
    display: none !important;
}

/* Hinweis-Box im Editor */
.mga-stack-editor-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f0f4ff;
    border-left: 3px solid #4a6cf7;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
}
.mga-stack-editor-hint code {
    background: #dde5ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

/*
 * .mga-stack-section  — Karten die gestapelt werden (sticky, skalieren)
 * .mga-stack-header   — Textsektionen die sticky mitlaufen
 *
 * JS setzt top, z-index und transform dynamisch.
 */

/* Sanfte Übergänge für Scale + Translate */
.mga-stack-section,
.mga-stack-header {
    transform-origin: top center;
    will-change: transform;
    overflow: visible !important; /* obere Kante der vorigen Karte muss sichtbar bleiben */
}

/* Innerer Container: Eckenradius + Schatten (vom JS gesetzt, hier als Fallback) */
.mga-stack-section > .e-con-inner,
.mga-stack-section > .elementor-container {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

/* Im Editor nicht sticky — sonst ist Bearbeitung unmöglich */
.elementor-editor-active .mga-stack-section,
.elementor-editor-active .mga-stack-header {
    position: relative !important;
    transform: none !important;
    transition: none !important;
}


/* ===================================================
   Accordion Progress Slider
   =================================================== */

.mga-acc-wrapper {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: start;
}

/* Panel links */
.mga-acc-wrapper.mga-acc-img-left .mga-acc-list-col   { order: 2; }
.mga-acc-wrapper.mga-acc-img-left .mga-acc-panels,
.mga-acc-wrapper.mga-acc-img-left .mga-acc-panels-col,
.mga-acc-wrapper.mga-acc-img-left .mga-acc-nested-panels { order: 1; }

/* ---- Linke Spalte ---- */
.mga-acc-list-col {
    flex: 1 1 0;
    min-width: 0;
}

/* ---- Linke Überschrift ---- */
.mga-acc-left-heading {
    margin-top: 0;
    margin-bottom: 20px;
}

/* ---- Liste ---- */
.mga-acc-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mga-acc-item {
    cursor: pointer;
    padding: 14px 18px;
    border-radius: var(--mga-acc-br, 12px);
    transition: background 0.3s ease;
    user-select: none;
}

.mga-acc-item:hover {
    background: color-mix(in srgb, var(--mga-acc-bg, #f5eded) 60%, transparent);
}

.mga-acc-item.mga-acc-active {
    background: var(--mga-acc-bg, #f5eded);
}

/* ---- Header ---- */
.mga-acc-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.mga-acc-number {
    font-size: 1em;
    font-weight: 600;
    color: var(--mga-acc-accent, #8c6e72);
    flex-shrink: 0;
    min-width: 28px;
    transition: color 0.3s ease;
}

.mga-acc-item:not(.mga-acc-active) .mga-acc-number {
    color: var(--mga-acc-num, #666666);
}

.mga-acc-title {
    font-size: 1em;
    font-weight: 600;
    color: var(--mga-acc-title, #333333);
    transition: color 0.3s ease;
}

.mga-acc-item.mga-acc-active .mga-acc-title {
    color: var(--mga-acc-accent, #8c6e72);
}

/* ---- Body (collapsed by default) ---- */
.mga-acc-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                padding 0.3s ease;
    padding-top: 0;
}

.mga-acc-item.mga-acc-active .mga-acc-body {
    max-height: 300px;
    opacity: 1;
    padding-top: 10px;
}

.mga-acc-text {
    font-size: 0.875em;
    color: #555;
    line-height: 1.6;
    margin: 0 0 14px 0;
}

/* ---- Progress Bar ---- */
.mga-acc-progress-bar {
    height: 2px;
    background: rgba(0,0,0,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.mga-acc-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--mga-acc-prog, #8c6e72);
    border-radius: 2px;
    /* animation via JS / CSS var */
}

.mga-acc-item.mga-acc-running .mga-acc-progress-fill {
    transition: width linear;
}

/* ---- Rechte Spalte: Panels (Standard) ---- */
.mga-acc-panels {
    position: sticky;
    top: 40px;
    align-self: start;
    flex: 0 0 50%;
    max-width: 50%;
}

.mga-acc-panel {
    display: none;
    border-radius: var(--mga-acc-img-br, 16px);
    overflow: hidden;
}

.mga-acc-panel.mga-acc-panel-active {
    display: block;
}

/* ---- Rechte Spalte: Nested Panels (Drag & Drop) ---- */
.mga-acc-nested-panels,
.mga-acc-panels-col {
    position: sticky;
    top: 40px;
    align-self: start;
    flex: 0 0 50%;
    max-width: 50%;
}

.mga-acc-nested-panel,
.mga-acc-panel-wrap {
    display: none;
    border-radius: var(--mga-acc-img-br, 16px);
    overflow: hidden;
}

.mga-acc-nested-panel.mga-acc-panel-active,
.mga-acc-panel-wrap.mga-acc-panel-active {
    display: block;
}

/* Im Editor immer alle Panels anzeigen (gestapelt) */
.elementor-editor-active .mga-acc-nested-panel,
.elementor-editor-active .mga-acc-panel-wrap,
.elementor-editor-active .mga-acc-panel {
    display: block;
    margin-bottom: 8px;
    outline: 2px dashed rgba(144, 97, 249, 0.4);
    outline-offset: 2px;
}

.elementor-editor-active .mga-acc-nested-panel::before,
.elementor-editor-active .mga-acc-panel-wrap::before {
    content: 'Panel ' attr(data-panel);
    display: block;
    font-size: 11px;
    color: #9061f9;
    padding: 4px 8px;
    background: rgba(144, 97, 249, 0.08);
    font-family: monospace;
}

/* ---- Panel Platzhalter (kein Template gewählt) ---- */
.mga-acc-panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 220px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 16px;
    color: #aaa;
    text-align: center;
    padding: 24px;
}
.mga-acc-panel-placeholder p    { margin: 0; font-size: 14px; font-weight: 600; color: #888; }
.mga-acc-panel-placeholder small { font-size: 11px; }

/* ---- Bild ---- */
.mga-acc-image-wrap {
    border-radius: var(--mga-acc-img-br, 16px);
    overflow: hidden;
    line-height: 0;
}

.mga-acc-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--mga-acc-img-br, 16px);
    transition: opacity 0.4s ease;
}

.mga-acc-image.mga-acc-img-fade {
    opacity: 0;
}

/* Template-Platzhalter im Editor */
.mga-acc-template-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: var(--mga-acc-img-br, 16px);
    color: #888;
    font-size: 14px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .mga-acc-wrapper {
        flex-direction: column;
        gap: 24px;
    }
    .mga-acc-wrapper.mga-acc-img-left .mga-acc-list-col    { order: 2; }
    .mga-acc-wrapper.mga-acc-img-left .mga-acc-panels,
    .mga-acc-wrapper.mga-acc-img-left .mga-acc-panels-col,
    .mga-acc-wrapper.mga-acc-img-left .mga-acc-nested-panels { order: 1; }
    .mga-acc-panels,
    .mga-acc-panels-col,
    .mga-acc-nested-panels {
        position: relative !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }
    .mga-acc-list-col {
        width: 100% !important;
        flex: none !important;
    }
}
