/* ============================================================
   Short Video Parser v2 — 结果和资源组件样式补全
   ============================================================ */

/* ========== 结果面板 ========== */
.result-panel {
    margin-top: 24px;
    padding: 32px;
}

.result-panel:not(.hidden) {
    animation: slideInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 批量面板 */
.batch-panel {
    padding: 0;
    overflow: hidden;
}

.batch-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: stretch;
    min-height: 450px;
}

.batch-list {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    gap: 10px;
    height: 100%;
    max-height: none;
    overflow: auto;
    padding: 16px;
    border-right: 1px solid var(--border-base);
    background: rgba(249, 250, 251, 0.6);
    backdrop-filter: var(--blur-sm);
}

.batch-item {
    position: relative;
    display: grid;
    gap: 6px;
    width: 100%;
    min-height: 80px;
    padding: 14px 44px 14px 14px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    color: var(--text);
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
}

.batch-item:hover,
.batch-item.active {
    border-color: var(--primary);
    background: white;
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.batch-item-title,
.batch-item-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-item-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.batch-item-meta {
    color: var(--text-muted);
    font-size: 13px;
}

.batch-item em {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.15);
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}

.batch-item.success em {
    color: var(--success);
    background: rgba(16, 185, 129, 0.12);
}

.batch-item.error em {
    color: var(--error);
    background: rgba(239, 68, 68, 0.12);
}

.batch-item.loading em {
    color: var(--warning);
    background: rgba(251, 146, 60, 0.12);
    animation: pulse 2s ease-in-out infinite;
}

.batch-retry {
    width: fit-content;
    margin-top: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-base);
    border-radius: 999px;
    color: var(--text);
    background: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.batch-retry:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.batch-retry:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.batch-detail {
    min-width: 0;
    padding: 32px;
}

.batch-empty {
    display: grid;
    min-height: 400px;
    place-items: center;
    color: var(--text-muted);
}

/* 加载卡片 */
.loading-card {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 20px;
}

.loading-card span {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-base);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-card strong {
    display: block;
    font-weight: 600;
    color: var(--text);
}

.loading-card p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

/* 错误框 */
.error-box {
    padding: 18px 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: var(--error);
    background: rgba(254, 242, 242, 0.8);
    backdrop-filter: var(--blur-sm);
}

.error-box p {
    margin: 8px 0 0;
    color: #dc2626;
    font-size: 13px;
}

.result-inline-error {
    margin-bottom: 20px;
}

/* ========== 结果布局 ========== */
.result-layout {
    display: grid;
    grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
    gap: 28px;
    align-items: stretch;
}

.result-layout-file {
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

/* ========== 媒体预览 ========== */
.preview-card {
    align-self: start;
    overflow: hidden;
    min-height: 320px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    background: #000;
    box-shadow: var(--inner-shadow);
}

.preview-video,
.preview-image {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 320px;
    max-height: 560px;
    object-fit: cover;
    background: #000;
}

.preview-image {
    height: auto;
    object-fit: cover;
}

.preview-audio {
    display: grid;
    align-content: center;
    gap: 20px;
    min-height: 320px;
    padding: 32px;
    background: linear-gradient(145deg,
        rgba(99, 102, 241, 0.08) 0%,
        rgba(255, 255, 255, 0.9) 100%);
}

.preview-audio strong,
.preview-audio span {
    display: block;
}

.preview-audio strong {
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.preview-audio span {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.preview-audio audio {
    width: 100%;
    margin-top: 8px;
}

.empty-preview {
    display: grid;
    min-height: 320px;
    place-items: center;
    color: var(--text-muted);
    font-size: 15px;
}

/* 文件预览 */
.preview-card-file {
    display: flex;
    min-height: 280px;
    padding: 28px;
    background: linear-gradient(145deg,
        rgba(99, 102, 241, 0.08) 0%,
        rgba(248, 250, 252, 0.95) 100%);
}

.file-preview-shell {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
}

.file-preview-badge {
    width: fit-content;
    padding: 6px 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 999px;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    font-size: 12px;
    font-weight: 800;
}

.file-preview-icon {
    display: grid;
    width: 90px;
    height: 108px;
    place-items: center;
    border: 2px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-lg);
    color: var(--primary);
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(245, 243, 255, 0.96) 100%);
    box-shadow: var(--shadow-lg);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.file-preview-copy h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(18px, 2.2vw, 26px);
    line-height: 1.3;
    font-weight: 700;
    word-break: break-word;
}

.file-preview-note {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.file-preview-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.file-preview-chips span {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--border-base);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--blur-sm);
    font-size: 12px;
    font-weight: 600;
}

.file-preview-chips strong {
    color: var(--text-muted);
    font-weight: 700;
}

/* ========== 结果信息 ========== */
.result-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 8px 0;
}

