/**
 * LP YouTube Carousel - Frontend Styles
 */

/* 輪播容器 */
.lp-ytc-carousel-wrapper {
		    position: relative;
		    width: 100%;
		    max-width: 1200px; /* 預設最大寬度 */
		    margin: 0 auto;
		    padding: 40px 20px;
		    background: #1a1a1a;
		    border-radius: 12px;
		    /* 應用縮放 */
		    transform-origin: top left;
		    /* 新增：確保內容不會超出容器 */
		    overflow: hidden;
		}
	
	.lp-ytc-carousel-wrapper[data-scale] {
	    /* 實際縮放將由 JS 應用，這裡僅為備用 */
	}

.lp-ytc-carousel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
}

.lp-ytc-carousel-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.lp-ytc-carousel-track {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease-in-out;
}

/* 影片項目 */
.lp-ytc-video-item {
    flex-shrink: 0;
    min-width: 0;
    box-sizing: border-box;
}

.lp-ytc-video-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.lp-ytc-video-link:hover {
    transform: translateY(-5px);
}

.lp-ytc-video-thumbnail {
	    position: relative;
	    width: 100%;
	    padding-bottom: 56.25%; /* 預設 16:9 比例 */
	    background: #000;
	    border-radius: 8px;
	    overflow: hidden;
	}
	
	/* 應用自訂高度 */
	.lp-ytc-carousel-wrapper[data-height] .lp-ytc-video-thumbnail {
	    padding-bottom: 0;
	    height: var(--lp-ytc-height);
	}

.lp-ytc-video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.lp-ytc-video-link:hover .lp-ytc-video-thumbnail img {
    opacity: 0.8;
}

/* 播放按鈕 - 移除顯示 */
.lp-ytc-play-button {
    display: none;
}

/* 影片標題 */
.lp-ytc-video-title {
    margin-top: 15px;
    padding: 0 5px;
}

	.lp-ytc-video-title h3 {
	    margin: 0;
	    font-size: 17px;
	    font-weight: 600;
	    line-height: 1.5;
	    color: #ffffff;
	    display: -webkit-box;
	    -webkit-line-clamp: 2;
	    -webkit-box-orient: vertical;
	    overflow: hidden;
	    text-overflow: ellipsis;
	    /* 確保標題不會因為長度而超出容器 */
	    word-break: break-word;
	}

/* 導航按鈕 */
.lp-ytc-nav {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.lp-ytc-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.lp-ytc-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lp-ytc-nav svg {
    color: #ffffff;
}

/* 分頁指示器 */
.lp-ytc-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.lp-ytc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lp-ytc-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.lp-ytc-dot.active {
    background: #ff0000;
    width: 24px;
    border-radius: 5px;
}

/* Lightbox */
.lp-ytc-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.lp-ytc-lightbox.active {
    display: block;
}

.lp-ytc-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.lp-ytc-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    margin: 50px auto;
    z-index: 1;
}

.lp-ytc-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.lp-ytc-lightbox-close:hover {
    opacity: 0.7;
}

.lp-ytc-lightbox-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
}

.lp-ytc-lightbox-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 空狀態 */
.lp-ytc-carousel-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
}

/* 響應式設計 */
@media (max-width: 1024px) {
	    /* 平板優化：由 JavaScript 控制寬度 */
	    .lp-ytc-carousel-wrapper {
	        padding: 30px 15px;
	    }
	}

	@media (max-width: 768px) {
			    /* 手機優化：由 JavaScript 控制寬度 */
			    .lp-ytc-carousel-wrapper {
			        padding: 20px 10px;
			        /* 確保在手機上不被縮放影響 */
			        transform: none !important;
			        width: 100% !important;
			        max-width: 100% !important;
			        /* 確保輪播容器不會超出視窗寬度 */
			        box-sizing: border-box;
			    }
		    
		    .lp-ytc-carousel {
		        /* 移除左右導航按鈕的空間，讓內容區佔滿 */
		        gap: 10px;
		    }
		    
		    .lp-ytc-carousel-container {
		        /* 確保容器在手機上佔滿可用空間 */
		        width: 100%;
		    }
		    
		    .lp-ytc-carousel-track {
		        gap: 10px;
		    }
		    
		    .lp-ytc-nav {
		        width: 36px;
		        height: 36px;
		    }
		    
		    .lp-ytc-video-title {
		        /* 確保標題容器在手機上不會有過多的水平邊距 */
		        padding: 0 0;
		    }
		    
		    .lp-ytc-video-title h3 {
		        font-size: 14px;
		        /* 確保文字不會溢出 */
		        word-break: break-word;
		    }
		    
		    .lp-ytc-lightbox-content {
		        width: 95%;
		        margin: 20px auto;
		    }
		}

@media (max-width: 480px) {
    .lp-ytc-carousel-wrapper {
        padding: 20px 15px;
    }
    
    .lp-ytc-nav {
        width: 36px;
        height: 36px;
    }
    
    .lp-ytc-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .lp-ytc-video-title h3 {
        font-size: 13px;
    }
}

/* 動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lp-ytc-lightbox.active {
    animation: fadeIn 0.3s ease;
}

/* 載入狀態 */
.lp-ytc-carousel-wrapper.loading .lp-ytc-carousel-track {
    opacity: 0.6;
}



/* 無障礙聚焦樣式 */
.lp-ytc-nav:focus,
.lp-ytc-dot:focus,
.lp-ytc-lightbox-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

