/**
 * Phu Tube Optimizer - Player Styles
 * SCOPED CSS - Only affects .phu-tube-* elements
 * NO GLOBAL SELECTORS - Safe for Flatsome/any theme
 */

/* ============================================
   CONTAINER - Scoped to specific ID pattern
   ============================================ */
.phu-tube-wrap {
    display: block;
    line-height: 0;
    box-sizing: border-box;
}

.phu-tube-wrap .phu-tube-inner {
    position: relative;
    width: 100%;
    height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* ============================================
   IFRAME - Only inside .phu-tube-wrap
   ============================================ */
.phu-tube-wrap .phu-tube-inner > iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    z-index: 1;
}

/* Preloaded iframe - hidden until play clicked */
.phu-tube-wrap .phu-tube-iframe-preload {
    opacity: 0;
    pointer-events: none;
}

/* Show iframe when facade is removed */
.phu-tube-wrap .phu-tube-inner > iframe:only-child,
.phu-tube-wrap .phu-tube-iframe-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 3;
}

/* ============================================
   FACADE (Click-to-play overlay)
   ============================================ */
.phu-tube-wrap .phu-tube-facade {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.phu-tube-wrap .phu-tube-facade:focus {
    outline: 2px solid #FF0000;
    outline-offset: 2px;
}

/* ============================================
   THUMBNAIL IMAGE - Scoped to .phu-tube-thumb
   ============================================ */
.phu-tube-wrap .phu-tube-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    margin: 0;
    padding: 0;
    border: 0;
}

/* ============================================
   BORDER RADIUS - Apply to container, inner, img, iframe
   ============================================ */
.phu-tube-wrap.phu-tube-rounded {
    border-radius: var(--phu-tube-radius, 8px);
    overflow: hidden;
}

.phu-tube-wrap.phu-tube-rounded .phu-tube-inner {
    border-radius: inherit;
    overflow: hidden;
}

.phu-tube-wrap.phu-tube-rounded .phu-tube-inner > iframe,
.phu-tube-wrap.phu-tube-rounded .phu-tube-thumb {
    border-radius: inherit;
}

/* ============================================
   PLAY BUTTON - Scoped to .phu-tube-play
   ============================================ */
.phu-tube-wrap .phu-tube-play {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.phu-tube-wrap .phu-tube-play::before {
    content: "";
    width: 68px;
    height: 48px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 48"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.63 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="red"/><path d="M45 24 27 14v20" fill="white"/></svg>') center/contain no-repeat;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.phu-tube-wrap .phu-tube-facade:hover .phu-tube-play::before {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* ============================================
   ERROR MESSAGE
   ============================================ */
.phu-tube-error {
    padding: 20px;
    background: #fef0f0;
    border: 1px solid #f5c6c6;
    border-radius: 4px;
    color: #a94442;
    text-align: center;
}
