/**
 * WP短视频插件样式
 * Version: 2.0.0 - 简约现代风格（与豆瓣海报一致）
 */

/* ========== 容器 ========== */
.wp-short-video-container {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    background: #fff;
}

.wp-short-video-container *,
.wp-short-video-container *::before,
.wp-short-video-container *::after {
    box-sizing: border-box;
}

/* ========== 包装器 ========== */
.wp-short-video-container .wp-short-video-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f8f8;
    padding: 12px;
    border-radius: 12px;
    margin: 0;
}

/* ========== 视频主区域 ========== */
.wp-short-video-container #wp-short-video-main {
    width: 100%;
    height: 800px;
    position: relative;
    background: #000;
    overflow: hidden;
    border-radius: 8px;
    margin: 0;
}

/* 模糊背景Canvas */
.wp-short-video-container .wp-short-video-blur-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: blur(20px) brightness(0.5) saturate(1.2);
    z-index: 0;
    pointer-events: none;
    transform: scale(1.1);
}

.wp-short-video-container #wp-short-video-player {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    z-index: 1;
}

/* ========== 控制按钮区域 ========== */
.wp-short-video-container .wp-short-video-controls {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-short-video-container #wp-short-video-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0;
    margin: 0;
}

/* ========== 按钮样式 ========== */
.wp-short-video-container .wp-short-video-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #333;
    color: #fff;
    min-height: 40px;
    min-width: 100px;
    padding: 10px 20px;
    border: none;
    margin: 0;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

.wp-short-video-container .wp-short-video-btn:hover {
    background: #555;
}

.wp-short-video-container .wp-short-video-btn:active {
    transform: scale(0.97);
}

.wp-short-video-container .wp-short-video-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.wp-short-video-container .wp-short-video-btn .btn-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wp-short-video-container .wp-short-video-btn .btn-text {
    text-shadow: none;
}

/* ========== 下拉选择框 ========== */
.wp-short-video-container .wp-short-video-select-wrapper {
    margin: 0;
    position: relative;
}

.wp-short-video-container .wp-short-video-select-wrapper:after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}

.wp-short-video-container .wp-short-video-select {
    width: 100%;
    background: #fff;
    color: #333;
    border: 1px solid #e5e5e5;
    height: 40px;
    padding: 0 36px 0 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.wp-short-video-container .wp-short-video-select:hover {
    border-color: #333;
}

.wp-short-video-container .wp-short-video-select:focus {
    outline: none;
    border-color: #333;
}

/* ========== 触摸区域 ========== */
.wp-short-video-container .wp-short-video-touch-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: default;
    background-color: transparent;
    border-radius: 8px;
    pointer-events: none;
}

/* ========== 加载指示器 ========== */
.wp-short-video-container .wp-short-video-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    border-top-color: #fff;
    animation: wp-short-video-spin 0.8s linear infinite;
    z-index: 5;
    display: none;
}

@keyframes wp-short-video-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========== 切换提示 ========== */
.wp-short-video-container .wp-short-video-switch-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-short-video-container .wp-short-video-switch-hint.show {
    animation: wp-short-video-fadeInOut 1.5s ease-in-out;
}

@keyframes wp-short-video-fadeInOut {
    0% { opacity: 0; }
    25% { opacity: 1; }
    75% { opacity: 1; }
    100% { opacity: 0; }
}

/* ========== 滑动指引 ========== */
.wp-short-video-container .wp-short-video-swipe-guide {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 10px 6px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.wp-short-video-container .wp-short-video-swipe-guide:hover {
    opacity: 1;
}

.wp-short-video-container .swipe-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px 0;
}

.wp-short-video-container .swipe-arrow svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wp-short-video-container .swipe-up {
    animation: wp-short-video-moveUp 1.5s ease-in-out infinite;
}

.wp-short-video-container .swipe-down {
    animation: wp-short-video-moveDown 1.5s ease-in-out infinite;
}

@keyframes wp-short-video-moveUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes wp-short-video-moveDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.wp-short-video-container .swipe-text {
    font-size: 11px;
    text-align: center;
    margin: 4px 0;
    writing-mode: vertical-lr;
    text-orientation: upright;
    letter-spacing: 1px;
    color: #fff;
}

/* ========== 悬停提示 ========== */
.wp-short-video-container .wp-short-video-hover-tip {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 12;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

.wp-short-video-container .wp-short-video-touch-area:hover + .wp-short-video-hover-tip,
.wp-short-video-container .wp-short-video-touch-area:hover ~ .wp-short-video-hover-tip {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}


/* ========== 触发按钮（弹窗模式） ========== */
.wp-short-video-button-container {
    display: inline-block;
    margin: 10px 0;
}

.wp-short-video-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #333;
    color: #fff;
    min-height: 40px;
    padding: 10px 24px;
    border: none;
    margin: 0;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.wp-short-video-trigger-btn:hover {
    background: #555;
}

.wp-short-video-trigger-btn:active {
    transform: scale(0.97);
}

.wp-short-video-trigger-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.wp-short-video-trigger-btn .btn-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* ========== 弹窗 ========== */
.wp-short-video-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-short-video-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

.wp-short-video-popup-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90%;
    width: 90%;
    height: 80%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wp-short-video-popupIn 0.3s ease-out;
}

