.youtube-thumbs {
    border-radius: 12px;
    overflow: hidden;
	position: relative;
}


.youtube-thumbs::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0px);
    transition: all 0.3s ease;
    z-index: 1;
}

/* যখন child button hover হবে, তখন parent এ effect আসবে */
.youtube-thumbs:has(.ep-video-button:hover)::after {
    backdrop-filter: blur(5px);
    background: rgb(0 0 0 / 20%);
}

:root {
    /* YouTube thumbs responsive dimensions */
    --thumbs-max-width-mobile: 100%;
    --thumbs-max-width-tablet: 100%;
    --thumbs-max-width-desktop: 900px;
    
    --thumbs-height-mobile: 200px;
    --thumbs-height-tablet: 300px;
    --thumbs-height-desktop: 506px;
    
    --thumbs-min-height-mobile: 200px;
    --thumbs-min-height-tablet: 400px;
    --thumbs-min-height-desktop: 506px;
}

.youtube-thumbs {
    position: relative;
    width: 100% !important;
    height: var(--thumbs-height-mobile) !important;
    overflow: hidden;
    max-width: var(--thumbs-max-width-mobile) !important;
    border-radius: 20px;
	margin-left: auto !important;
	margin-right: auto !important;
    /* Ensure consistent dimensions */
    min-height: var(--thumbs-min-height-mobile) !important;
    box-sizing: border-box;
    /* Force dimensions to prevent shrinking */
    flex-shrink: 0;
    flex-grow: 0;
}

