/**
 * Pop-UpO – Frontend-Styles
 *
 * Mobile-First, responsive, keine externen Abhängigkeiten.
 *
 * @package Pop_UpO
 */

/* ─── Overlay ────────────────────────────────────────────────── */
.pop-upo-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;                       /* JS steuert die Sichtbarkeit */
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.pop-upo-overlay.pop-upo--visible {
    display: flex;
    opacity: 1;
}

/* ─── Pop-Up Container ───────────────────────────────────────── */
.pop-upo {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: var(--pop-upo-surface, #fff);
    color: var(--pop-upo-text, #222222);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    transform: translateY(0);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.pop-upo-overlay[data-draggable="1"] .pop-upo__title,
.pop-upo-overlay[data-draggable="1"] .pop-upo__type-badge,
.pop-upo-overlay[data-draggable="1"] .pop-upo__image {
    cursor: move;
    touch-action: none;
}

.pop-upo-overlay--dragging,
.pop-upo-overlay--dragging .pop-upo {
    user-select: none;
}

.pop-upo--dragging {
    transition: none !important;
}

/* ─── Inline-Erklärlinks ─────────────────────────────────────── */
.pop-upo-term-link {
    color: #2271b1;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.16em;
    cursor: pointer;
}

.pop-upo-term-link:hover,
.pop-upo-term-link:focus-visible {
    color: #135e96;
    text-decoration-thickness: 3px;
}

/* ─── Animationen ────────────────────────────────────────────── */
/* Fade-In */
.pop-upo-overlay[data-animation="fade-in"] .pop-upo {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.pop-upo-overlay[data-animation="fade-in"].pop-upo--visible .pop-upo {
    opacity: 1;
}

/* Slide-Up */
.pop-upo-overlay[data-animation="slide-up"] .pop-upo {
    opacity: 0;
    transform: translateY(40px);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.pop-upo-overlay[data-animation="slide-up"].pop-upo--visible .pop-upo {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Hintergrundbild ────────────────────────────────────────── */
.pop-upo__image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #444;
}

/* ─── Body / Inhalt ──────────────────────────────────────────── */
.pop-upo__body {
    padding: 24px 20px;
}

.pop-upo__title {
    margin: 0 0 12px;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--pop-upo-text, #222222);
}

.pop-upo__content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--pop-upo-text, #222222);
    margin: 0 0 16px;
}

.pop-upo__content p:last-child {
    margin-bottom: 0;
}

/* ─── Button ─────────────────────────────────────────────────── */
.pop-upo__btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    color: #fff;
    background: #2271b1;
}

.pop-upo__btn:hover,
.pop-upo__btn:focus-visible {
    background: #135e96;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* Typ-spezifische Button-Farben */
.pop-upo--type-event .pop-upo__btn {
    background: #6c5ce7;
}

.pop-upo--type-event .pop-upo__btn:hover,
.pop-upo--type-event .pop-upo__btn:focus-visible {
    background: #5a4bd1;
}

.pop-upo--type-warning .pop-upo__btn {
    background: #e17055;
}

.pop-upo--type-warning .pop-upo__btn:hover,
.pop-upo--type-warning .pop-upo__btn:focus-visible {
    background: #c0513a;
}

/* ─── Close-Button ───────────────────────────────────────────── */
.pop-upo__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0;
}

.pop-upo__close:hover,
.pop-upo__close:focus-visible {
    background: rgba(0, 0, 0, 0.7);
}

.pop-upo__close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ─── Typ-Indikator ──────────────────────────────────────────── */
.pop-upo__type-badge {
    position: relative;
    display: inline-block;
    margin: 16px 0 0 16px;
    z-index: 5;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}

/* Badge über dem Bild: absolut positionieren */
.pop-upo:has(.pop-upo__image) .pop-upo__type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    margin: 0;
}

/* Ohne Bild: Badge hat Abstand nach unten zum Titel */
.pop-upo:not(:has(.pop-upo__image)) .pop-upo__type-badge {
    margin: 20px 0 0 20px;
}

.pop-upo:not(:has(.pop-upo__image)) .pop-upo__body {
    padding-top: 12px;
}

.pop-upo--type-info .pop-upo__type-badge {
    background: #2271b1;
}

.pop-upo--type-event .pop-upo__type-badge {
    background: #6c5ce7;
}

.pop-upo--type-warning .pop-upo__type-badge {
    background: #e17055;
}

/* ─── Textauswahl-Menü ──────────────────────────────────────── */
.pop-upo-selection-menu {
    position: absolute;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 6px;
    border: 1px solid rgba(20, 33, 61, 0.14);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    color: #1f2933;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
}

.pop-upo-selection-menu[hidden] {
    display: none !important;
}

.pop-upo-selection-menu__label {
    padding: 4px 8px 2px;
    color: #52606d;
    font-size: 12px;
    font-weight: 600;
}

.pop-upo-selection-menu__button {
    display: block;
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    border: 0;
    border-radius: 6px;
    background: #2271b1;
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.pop-upo-selection-menu__button:hover,
.pop-upo-selection-menu__button:focus-visible {
    background: #135e96;
    color: #fff;
    transform: translateY(-1px);
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (min-width: 480px) {
    .pop-upo__image {
        height: 240px;
    }

    .pop-upo__body {
        padding: 28px 28px;
    }

    .pop-upo__title {
        font-size: 1.5rem;
    }
}

@media (min-width: 768px) {
    .pop-upo {
        max-width: 640px;
    }

    .pop-upo__image {
        height: 280px;
    }

    .pop-upo__body {
        padding: 32px;
    }
}

@media (min-width: 1024px) {
    .pop-upo {
        max-width: 720px;
    }

    .pop-upo__image {
        height: 320px;
    }
}

/* ─── Dark Design ────────────────────────────────────────────── */
.pop-upo--dark .pop-upo__close {
    background: rgba(255, 255, 255, 0.2);
}

.pop-upo--dark .pop-upo__close:hover,
.pop-upo--dark .pop-upo__close:focus-visible {
    background: rgba(255, 255, 255, 0.35);
}

/* ─── Accessibility: Reduce Motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .pop-upo-overlay,
    .pop-upo {
        transition: none !important;
    }
}