@keyframes wp-short-video-popupIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wp-short-video-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
}

.wp-short-video-popup-header h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: 500;
}

.wp-short-video-popup-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-short-video-popup-close:hover {
    background: rgba(0,0,0,0.05);
    color: #333;
}

.wp-short-video-popup-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.wp-short-video-popup-body {
    flex: 1;
    padding: 16px;
    overflow: auto;
    background: #fff;
}

/* 弹窗内容器样式 */
.wp-short-video-popup .wp-short-video-container {
    max-width: 100%;
    margin: 0 auto;
}

.wp-short-video-popup .wp-short-video-wrapper {
    background: #f8f8f8;
    padding: 16px;
}

.wp-short-video-popup #wp-short-video-popup-main {
    flex: 1;
    min-width: 300px;
    position: relative;
    background: #111;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
}

.wp-short-video-popup #wp-short-video-popup-player {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* 弹窗关闭动画 */
.wp-short-video-popup.closing {
    animation: wp-short-video-popupOut 0.2s ease-in forwards;
}

.wp-short-video-popup.closing .wp-short-video-popup-content {
    animation: wp-short-video-popupOut 0.2s ease-in forwards;
}

@keyframes wp-short-video-popupOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* ========== 全屏模式 ========== */
.wp-short-video-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #000;
}

.wp-short-video-fullscreen #wp-short-video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .wp-short-video-container .wp-short-video-wrapper {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }
    
    .wp-short-video-container .wp-short-video-controls {
        width: 100%;
    }
    
    .wp-short-video-container #wp-short-video-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .wp-short-video-container .wp-short-video-btn {
        flex: 1;
        min-width: 100px;
    }
    
    .wp-short-video-container .wp-short-video-select-wrapper {
        flex: 1;
        min-width: 120px;
    }
    
    .wp-short-video-container #wp-short-video-main {
        height: auto;
        aspect-ratio: 9 / 16;
        max-height: 80vh;
    }
    
    .wp-short-video-container .wp-short-video-swipe-guide {
        right: 10px;
        padding: 8px 4px;
    }
    
    .wp-short-video-container .wp-short-video-hover-tip {
        font-size: 12px;
        padding: 6px 12px;
        bottom: 12px;
    }
    
    /* 弹窗响应式 */
    .wp-short-video-popup-content {
        width: 98%;
        height: 90%;
        max-width: 98%;
        max-height: 90%;
    }
    
    .wp-short-video-popup-header {
        padding: 12px 16px;
    }
    
    .wp-short-video-popup-body {
        padding: 12px;
    }
    
    .wp-short-video-popup .wp-short-video-wrapper {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }
    
    .wp-short-video-popup .wp-short-video-controls {
        width: 100%;
    }
    
    .wp-short-video-popup #wp-short-video-popup-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .wp-short-video-popup .wp-short-video-btn {
        flex: 1;
        min-width: 100px;
    }
    
    .wp-short-video-popup #wp-short-video-popup-main {
        height: auto;
        aspect-ratio: 9 / 16;
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .wp-short-video-container .wp-short-video-wrapper {
        padding: 10px;
        gap: 10px;
    }
    
    .wp-short-video-container #wp-short-video-buttons {
        padding: 0;
        gap: 6px;
    }
    
    .wp-short-video-container .wp-short-video-btn,
    .wp-short-video-container .wp-short-video-select-wrapper {
        flex: 1 0 100%;
    }
    
    .wp-short-video-container .wp-short-video-btn {
        padding: 10px 16px;
    }
    
    .wp-short-video-popup-content {
        width: 99%;
        height: 95%;
    }
    
    .wp-short-video-popup .wp-short-video-wrapper {
        padding: 10px;
        gap: 10px;
    }
    
    .wp-short-video-popup #wp-short-video-popup-buttons {
        gap: 6px;
    }
    
    .wp-short-video-popup .wp-short-video-btn,
    .wp-short-video-popup .wp-short-video-select-wrapper {
        flex: 1 0 100%;
    }
}

/* ========== 移动端提示 ========== */
.wp-short-video-mobile-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    animation: wp-short-video-hintFade 4s ease-in-out forwards;
}

@keyframes wp-short-video-hintFade {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

.wp-short-video-mobile-hint svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
    margin: 8px 0;
}

.swipe-icon {
    display: block;
    animation: wp-short-video-swipeHint 2s infinite;
}

@keyframes wp-short-video-swipeHint {
    0% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0); }
}
