/**
 * TSB Cookie Consent - Placeholder Styles
 * Styling for blocked content placeholders
 *
 * @author Leicht Digital GmbH
 */

.tsb-embed-placeholder {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #e8eef8 0%, #dce4f2 100%);
    border: 2px solid #1e3791;
    border-radius: 0;
    text-align: center;
    overflow: hidden;
}

/* Thumbnail background for YouTube */
.tsb-embed-placeholder__thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    filter: blur(2px);
}

.tsb-embed-placeholder__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 400px;
}

.tsb-embed-placeholder__icon {
    color: #1e3791;
}

.tsb-embed-placeholder__icon svg {
    width: 48px;
    height: 48px;
}

.tsb-embed-placeholder__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1e3791;
}

.tsb-embed-placeholder__message {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #4a5568;
}

.tsb-embed-placeholder__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 12px 28px;
    background-color: #1e3791;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid #1e3791;
    border-radius: 0;
    cursor: pointer;
    transition: opacity 0.25s ease;
}

/* Beim Hovern gefuellt bleiben und nur aufhellen - wie die uebrigen Buttons
   der Website (Theme: assets/css/blocks/button.css). Vorher drehte der Button
   auf transparent mit blauer Schrift um und fiel dadurch aus der Reihe (#51).
   Achtung: Die Banner-Buttons (.tsb-cookie-banner__btn--primary/--secondary)
   sind bewusst anders und bleiben unveraendert - Zustimmen und Ablehnen
   muessen aus DSGVO-Gruenden gleich prominent aussehen. */
.tsb-embed-placeholder__button:hover {
    opacity: 0.9;
}

.tsb-embed-placeholder__button:focus-visible {
    outline: 2px solid #1e3791;
    outline-offset: 2px;
}

.tsb-embed-placeholder__info {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #576270; /* WCAG AA 4.5:1 on gradient background */
}

.tsb-embed-placeholder__settings-link {
    color: #1e3791;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.tsb-embed-placeholder__settings-link:hover {
    opacity: 0.7;
}

/* Type-specific styles */
.tsb-embed-placeholder[data-tsb-type="youtube"] {
    aspect-ratio: 16 / 9;
    min-height: auto;
}

.tsb-embed-placeholder[data-tsb-type="doo"] {
    min-height: 350px;
}

.tsb-embed-placeholder[data-tsb-type="brevo"] {
    min-height: 200px;
}

/* Responsive */
@media (max-width: 768px) {
    .tsb-embed-placeholder {
        padding: 30px 16px;
        min-height: 220px;
    }

    .tsb-embed-placeholder__icon svg {
        width: 36px;
        height: 36px;
    }

    .tsb-embed-placeholder__title {
        font-size: 18px;
    }

    .tsb-embed-placeholder__message {
        font-size: 13px;
    }

    .tsb-embed-placeholder__button {
        padding: 10px 20px;
        font-size: 13px;
        width: 100%;
    }
}

/* WordPress embed wrapper compatibility */
.wp-block-embed .tsb-embed-placeholder {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

figure.wp-block-embed .tsb-embed-placeholder {
    margin: 0;
}

/* Reset figure margins for embed blocks with placeholder */
figure.wp-block-embed:has(.tsb-embed-placeholder) {
    margin-left: 0;
    margin-right: 0;
}

/* Hide the embed wrapper completely when it contains blocked iframe */
.wp-block-embed__wrapper:has(iframe[data-tsb-blocked="true"]) {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

/* Also handle the wrapper when it's hidden via JS inline style */
.wp-block-embed__wrapper[style*="display: none"] {
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

/* Fix: Hide iframe completely including its space */
iframe[data-tsb-blocked="true"] {
    display: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Ensure placeholder takes full width in embed context */
.wp-block-embed-youtube .tsb-embed-placeholder,
.wp-block-embed-vimeo .tsb-embed-placeholder {
    width: 100%;
    max-width: 100%;
}

/* Mobile: Ensure proper width on smaller screens */
@media (max-width: 768px) {
    .wp-block-embed .tsb-embed-placeholder,
    figure.wp-block-embed .tsb-embed-placeholder {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    /* YouTube placeholder on mobile - use aspect ratio */
    .tsb-embed-placeholder[data-tsb-type="youtube"] {
        aspect-ratio: 16 / 9;
        min-height: auto;
    }
}
