/**
 * RiHide Preview 预览功能样式
 */

/* 新的居中预览信息栏样式 - 符合第二张图红框样式 */
.preview-info-bar-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

/* 居中的预览按钮 - 蓝色圆角按钮 */
.btn-preview-centered {
    background: #007bff !important;
    color: #fff !important;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.btn-preview-centered:hover {
    background: #0056b3 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

/* 居中的剩余次数显示 - 隐藏 */
.preview-remaining-centered {
    display: none !important;
}

/* 新的预览信息栏样式 - 符合第二张图红框样式 */
.preview-info-bar-new {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 15px;
}

.start-preview-btn-new {
    background: #007bff !important;
    color: #fff !important;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.start-preview-btn-new:hover {
    background: #0056b3 !important;
    transform: translateY(-1px);
}

.preview-remaining-new {
    color: #6c757d;
    font-size: 13px;
    font-weight: 500;
    display: none; /* 隐藏剩余次数显示 */
}

/* 预览容器 */
.ri-preview-container {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #f8f9fa;
    position: relative;
}

/* 预览标题 */
.ri-preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.ri-preview-title i {
    margin-right: 8px;
    color: #007bff;
}

/* 预览内容 */
.ri-preview-content {
    display: none;
    margin: 15px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center; /* 内容居中对齐 */
    min-height: 300px; /* 设置最小高度以便垂直居中 */
    display: flex;
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    flex-direction: column; /* 垂直排列，倒计时在下方 */
}

.ri-preview-content.show {
    display: flex; /* 显示时保持flex布局 */
}

/* 视频播放器居中显示 */
.ri-preview-content video,
.ri-preview-content iframe,
.ri-preview-content audio,
.ri-preview-content embed,
.ri-preview-content object {
    display: block;
    margin: 0 auto; /* 水平居中 */
    width: 100%; /* 宽度100%铺满容器 */
    height: auto; /* 保持宽高比 */
    min-height: 300px; /* 设置最小高度 */
}

/* 预览内容包装器居中 */
.preview-content-wrapper {
    text-align: center; /* 内容居中对齐 */
    display: flex;
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    min-height: 300px; /* 设置最小高度 */
    width: 100%;
}

.preview-content-wrapper video,
.preview-content-wrapper iframe,
.preview-content-wrapper audio,
.preview-content-wrapper embed,
.preview-content-wrapper object {
    display: block;
    margin: 0 auto; /* 水平居中 */
    width: 100%; /* 宽度100%铺满容器 */
    height: auto; /* 保持宽高比 */
    min-height: 300px; /* 设置最小高度 */
}

/* 预览控制按钮 */
.ri-preview-controls {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.ri-preview-btn,
.ri-stop-preview-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ri-preview-btn {
    background: #007bff;
    color: #fff;
}

.ri-preview-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.ri-preview-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.ri-stop-preview-btn {
    background: #dc3545;
    color: #fff;
}

.ri-stop-preview-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* 预览计时器 */
.ri-preview-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.ri-preview-timer i {
    color: #f39c12;
}

.time-remaining {
    font-weight: 600;
    color: #e74c3c;
}

/* 预览倒计时样式 */
.preview-timer {
    margin-top: 5px; /* 与播放器保持5px距离 */
    text-align: center;
}

.timer-text {
    font-size: 14px;
    color: #666;
}

.timer-remaining {
    font-weight: bold;
    color: #e74c3c !important; /* 倒计时数字用红色加粗 */
    font-size: 16px;
}

/* 预览提示信息 */
.ri-preview-info {
    margin-bottom: 15px;
    padding: 12px;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    font-size: 14px;
}

.ri-preview-info i {
    margin-right: 6px;
    color: #17a2b8;
}

/* 警告信息 */
.ri-preview-warning {
    margin-bottom: 15px;
    padding: 12px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 14px;
}

.ri-preview-warning i {
    margin-right: 6px;
    color: #f39c12;
}

/* 错误信息 */
.ri-preview-error {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    font-size: 14px;
}

.ri-preview-error i {
    margin-right: 6px;
    color: #dc3545;
}

/* 预览统计 */
.ri-preview-stats {
    margin-top: 10px;
    font-size: 12px;
    color: #6c757d;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.ri-preview-stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ri-preview-container {
        margin: 15px 0;
        padding: 15px;
    }
    
    .ri-preview-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .ri-preview-btn,
    .ri-stop-preview-btn {
        width: 100%;
        justify-content: center;
    }
    
    .ri-preview-timer {
        justify-content: center;
    }
    
    .ri-preview-stats {
        flex-direction: column;
        gap: 8px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ri-preview-content.show {
    animation: fadeIn 0.3s ease-out;
}

/* 加载状态 */
.ri-preview-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ri-preview-loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .ri-preview-container {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .ri-preview-content {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .ri-preview-info {
        background: #2c5282;
        color: #bee3f8;
        border-color: #3182ce;
    }
    
    .ri-preview-warning {
        background: #744210;
        color: #faf089;
        border-color: #d69e2e;
    }
    
    .ri-preview-error {
        background: #742a2a;
        color: #feb2b2;
        border-color: #e53e3e;
    }
}