.platform-pill {
    width: fit-content;
    margin-bottom: 16px;
    padding: 6px 14px;
    border-radius: 999px;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.result-info h2 {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 16px;
    font-size: 32px;
    line-height: 1.25;
    letter-spacing: -0.01em;
    font-weight: 700;
    color: var(--text);
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.meta {
    margin: 6px 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.extra-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.extra-info span {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 14px;
    border: 1px solid var(--border-base);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: var(--blur-sm);
    font-size: 13px;
    font-weight: 600;
}

.extra-info strong {
    color: var(--text-muted);
    font-weight: 700;
}

/* 音乐播放器 */
.music-player {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-md);
    box-shadow: var(--shadow-md), var(--inner-highlight);
}

.music-player-main {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.music-player-cover {
    width: 80px;
    height: 80px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    object-fit: cover;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.12) 0%,
        rgba(139, 92, 246, 0.08) 100%);
    box-shadow: var(--shadow-md);
}

.music-player-body {
    min-width: 0;
}

.music-player-title {
    overflow: hidden;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.music-player-artist {
    overflow: hidden;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.music-player audio {
    width: 100%;
    margin-top: 10px;
    height: 36px;
}

/* 歌词框 */
.lyrics-box {
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    background: rgba(249, 250, 251, 0.6);
    backdrop-filter: var(--blur-sm);
    transition: all 0.3s ease;
}

.lyrics-box.open {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
}

.lyrics-toggle {
    display: block;
    width: 100%;
    border: 0;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text);
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lyrics-toggle::after {
    content: "";
    float: right;
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.3s ease;
}

.lyrics-box.open .lyrics-toggle::after {
    transform: rotate(225deg) translateY(-3px);
}

.lyrics-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.lyrics-box.open .lyrics-content {
    max-height: 300px;
    opacity: 1;
}

.lyrics-content pre {
    max-height: 220px;
    margin: 0;
    overflow: auto;
    padding: 0 16px 16px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* ========== 主要操作按钮 ========== */
.main-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.copy-main,
.download-all {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    color: var(--text);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-base);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.copy-main:hover,
.download-all:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.download-btn {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    color: white;
    background: var(--gradient-primary);
    border: 0;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md), 0 0 24px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.download-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-xl), 0 0 32px rgba(99, 102, 241, 0.5);
}

/* ========== 资源列表 ========== */
.resources {
    display: grid;
    gap: 14px;
    margin-top: 24px;
    max-height: 640px;
    overflow: auto;
    padding-right: 8px;
}

.resources::-webkit-scrollbar {
    width: 8px;
}

.resources::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 8px;
}

.resources-file {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

/* 资源组 */
.resource-group {
    overflow: hidden;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-md);
    box-shadow: var(--shadow-sm);
}

.resource-group-head {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-base);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: var(--blur-md);
}

.resource-group h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.resource-group-head span {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 13px;
}

.group-download {
    flex: 0 0 auto;
    min-width: 90px;
    padding: 8px 14px;
    border: 1px solid var(--border-base);
    border-radius: 999px;
    color: var(--text);
    background: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.group-download:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

/* 资源卡片 */
.resource-list {
    display: grid;
}

.resource-card {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-width: 0;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-base);
    transition: all 0.2s ease;
}

.resource-card:last-child {
    border-bottom: 0;
}

.resource-card:hover {
    background: rgba(249, 250, 251, 0.8);
}

.resource-preview {
    display: grid;
    place-items: center;
    width: 100px;
    height: 75px;
    overflow: hidden;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-sm);
    background: #f6f7f9;
}

.resource-preview img,
.resource-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.resource-meta {
    min-width: 0;
}

.resource-meta strong,
.resource-meta span {
    display: block;
}

.resource-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-weight: 600;
    font-size: 15px;
}

.resource-meta span {
    margin-top: 4px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.mini-download,
.resource-card button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 8px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mini-download {
    color: white;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-sm);
}

.mini-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.3);
}

.resource-card button {
    color: var(--text);
    background: white;
    border: 1px solid var(--border-base);
}

.resource-card button:hover {
    background: rgba(249, 250, 251, 0.8);
    border-color: var(--primary);
    color: var(--primary);
}

/* ========== 响应式 ========== */
@media (max-width: 880px) {
    .result-layout {
        grid-template-columns: 1fr;
    }

    .batch-layout {
        grid-template-columns: 1fr;
    }

    .batch-list {
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-base);
    }

    .batch-item {
        flex: 0 0 240px;
    }
}

@media (max-width: 640px) {
    .result-info h2 {
        font-size: 24px;
    }

    .music-player-main {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    .music-player-cover {
        width: 64px;
        height: 64px;
    }

    .resource-card {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .resource-preview {
        width: 100%;
        height: 200px;
    }

    .resource-actions {
        width: 100%;
    }

    .mini-download,
    .resource-card button {
        flex: 1;
    }

    .resources {
        max-height: 500px;
    }

    .batch-item {
        flex-basis: 200px;
    }
}
