/**
 * J Cloudflare Stream - Public Styles
 * 前台樣式
 */

/* 影片容器 */
.jcfs-video-container {
    position: relative;
    display: inline-block;
    width: 100%;
    background: #000;
}

/* 影片包裝器 */
.jcfs-video-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* 預設 16:9 長寬比 */
.jcfs-video-wrapper {
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
}

/* 當使用 aspect-ratio 時覆蓋 padding-bottom */
.jcfs-video-wrapper[style*="aspect-ratio"] {
    padding-bottom: 0 !important;
}

/* iframe 樣式 */
.jcfs-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 手機隱藏 */
@media (max-width: 767px) {
    .jcfs-mobile-hidden {
        display: none !important;
    }
}

/* 延遲載入效果 */
.jcfs-lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.jcfs-lazy-load.jcfs-loaded {
    opacity: 1;
}

/* 載入動畫 */
.jcfs-video-container.jcfs-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: jcfs-spin 1s linear infinite;
    z-index: 10;
}

@keyframes jcfs-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 編輯器模式樣式 */
.elementor-editor-active .jcfs-video-container {
    min-height: 200px;
}

/* 響應式調整 */
@media (max-width: 1024px) {
    .jcfs-video-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .jcfs-video-wrapper {
        padding-bottom: 56.25%; /* 保持 16:9 在小螢幕 */
    }
}

/* 全螢幕按鈕樣式優化 */
.jcfs-video-wrapper iframe::-webkit-media-controls-fullscreen-button {
    display: block;
}

/* 確保在容器中居中 */
.jcfs-video-container.jcfs-center {
    margin-left: auto;
    margin-right: auto;
}

/* 錯誤訊息樣式 */
.jcfs-error {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    text-align: center;
}

/* 佔位符樣式 */
.jcfs-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #f5f5f5;
    border: 2px dashed #ccc;
    color: #666;
    font-size: 14px;
}
