/**
 * 自动播放偏好设置相关样式
 * 包括偏好选择对话框、播放失败提示、自动播放倒计时等组件
 */

/* 偏好选择对话框 */
.autoplay-preference-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.autoplay-preference-dialog.show {
    opacity: 1;
    visibility: visible;
}

.autoplay-preference-dialog.hide {
    opacity: 0;
    visibility: hidden;
}

.dialog-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.dialog-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(-20px);
    transition: all 0.3s ease;
}

.autoplay-preference-dialog.show .dialog-content {
    transform: scale(1) translateY(0);
}

.dialog-header {
    padding: 24px 24px 0 24px;
    text-align: center;
}

.dialog-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dialog-header i {
    color: #00a1d6;
    font-size: 22px;
}

.dialog-body {
    padding: 20px 24px;
}

.dialog-description {
    margin: 0 0 24px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    text-align: center;
}

.preference-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-card {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.option-card:hover {
    border-color: #00a1d6;
    background: #f8fdff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 161, 214, 0.1);
}

.option-card.recommended {
    border-color: #00a1d6;
    background: linear-gradient(135deg, #f8fdff 0%, #f0fbff 100%);
}

.option-card.recommended:hover {
    background: linear-gradient(135deg, #f0fbff 0%, #e6f9ff 100%);
}

.option-icon {
    margin-right: 12px;
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-card.recommended .option-icon {
    background: linear-gradient(135deg, #00a1d6, #0080c0);
    color: white;
}

.option-card:hover .option-icon:not(.option-card.recommended .option-icon) {
    background: #00a1d6;
    color: white;
}

.option-icon i {
    font-size: 18px;
}

.option-text h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-text p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.recommended-badge {
    background: linear-gradient(135deg, #ff6b35, #ff8f65);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dialog-footer {
    padding: 0 24px 24px 24px;
    text-align: center;
}

.dialog-note {
    margin: 0;
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 播放失败提示 */
.play-failed-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    opacity: 1;
    transition: all 0.3s ease;
}

.play-failed-prompt.hide {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
}

.prompt-icon {
    margin-bottom: 12px;
}

.prompt-icon i {
    font-size: 32px;
    color: #00a1d6;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.prompt-text h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.prompt-text p {
    margin: 0 0 16px 0;
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
}

.continue-play-btn {
    background: linear-gradient(135deg, #00a1d6, #0080c0);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto;
    transition: all 0.2s ease;
}

.continue-play-btn:hover {
    background: linear-gradient(135deg, #0080c0, #006ba0);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 161, 214, 0.3);
}

/* 自动播放倒计时 */
.autoplay-countdown {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 280px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 1;
    transform: translateX(0);
    transition: all 0.3s ease;
}

.autoplay-countdown.hide {
    opacity: 0;
    transform: translateX(100px);
}

.countdown-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.countdown-info {
    flex: 1;
}

.countdown-text {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.countdown-number {
    color: #00a1d6;
    font-size: 16px;
    font-weight: 700;
}

.next-video-info {
    font-size: 12px;
    opacity: 0.8;
}

.next-video-title {
    display: inline-block;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cancel-countdown-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.cancel-countdown-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.countdown-progress {
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00a1d6, #40d0ff);
    width: 0%;
    transition: width 1s linear;
    border-radius: 1px;
}

/* 播放器中的自动播放切换开关 */
.auto-play-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.toggle-label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 18px;
    transition: all 0.2s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #00a1d6;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .dialog-content {
        max-width: 95%;
        margin: 0 10px;
    }
    
    .dialog-header h3 {
        font-size: 18px;
    }
    
    .preference-options {
        gap: 10px;
    }
    
    .option-card {
        padding: 14px;
    }
    
    .autoplay-countdown {
        right: 10px;
        top: 10px;
        min-width: 250px;
        padding: 10px 12px;
    }
    
    .play-failed-prompt {
        max-width: 280px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .autoplay-countdown {
        min-width: 200px;
        font-size: 12px;
    }
    
    .next-video-title {
        max-width: 120px;
    }
}

/* 视频结束画面 */
.video-ended-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.end-screen-content {
    text-align: center;
    color: white;
    max-width: 300px;
}

.end-screen-icon {
    margin-bottom: 16px;
}

.end-screen-icon i {
    font-size: 48px;
    color: #4CAF50;
}

.end-screen-content h3 {
    margin: 0 0 24px 0;
    font-size: 20px;
    font-weight: 600;
}

.end-screen-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.replay-btn,
.play-next-btn {
    background: linear-gradient(135deg, #00a1d6, #0080c0);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    min-width: 120px;
    justify-content: center;
}

.replay-btn:hover,
.play-next-btn:hover {
    background: linear-gradient(135deg, #0080c0, #006ba0);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 161, 214, 0.3);
}

.play-next-btn {
    background: linear-gradient(135deg, #ff6b35, #ff8f65);
}

.play-next-btn:hover {
    background: linear-gradient(135deg, #ff5722, #ff7043);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}