/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

/* ==================== 容器与布局 ==================== */
.container {
    max-width: 100%;
    padding: 20px;
}

/* ==================== 标题样式 ==================== */
h1 {
    font-size: 28px;
    color: #1a5c9d;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
}

h2 {
    font-size: 20px;
    color: #34495e;
    margin-bottom: 15px;
    font-weight: 500;
}

h3 {
    font-size: 16px;
    color: #34495e;
    margin-bottom: 15px;
}

/* ==================== 按钮基础样式 ==================== */
button {
    padding: 10px 20px;
    /* border: none; */
    border-radius: 6px;
    background: #cbcadc;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 按钮颜色变体 */
.btn-primary {
    background-color: #4a9eff;
    color: white;
}

.btn-primary:hover {
    background-color: #3a8eef;
    box-shadow: 0 2px 4px rgba(74, 158, 255, 0.3);
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #ff6b6b;
    color: white;
}

.btn-danger:hover {
    background-color: #ee5a5a;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-info {
    background-color: #2196F3;
    color: white;
}

.btn-info:hover {
    background-color: #0b7dda;
}

/* ==================== 标签页样式 ==================== */
.tab-container {
    margin-bottom: 20px;
}

.tab-buttons {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 10px 20px;
    background-color: #f8f9fa;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 0;
}

.tab-btn.active {
    background-color: white;
    color: #4a9eff;
    border-bottom-color: #4a9eff;
}

.tab-btn:hover:not(.active) {
    background-color: #e9ecef;
}

.tab-content {
    display: none;
    padding: 10px 0;
}

.tab-content.active {
    display: block;
}

/* ==================== 输入区域样式 ==================== */
.input-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.website-input,
#streamUrls {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

#streamUrls {
    height: 150px;
    font-family: inherit;
    resize: vertical;
}

.website-input:focus,
#streamUrls:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.helper-text {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 10px;
    background-color: #e7f3ff;
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 3px solid #4a9eff;
}