.youtube-thumbs img {
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.youtube-thumbs iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    z-index: 99;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Ensure iframe maintains full scale when not in playing state */
.youtube-thumbs:not(.playing) iframe {
    transform: scale(1) !important;
    opacity: 1 !important;
}

/* Show iframe with smooth animation when playing */
.youtube-thumbs.playing iframe {
    opacity: 1;
    transform: scale(1);
}

/* Force iframe to full scale when video is active but not in playing state */
.youtube-thumbs iframe[src*="youtube.com"] {
    transform: scale(1) !important;
    opacity: 1 !important;
}

/* Hide thumbnail image when video is playing */
.youtube-thumbs.playing img {
    opacity: 0;
    transform: scale(1.1),;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.youtube-thumbs.playing .ep-video-button {
    opacity: 0;
    transform: scale(0.8) translate(-50%, -50%);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ep-video-button {
	position: absolute;
	top: 50%;
	left: 50%;
	transform-origin: center;
	transform: translate(-50%, -50%) scale(1);
	width: clamp(60px, 10vw, 100px);
	height: clamp(60px, 10vw, 100px);
	background: rgba(0, 0, 0, 0.8);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	cursor: pointer;
	border: 0;
	box-shadow: 0px 10px 80px 0px rgba(0, 0, 0, 0.2);
	z-index: 10;
}

.ep-video-button:hover {
	background: rgba(255, 0, 0, 0.8);
	transform: translate(-50%, -50%) scale(1.1);
}

.ep-video-button svg {
	width: clamp(20px, 3vw, 24px);
	height: clamp(20px, 3vw, 24px);
	fill: white;
}

.ep-video-button .bdt-icon:before,
.ep-video-button .bdt-icon:after {
	content: '';
	display: block;
	position: absolute;
	border: 1px solid #fff;
	left: -20px;
	right: -20px;
	top: -20px;
	bottom: -20px;
	border-radius: 50%;
	animation: line-bounce 1.5s linear infinite;
	opacity: 0;
	backface-visibility: hidden;
}

.ep-video-button .bdt-icon:after {
	animation-delay: .5s;
}

@keyframes line-bounce {
	0% {
	transform: scale(0.5);
	opacity: 0;
	}
	50% {
	opacity: 1;
	}
	100% {
	transform: scale(1.2);
	opacity: 0;
}
}

/* Floating video styles */
.floating-video-container {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 320px;
	height: 224px; /* Adjusted for 16:9 aspect ratio + header height */
	background: #000;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
	z-index: 9999;
	overflow: hidden;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	border: 2px solid rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(10px);
}

.floating-video-container.morphing {
	border-radius: 0;
	border: none;
	backdrop-filter: none;
	box-shadow: none;
}

.floating-video-container:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.floating-video-container iframe {
	position: absolute;
	top: 44px; /* Account for header height */
	left: 0;
	width: 100% !important;
	height: calc(100% - 44px) !important; /* Subtract header height */
	border: none;
}

.floating-video-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	background: linear-gradient(135deg, rgba(45, 45, 45, 0.95) 0%, rgba(35, 35, 35, 0.95) 100%);
	padding: 8px 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px 12px 0 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: move;
	user-select: none;
	z-index: 10;
	backdrop-filter: blur(10px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	transition: all 0.2s ease;
}

.floating-video-header:hover {
	background: linear-gradient(135deg, rgba(55, 55, 55, 0.98) 0%, rgba(45, 45, 45, 0.98) 100%);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	border-bottom-color: rgba(255, 255, 255, 0.2);
}

.floating-video-header:active {
	background: linear-gradient(135deg, rgba(65, 65, 65, 0.98) 0%, rgba(55, 55, 55, 0.98) 100%);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.floating-video-drag {
	cursor: move;
	font-size: 14px;
	margin-right: 10px;
	color: rgba(255, 255, 255, 0.8);
	flex: 1;
	text-align: left;
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 500;
	transition: color 0.2s ease;
}

.floating-video-drag::before {
	content: '';
	width: 20px;
	height: 12px;
	background-image: 
		radial-gradient(circle, rgba(255, 255, 255, 0.4) 1px, transparent 1px),
		radial-gradient(circle, rgba(255, 255, 255, 0.4) 1px, transparent 1px),
		radial-gradient(circle, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
	background-size: 6px 4px;
	background-position: 0 0, 0 4px, 0 8px;
	background-repeat: repeat-x;
	transition: all 0.2s ease;
	border-radius: 2px;
}

.floating-video-drag:hover {
	color: rgba(255, 255, 255, 1);
}

.floating-video-drag:hover::before {
	background-image: 
		radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, transparent 1px),
		radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, transparent 1px),
		radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, transparent 1px);
}

.floating-video-close {
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	padding: 6px;
	color: rgba(255, 255, 255, 0.8);
	cursor: pointer;
	font-size: 14px;
	border-radius: 6px;
	transition: all 0.2s ease;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}

.floating-video-close::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
	transform: translateX(-100%);
	transition: transform 0.3s ease;
}

.floating-video-close:hover {
	background: rgba(220, 53, 69, 0.8);
	border-color: rgba(220, 53, 69, 1);
	color: white;
	transform: scale(1.05);
	box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.floating-video-close:hover::before {
	transform: translateX(100%);
}

.floating-video-close:active {
	transform: scale(0.95);
}

.floating-video-resize {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 24px;
	height: 24px;
	background: linear-gradient(135deg, rgba(100, 100, 100, 0.8) 0%, rgba(120, 120, 120, 0.8) 100%);
	cursor: nw-resize;
	border-radius: 12px 0 12px 0;
	opacity: 0.6;
	transition: all 0.2s ease;
	border: 1px solid rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(5px);
}

.floating-video-resize:hover {
	opacity: 1;
	background: linear-gradient(135deg, rgba(120, 120, 120, 0.9) 0%, rgba(140, 140, 140, 0.9) 100%);
	transform: scale(1.1);
	border-color: rgba(255, 255, 255, 0.2);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.floating-video-resize::before {
	content: '';
	position: absolute;
	bottom: 4px;
	right: 4px;
	width: 12px;
	height: 12px;
	background-image: 
		linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.6) 42%, rgba(255, 255, 255, 0.6) 44%, transparent 46%),
		linear-gradient(45deg, transparent 46%, rgba(255, 255, 255, 0.6) 48%, rgba(255, 255, 255, 0.6) 50%, transparent 52%),
		linear-gradient(45deg, transparent 52%, rgba(255, 255, 255, 0.6) 54%, rgba(255, 255, 255, 0.6) 56%, transparent 58%);
	background-size: 100% 100%;
	transition: all 0.2s ease;
}

.floating-video-resize:hover::before {
	background-image: 
		linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.9) 42%, rgba(255, 255, 255, 0.9) 44%, transparent 46%),
		linear-gradient(45deg, transparent 46%, rgba(255, 255, 255, 0.9) 48%, rgba(255, 255, 255, 0.9) 50%, transparent 52%),
		linear-gradient(45deg, transparent 52%, rgba(255, 255, 255, 0.9) 54%, rgba(255, 255, 255, 0.9) 56%, transparent 58%);
}

/* Mobile responsive - dimensions will be overridden by saved preferences */
@media (max-width: 768px) {
    .floating-video-container {
        min-width: 240px; /* Smaller minimum for mobile */
        min-height: 179px; /* 135px video + 44px header */
        bottom: 10px;
        right: 10px;
    }

    .youtube-thumbs {
        height: var(--thumbs-height-mobile) !important;
        min-height: var(--thumbs-min-height-mobile) !important;
        max-width: var(--thumbs-max-width-mobile) !important;
    }
}

@media (min-width: 768px) {
    .youtube-thumbs {
        height: var(--thumbs-height-tablet) !important;
        min-height: var(--thumbs-min-height-tablet) !important;
        max-width: var(--thumbs-max-width-tablet) !important;
    }
}

@media (min-width: 1024px) {
    .youtube-thumbs {
        height: var(--thumbs-height-desktop) !important;
        min-height: var(--thumbs-min-height-desktop) !important;
        max-width: var(--thumbs-max-width-desktop) !important;
    }
}