/**
 * WP ArtPlayer - 前端样式
 */

/* 播放器容器 - 16:9 比例，兼容大多数显示器 */
.wp-artplayer-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 比例 */
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #000;
    max-width: 100%;
}

/* 移动端播放器容器 - 4:3 比例 */
@media (max-width: 768px) {
    .wp-artplayer-wrapper {
        padding-top: 75%; /* 4:3 比例 */
    }
}

.wp-artplayer-wrapper > div {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 使用 Flexbox 确保视频内容居中 */
    display: flex !important;
    align-items: end !important;
    justify-content: center !important;
}

/* 对于视频元素本身，确保其居中显示 */
.wp-artplayer-wrapper video {
    object-fit: contain; /* 确保视频内容完整显示，保持比例 */
    align-self: center; /* 在容器中垂直居中 */
    margin: auto; /* 在容器中水平居中 */
}

/* B站风格的播放器主题 */
.artplayer-app {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 播放时间位置调整 - 移到进度条上方 */
.artplayer-app .art-time {
    position: absolute;
    right: 16px;
    top: 16px;
    padding: 2px 10px;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    color: #e5e7eb;
    pointer-events: none;
    z-index: 50;
}

/* 在移动端隐藏时间显示以节省空间 */
@media (max-width: 768px) {
    .artplayer-app .art-time,
    .artplayer-app .art-control-time {
        display: none;
    }
}

/* 控制栏样式 - 现代极简风格 */
.artplayer-app .art-bottom {
    padding: 0 12px 8px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.6) 60%, transparent 100%);
    backdrop-filter: blur(8px);
    box-sizing: border-box;
}

/* 进度条容器 */
.artplayer-app .art-progress {
    height: 3px;
    margin-bottom: 8px;
}

/* 进度条样式 - 现代蓝色 */
.artplayer-app .art-progress-played {
    background: #3b82f6;
}

.artplayer-app .art-progress-hover {
    background: rgba(59, 130, 246, 0.5);
}

/* 控制按钮容器 */
.artplayer-app .art-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
}

/* 按钮样式 */
.artplayer-app .art-control-item {
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

/* 按钮悬停效果 */
.artplayer-app .art-control-item:hover {
    color: #3b82f6;
    background: rgba(255, 255, 255, 0.1);
}



/* 播放/暂停大图标 - 移到窗口中心 */
.artplayer-app .art-state {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.artplayer-app .art-state svg {
    width: 40px;
    height: 40px;
    fill: #fff;
}

/* 显示播放/暂停图标 */
.artplayer-app.art-playing .art-state,
.artplayer-app.art-pause .art-state {
    opacity: 1;
}

/* 3秒后淡出 */
.artplayer-app.art-playing .art-state {
    animation: fadeOut 0.3s ease 0.5s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* 保持 ArtPlayer 默认音量控制样式，不要覆盖 */
/* 注意：不要使用 flex 布局，会破坏音量面板 */

/* 弹幕容器优化 */
.artplayer-app .artplayer-plugin-danmuku {
    pointer-events: none;
}

.artplayer-app .artplayer-plugin-danmuku .danmuku-item {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-weight: 500;
}

/* 弹幕输入框样式 - B站风格 */
.artplayer-app .artplayer-plugin-danmuku-emitter {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.artplayer-app .artplayer-plugin-danmuku-emitter input {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.artplayer-app .artplayer-plugin-danmuku-emitter input:focus {
    border-color: #00A1D6;
    outline: none;
}

.artplayer-app .artplayer-plugin-danmuku-emitter button {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.artplayer-app .artplayer-plugin-danmuku-emitter button:hover {
    background: #2563eb;
}


/* 响应式设计 */
@media (max-width: 768px) {
    .wp-artplayer-wrapper {
        margin: 10px 0;
    }
    
    .artplayer-app {
        font-size: 14px;
    }
    
    /* 移动端控制栏优化 */
    .artplayer-app .art-bottom {
        padding: 0 4px 2px;
        min-height: 34px;
    }
    
    .artplayer-app .art-controls {
        gap: 1px;
        padding: 0 1px;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        -ms-overflow-style: none;
    }
    
    .artplayer-app .art-controls::-webkit-scrollbar {
        display: none;
    }
    
    .artplayer-app .art-control-item {
        height: 28px;
        min-width: 28px;
        padding: 0 2px;
        flex-shrink: 0;
        font-size: 10px;
    }
    
    /* 防止右侧控制项溢出 */
    .artplayer-app .art-controls-right {
        overflow: visible;
        flex-wrap: nowrap;
    }
    
    /* 移动端选集按钮位置调整 */
    .artplayer-app .art-controls-right {
        min-width: auto;
    }
    
    /* 弹幕输入框优化 */
    .artplayer-app .artplayer-plugin-danmuku-emitter {
        bottom: 20px !important;
        width: calc(100% - 20px) !important;
        left: 10px !important;
        right: auto !important;
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        padding: 6px;
        position: absolute !important;
        z-index: 1000 !important;
    }
    
    /* 修正弹幕输入框位置 */
    .artplayer-app .artplayer-plugin-danmuku {
        bottom: auto !important;
    }
    

    
    .artplayer-app .artplayer-plugin-danmuku-emitter input {
        flex: 1;
        min-width: 100px;
        padding: 6px 8px;
        font-size: 12px;
        height: 30px;
    }
    
    .artplayer-app .artplayer-plugin-danmuku-emitter button {
        padding: 6px 10px;
        font-size: 12px;
        white-space: nowrap;
        height: 30px;
    }
    
    /* 移动端选集面板位置调整 */
    .artplayer-playlist-panel {
        bottom: 70px;
        right: 8px;
        left: 8px;
        max-width: calc(100% - 16px);
        max-height: 40vh;
        top: auto;
    }
}

/* 全屏模式下的优化 */
.artplayer-app.art-fullscreen {
    z-index: 9999;
}

/* 画中画模式优化 */
.artplayer-app.art-mini {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

/* 播放列表按钮样式 */
.artplayer-app .art-control-playlist {
    position: relative;
}

/* 剧集列表面板样式 */
.artplayer-playlist-panel {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.artplayer-playlist-panel::-webkit-scrollbar {
    width: 6px;
}

.artplayer-playlist-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.artplayer-playlist-panel::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 3px;
}

.artplayer-playlist-panel::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

.artplayer-playlist-panel .playlist-item {
    user-select: none;
}


/* 字幕样式优化 */
.artplayer-app .art-subtitle {
    text-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.9),
        -1px -1px 2px rgba(0, 0, 0, 0.9),
        1px -1px 2px rgba(0, 0, 0, 0.9),
        -1px 1px 2px rgba(0, 0, 0, 0.9);
    font-weight: 500;
}

/* 防止与主题样式冲突 */
.wp-artplayer-wrapper * {
    box-sizing: border-box;
}

.wp-artplayer-wrapper img {
    max-width: 100%;
    height: auto;
}