/* ==================== 选项区域样式 ==================== */
.options {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.pack-download-option,
.option-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.pack-download-option input[type="checkbox"],
.option-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.pack-download-option label,
.option-group label {
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

.option-group input,
.option-group select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.option-group input:focus,
.option-group select:focus {
    outline: none;
    border-color: #4a9eff;
}

/* ==================== 提取内容区域样式 ==================== */
.extracted-images-section {
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
}

/* 图片容器 */
.extracted-images-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* 视频容器 */
.extracted-videos-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* 预览卡片基础样式 */
.image-preview-card,
.video-preview-card {
    position: relative;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f8f9fa;
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-preview-card:hover,
.video-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 图片预览 */
.image-preview-wrapper {
    position: relative;
    padding-top: 100%;
    /* 1:1 宽高比 */
    overflow: hidden;
}

.image-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

/* 视频预览 */
.video-preview-wrapper {
    position: relative;
    padding-top: 56.25%;
    /* 16:9 宽高比 */
    overflow: hidden;
    background-color: #000;
}

.video-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a1a2e;
    color: #e0e0e0;
    cursor: pointer;
}

.video-placeholder-icon {
    font-size: 48px;
    opacity: 0.7;
}

/* 复选框 */
.image-checkbox,
.video-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
    accent-color: #4a9eff;
}

/* 内容信息 */
.image-url {
    padding: 8px;
    font-size: 12px;
    color: #6c757d;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    word-break: break-all;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-info {
    padding: 10px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.video-url {
    font-size: 12px;
    color: #6c757d;
    word-break: break-all;
    max-height: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 4px;
}

.video-meta {
    font-size: 11px;
    color: #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-type-badge {
    display: inline-block;
    padding: 2px 6px;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

/* 提取控制按钮 */
.extracted-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.extracted-controls button {
    font-size: 13px;
    padding: 8px 15px;
}

/* ==================== 下载区域样式 ==================== */
.download-section {
    margin-top: 20px;
}

/* 进度头部 */
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stats {
    font-size: 14px;
    color: #6c757d;
}

/* 进度条 */
.progress-container {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #4a9eff;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* 下载列表 */
.download-list {
    max-height: 395px;
    overflow-y: auto;
    padding: 10px 0;
}

.download-item {
    padding: 12px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #4a9eff;
    transition: all 0.3s;
}

.download-item.downloading {
    border-left-color: #4a9eff;
}

.download-item.completed {
    border-left-color: #28a745;
}

.download-item.failed {
    border-left-color: #dc3545;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.file-name {
    font-weight: 500;
    color: #495057;
    font-size: 14px;
    word-break: break-all;
    flex: 1;
    margin-right: 10px;
}

.item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

/* 状态标签 */
.status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: #e9ecef;
    color: #6c757d;
}

.status.downloading {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status.completed {
    background-color: #e8f5e9;
    color: #388e3c;
}

.status.failed {
    background-color: #ffebee;
    color: #d32f2f;
}

.status.skipped {
    color: #f57c00;
    background-color: #fff3e0;
}

.status.saved-link {
    color: #1976d2;
    font-weight: bold;
    background-color: #e3f2fd;
}

/* 单项进度条 */
.item-progress {
    width: 100%;
    height: 4px;
    background-color: #dee2e6;
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

.item-progress-bar {
    height: 100%;
    background-color: #4a9eff;
    transition: width 0.3s ease;
}

/* 操作按钮 */
.item-actions {
    margin: 0;
    display: flex;
    justify-content: flex-end;
}

.open-file-btn,
.view-button {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.open-file-btn {
    background-color: #2196F3;
    color: white;
    margin-left: 5px;
}

.open-file-btn:hover {
    background-color: #0b7dda;
}

.view-button {
    background: #2196f3;
    color: white;
}

.view-button:hover {
    background: #1976d2;
}

.open-file-btn:active,
.view-button:active {
    transform: translateY(1px);
}

/* 状态按钮组合 */
.status-completed.has-open-button {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ==================== 统计信息样式 ==================== */
.saved-count {
    color: #1976d2;
    font-weight: bold;
    font-size: 1.1em;
}

#failedFiles {
    color: #c62828;
    font-weight: bold;
}

#skippedFiles {
    color: #f57c00;
    font-weight: bold;
}

#completedFiles {
    color: #2e7d32;
    font-weight: bold;
}

/* ==================== 完成状态提示样式 ==================== */
.completion-status {
    margin-top: 20px;
    padding: 20px;
    background-color: #f0f8ff;
    border: 1px solid #b8daff;
    border-radius: 8px;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-in-out;
}

.completion-status.visible {
    opacity: 1;
    transform: translateY(0);
}

.status-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
}

.completion-status .status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 16px;
    margin-right: 8px;
}

.completion-status .status-icon.success {
    background-color: #4caf50;
}

.completion-status .status-icon.partial {
    background-color: #ff9800;
}

.completion-status .failed-count {
    color: #c62828;
    font-weight: bold;
}

.completion-status .skipped-count {
    color: #f57c00;
    font-weight: bold;
}

.completion-status .success-count {
    color: #2e7d32;
    font-weight: bold;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.primary-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.primary-button:hover:not(:disabled) {
    background-color: #45a049;
}

.primary-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.secondary-button {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.secondary-button:hover:not(:disabled) {
    background-color: #0b7dda;
}

.secondary-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* ==================== 信息说明区域样式 ==================== */
.info-section {
    margin: 20px 0;
    padding: 0;
}

.info-details {
    width: 100%;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.info-details summary {
    padding: 12px 16px;
    font-weight: 500;
    color: #495057;
    background-color: #f1f3f4;
    cursor: pointer;
    outline: none;
    user-select: none;
    transition: background-color 0.3s;
}

.info-details summary:hover {
    background-color: #e9ecef;
}

.info-details summary::-webkit-details-marker {
    float: right;
    color: #6c757d;
}

.info-content {
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
    background-color: white;
}

.info-content p {
    margin-bottom: 12px;
}

.info-content ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.info-content li {
    margin-bottom: 8px;
}

.info-content strong {
    color: #4a9eff;
    font-weight: 600;
}

/* ==================== 加载状态样式 ==================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a9eff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* ==================== 空状态提示 ==================== */
.no-images-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

/* ==================== 错误提示样式 ==================== */
.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-top: 15px;
    border-radius: 6px;
    background-color: #ffebee;
    border-left: 4px solid #f44336;
    transition: opacity 0.5s ease, transform 0.3s ease;
}

.error-message .error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #f44336;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.error-message .error-text {
    font-weight: 500;
    color: #333;
}

/* ==================== 淡入淡出动画 ==================== */
.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.completion-status.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.error-message.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

/* ==================== 预览模态框样式 ==================== */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90vh;
    width: 800px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease;
    z-index: 10;
}

.close-button:hover {
    color: #333;
}

.preview-title {
    margin: 0;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    color: #333;
}

.preview-container {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    max-height: calc(90vh - 100px);
    overflow: auto;
}

.preview-container img,
.preview-container video {
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ==================== 滚动条样式 ==================== */
.extracted-images-container::-webkit-scrollbar,
.download-list::-webkit-scrollbar {
    width: 6px;
}

.extracted-images-container::-webkit-scrollbar-track,
.download-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.extracted-images-container::-webkit-scrollbar-thumb,
.download-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.extracted-images-container::-webkit-scrollbar-thumb:hover,
.download-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 768px) {

    /* 容器 */
    .container {
        padding: 20px 15px;
    }

    /* 标题 */
    h1 {
        font-size: 24px;
    }

    /* 选项 */
    .options {
        flex-direction: column;
        gap: 10px;
    }

    /* 进度头部 */
    .progress-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* 按钮 */
    button {
        margin-bottom: 6px;
        padding: 8px 8px;
    }

    /* 标签页 */
    .tab-buttons {
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 8px 14px;
        font-size: 12px;
        margin-right: 5px;
    }

    /* 图片容器 */
    .extracted-images-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    /* 视频容器 */
    .extracted-videos-container {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 10px;
    }

    /* 控制按钮 */
    .extracted-controls {
        flex-direction: column;
    }

    .extracted-controls button {
        width: 100%;
        margin-bottom: 5px;
    }

    /* 操作按钮组 */
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }

    /* 模态框 */
    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .preview-container {
        padding: 15px;
        min-height: 200px;
    }
}

@media (max-width: 480px) {

    /* 容器 */
    .container {
        padding: 12px;
    }

    /* 标题 */
    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 16px;
    }

    /* 输入区域 */
    .input-section {
        padding: 14px;
        margin-bottom: 20px;
    }

    label {
        font-size: 13px;
    }

    .helper-text {
        font-size: 11px;
        padding: 6px 10px;
    }

    #streamUrls {
        height: 120px;
        padding: 10px;
        font-size: 13px;
    }

    /* 选项 */
    .option-group input,
    .option-group select {
        padding: 5px 8px;
        font-size: 12px;
    }

    /* 图片容器 */
    .extracted-images-container {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 6px;
        padding: 6px;
    }

    /* 视频容器 */
    .extracted-videos-container {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 6px;
    }

    /* 图片URL */
    .image-preview-card .image-url {
        font-size: 10px;
        padding: 4px;
    }

    /* 下载项 */
    .download-item {
        padding: 8px;
    }

    .file-name {
        font-size: 12px;
    }

    .stats {
        font-size: 12px;
    }

    /* 标签页按钮 */
    .tab-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}