/* WPE Media Embed - Pure CSS PiP Implementation */


.wpe-media-embed-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

/* Placeholder that appears when video is in PiP corner mode */
.wpe-media-placeholder {
    display: none; /* Hidden by default */
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
    position: relative;
}

.wpe-media-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

.wpe-placeholder-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px;
}

.wpe-placeholder-icon {
    margin-bottom: 16px;
    opacity: 0.8;
}

.wpe-placeholder-text {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    opacity: 0.9;
}

/* PiP Container - Always contains the video */
.wpe-pip-container {
    /* Default state: Normal video embed */
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    z-index: 1;
    opacity: 1;
}

/* PiP Header & Footer - Hidden in normal mode */
.wpe-pip-header,
.wpe-pip-footer {
    display: none;
}

/* Video Embed Container */
.wpe-video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px; /* Apply border radius to video container */
    overflow: hidden; /* Hide overflow for video container only */
}

.wpe-video-embed iframe,
.wpe-video-embed video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    margin:0px;
}

/* === COVER IMAGE MODE === */
.wpe-media-embed-container.wpe-cover-mode {
    margin: 20px 0;
}

.wpe-cover-link {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.wpe-cover-link:hover,
.wpe-cover-link:focus {
    text-decoration: none;
    color: inherit;
}

.wpe-cover-image {
    position: relative;
    width: 100%;
}

.wpe-cover-image img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}

.wpe-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.55) 100%);
    transition: background 0.3s ease;
}

.wpe-cover-link:hover .wpe-cover-overlay {
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.65) 100%);
}

.wpe-cover-content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Position variants */
.wpe-cover-content.wpe-position-top-left {
    align-items: flex-start;
    justify-content: flex-start;
}

.wpe-cover-content.wpe-position-top-right {
    align-items: flex-start;
    justify-content: flex-end;
}

.wpe-cover-content.wpe-position-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
}

.wpe-cover-content.wpe-position-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
}

.wpe-cover-content.wpe-position-center-center {
    align-items: center;
    justify-content: center;
}

/* Play icon button */
.wpe-cover-play-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e07b4f;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wpe-cover-play-icon svg {
    margin-left: 3px;
}

.wpe-cover-link:hover .wpe-cover-play-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.45);
}

/* Text box */
.wpe-cover-textbox {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wpe-cover-title {
    color: white;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.wpe-cover-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Cover responsive */
@media (max-width: 768px) {
    .wpe-cover-content {
        padding: 16px;
        gap: 10px;
    }

    .wpe-cover-play-icon {
        width: 52px;
        height: 52px;
    }

    .wpe-cover-play-icon svg {
        width: 22px;
        height: 22px;
    }

    .wpe-cover-title {
        font-size: 15px;
    }

    .wpe-cover-label {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .wpe-cover-content {
        padding: 12px;
        gap: 8px;
    }

    .wpe-cover-play-icon {
        width: 44px;
        height: 44px;
    }

    .wpe-cover-play-icon svg {
        width: 18px;
        height: 18px;
    }

    .wpe-cover-title {
        font-size: 14px;
    }

    .wpe-cover-label {
        font-size: 11px;
    }
}

/* === PiP CORNER MODE === */
.wpe-media-embed-container.wpe-pip-mode .wpe-media-placeholder {
    display: flex; /* Show placeholder when in PiP mode */
}

.wpe-media-embed-container.wpe-pip-mode .wpe-pip-container {
    /* Transform to corner position */
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 320px;
    max-width: calc(100vw - 40px);
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
}

/* Video embed in PiP mode should not have border radius to avoid double rounding */
.wpe-media-embed-container.wpe-pip-mode .wpe-video-embed {
    border-radius: 0;
}

.wpe-media-embed-container.wpe-pip-mode .wpe-pip-container:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(-4px) scale(1.02);
}

/* Show header and footer in PiP mode */
.wpe-media-embed-container.wpe-pip-mode .wpe-pip-header,
.wpe-media-embed-container.wpe-pip-mode .wpe-pip-footer {
    display: flex;
}

/* PiP Header Styles */
.wpe-pip-header {
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(220, 38, 38, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s ease-out;
}

.wpe-pip-title {
    font-size: 11px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.3s ease-out;
}

.wpe-pip-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease-out;
    transform-origin: center;
}

/* PiP Close button */
.wpe-pip-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.wpe-pip-close svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease-out;
}

/* PiP Footer Styles */
.wpe-pip-footer {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.wpe-pip-video-title {
    color: white;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wpe-media-embed-container.wpe-pip-mode .wpe-pip-video-title:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .wpe-media-embed-container.wpe-pip-mode .wpe-pip-container {
        width: 280px;
        bottom: 15px;
        left: 15px;
    }
    
    .wpe-pip-header,
    .wpe-pip-footer {
        padding: 10px 12px;
    }
    
    .wpe-pip-video-title {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .wpe-media-embed-container.wpe-pip-mode .wpe-pip-container {
        width: 250px;
        bottom: 10px;
        left: 10px;
    }
    
    .wpe-pip-header,
    .wpe-pip-footer {
        padding: 8px 10px;
    }
    
    .wpe-pip-title {
        font-size: 10px;
    }
    
    .wpe-pip-video-title {
        font-size: 11px;
    }
    
    .wpe-pip-close {
        padding: 4px;
    }
    
    .wpe-pip-close svg {
        width: 12px;
        height: 12px;
    }
}

/* === HOVER EFFECTS === */
.wpe-media-embed-container:not(.wpe-pip-mode) .wpe-pip-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* === FOCUS STATES === */
.wpe-pip-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
    .wpe-media-embed-container.wpe-pip-mode .wpe-pip-container {
        background: rgba(0, 0, 0, 0.98);
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    .wpe-pip-footer {
        background: rgba(0, 0, 0, 0.9);
        border-color: rgba(255, 255, 255, 0.15);
    }
}

/* === ACCESSIBILITY === */
/* All animations removed for instant transitions */

/* Error state styling */
.wpe-media-embed-error {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    color: #856404;
    margin: 20px 0;
}

.wpe-media-embed-error p {
    margin: 0 0 10px 0;
    font-weight: 500;
}

.wpe-media-embed-error p:last-child {
    margin-bottom: 0;
}

.wpe-media-embed-error small {
    color: #6c757d;
    font-size: 12px;
}

.wpe-media-embed-error code {
    background: #e9ecef;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
}

.wpe-media-embed-error details {
    margin-top: 15px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.wpe-media-embed-error summary {
    padding: 8px 12px;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 500;
    border-radius: 4px 4px 0 0;
}

.wpe-media-embed-error pre {
    margin: 0 !important;
    white-space: pre-wrap;
    word-wrap: break-word;
}
@media print {
    .wpe-media-embed-container.wpe-pip-mode .wpe-pip-container {
        position: relative !important;
        width: 100% !important;
        bottom: auto !important;
        left: auto !important;
        box-shadow: none !important;
    }
    
    .wpe-media-placeholder {
        display: none !important;
    }
    
    .wpe-pip-header,
    .wpe-pip-footer {
        display: none !important;
    }
}