/* =========================================
   1. VIDEO CONTAINER (GENERAL CONFIG)
   ========================================= */
.yt-wrapper {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    
    /* Default 16:9 for PC/Mobile */
    aspect-ratio: 16 / 9 !important;
    
    /* Reset old layout */
    height: auto !important;
    padding-bottom: 0 !important;
    
    background: #000 !important;
    border-radius: 12px;
    overflow: hidden;
    margin: 30px auto !important;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    /* Fix layout jitter on iOS */
    transform: translateZ(0); 
}

/* Specific config for Shorts (9:16) on PC */
.yt-wrapper[data-ratio="9x16"] {
    aspect-ratio: 9 / 16 !important;
    max-width: 400px !important; /* Limit width on PC for aesthetics */
    margin: 30px auto !important;
}

/* =========================================
   2. THUMBNAIL IMAGE (IMPORTANT)
   ========================================= */
/* Strong selector to override all Theme CSS */
html body .yt-wrapper img, 
html body .yt-wrapper .yt-thumb {
    position: absolute !important;
    inset: 0 !important;
    
    /* Mandatory dimensions */
    width: 100% !important;
    height: 100% !important;
    
    /* Break theme limitations */
    max-width: none !important; 
    min-width: 100% !important;
    min-height: 100% !important;
    
    margin: 0 !important;
    padding: 0 !important;
    
    /* Crop image to fit frame (Zoom center) */
    object-fit: cover !important;
    object-position: center !important;
    
    z-index: 1 !important;
    opacity: 0.95;
    transition: opacity 0.3s;
}

.yt-wrapper:hover img {
    opacity: 1 !important;
}

/* =========================================
   3. PLAY BUTTON (CSS DRAWN)
   ========================================= */
.yt-play-btn {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 68px !important;
    height: 48px !important;
    background-color: #ff0000 !important;
    border-radius: 18% / 27% !important;
    z-index: 100 !important;
    display: block !important;
    pointer-events: none;
    transition: background-color 0.2s;
}

.yt-play-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
    display: block;
}

.yt-wrapper:hover .yt-play-btn {
    background-color: #cc0000 !important;
}

/* Hide button when video plays */
.yt-wrapper iframe ~ .yt-play-btn {
    display: none !important;
}

/* =========================================
   4. VIDEO IFRAME
   ========================================= */
.yt-wrapper iframe {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 200 !important;
    border: none !important;
    background: #000;
}

/* =========================================
   📱 MOBILE FIX (SCREEN < 768PX)
   This section fixes small image issue on phones
   ========================================= */
@media (max-width: 768px) {
    
    /* 1. Shorts on Mobile allowed full horizontal width */
    .yt-wrapper[data-ratio="9x16"] {
        max-width: 100% !important; 
        width: 100% !important;
        margin: 20px auto !important;
        border-radius: 8px !important; /* Less border radius on mobile */
    }

    /* 2. FORCE IMAGE HEIGHT */
    /* Themes often set height: auto on mobile, this line breaks it */
    html body .yt-wrapper img.yt-thumb {
        height: 100% !important; 
        width: 100% !important;
        
        /* Important: Force image to stretch at all costs */
        object-fit: cover !important; 
        
        /* Fix issue where some themes set max-height */
        max-height: none !important; 
    }
}