/* 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;
}

/* === 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;
    }
}