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

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

/* ===== 头部 ===== */
.header {
    text-align: center;
    padding: 32px 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 36px;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ===== 输入区域 ===== */
.input-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

.input-wrapper input {
    flex: 1;
    height: 48px;
    padding: 0 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg);
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-wrapper input::placeholder {
    color: #94a3b8;
}

#parseBtn {
    height: 48px;
    padding: 0 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
}

#parseBtn:hover {
    background: var(--primary-hover);
}

#parseBtn:active {
    transform: scale(0.97);
}

#parseBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

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

.platform-tags {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tag-douyin { background: #fef2f2; color: #dc2626; }
.tag-kuaishou { background: #fff7ed; color: #ea580c; }
.tag-xiaohongshu { background: #fef2f2; color: #e11d48; }
.tag-shipinhao { background: #f0fdf4; color: #16a34a; }

.input-tips {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== 结果区域 ===== */
.result-section {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.video-info {
    display: flex;
    gap: 16px;
    padding: 20px;
    align-items: flex-start;
}

.video-cover {
    width: 140px;
    height: 186px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg);
}

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

.video-detail {
    flex: 1;
    min-width: 0;
}

.video-detail h3 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.video-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== 下载链接 ===== */
.download-links {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
}

.download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    margin-bottom: 8px;
    transition: background 0.2s;
}

.download-item:last-child {
    margin-bottom: 0;
}

.download-item:hover {
    background: var(--primary-light);
}

.download-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.download-label .quality {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    font-weight: 400;
}

.download-label .quality.hd {
    background: var(--success);
}

.dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.dl-btn-primary {
    background: var(--primary);
    color: #fff;
}

.dl-btn-primary:hover {
    background: var(--primary-hover);
}

.dl-btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.dl-btn-outline:hover {
    background: var(--primary-light);
}

.copy-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== 历史记录 ===== */
.history-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.section-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.clear-btn {
    font-size: 13px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.clear-btn:hover {
    background: var(--bg);
    color: var(--danger);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 32px;
    font-size: 14px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.history-item:hover {
    background: var(--bg);
}

.history-item:last-child {
    border-bottom: none;
}

.history-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.history-time {
    font-size: 12px;
    color: #94a3b8;
    flex-shrink: 0;
}

/* ===== 页脚 ===== */
.footer {
    text-align: center;
    padding: 24px 0 0;
    color: #94a3b8;
    font-size: 13px;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    transition: transform 0.3s ease;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .logo h1 { font-size: 22px; }
    .input-wrapper { flex-direction: column; }
    #parseBtn { width: 100%; height: 44px; }
    .video-info { flex-direction: column; }
    .video-cover { width: 100%; height: 200px; }
    .download-item { flex-direction: column; gap: 8px; align-items: flex-start; }
}
