:root{
    --nospam-blue-rgb: 67, 168, 253;
}

.iframe-preview {
    width: 100%;
    height: 100%;
    /* position: relative; */
}

/* Wrapper for border animation */
.iframe-preview-wrapper {
    width: 100%;
    height: 100% !important;
    overflow: hidden;
    border-radius: var(--bs-card-inner-border-radius, .5rem);
    padding:0;
    /* position: relative; */
}

.iframe-preview-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    /* padding: 2px; */
    background: linear-gradient(
        135deg,
        #43A8FD,
        #CA0699,
        #930FAB
    );
    background-size: 300% 300%;
    animation: borderflow 4s ease infinite;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    z-index: 0;
}

@keyframes borderflow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Skeleton */
.iframe-preview-skeleton {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        rgba(67,168,253,0.08),
        rgba(202,6,153,0.08),
        rgba(147,15,171,0.08),
        rgba(67,168,253,0.08)
    );
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    z-index: 2;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Iframe */
.iframe-preview-frame {
    position: absolute;
    top: 0;
    left: -3px;
    border: none;
    transform-origin: top left;
    opacity: 0;
    transition: opacity .35s ease;
    z-index: 1;
    pointer-events: none;
}

.iframe-preview-frame.show {
    opacity: 1;
}

/* Fallback container */
.iframe-preview-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    border-radius: inherit;
    background: rgba(255, 0, 0, 0.05);
    border: 1px solid rgba(255, 0, 0, 0.15);
    color: #333;
    font-size: .9rem;
    text-align: center;
    padding: 1rem;
    opacity: 0;
    animation: fallbackFadeIn .35s ease forwards;
}

/* Icon styling */
.iframe-preview-fallback i {
    font-size: 1.8rem;
    color: var(--nospam-blue);
    opacity: 0.85;
}

/* Fade-in animation */
@keyframes fallbackFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button spacing */
.iframe-preview-fallback .fallback-open-btn {
    margin-top: .4rem;
}

/* Overlay container */
.iframe-preview-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: flex-end; /* bottom aligned */
    justify-content: center;
    padding-bottom: 1rem;
    background: linear-gradient(
        to top,
        color-mix(in srgb, var(--nospam-blue) 70%, transparent),
        transparent
    );
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .3s ease;
    border-radius: inherit;
    pointer-events: none; /* enabled on hover or mobile */
}

/* Desktop: show overlay on hover */
.iframe-preview-wrapper:hover .iframe-preview-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile: always show overlay */
@media (max-width: 768px) {
    .iframe-preview-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Button container (optional spacing) */
.iframe-preview-overlay-content {
    pointer-events: auto;
}
