/* 全局样式 */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    padding: 40px 0 30px;
}

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

.logo-icon {
    font-size: 48px;
    line-height: 1;
}

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

.subtitle {
    color: var(--text-light);
    font-size: 16px;
}

/* 主要内容区 */
.main {
    flex: 1;
}

/* 输入区域 */
.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;
    margin-bottom: 16px;
}

#urlInput {
    flex: 1;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.2s;
    background: var(--bg);
}

#urlInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#urlInput::placeholder {
    color: var(--text-light);
}

.btn-paste {
    width: 100%;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    white-space: nowrap;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-paste:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-paste:active {
    transform: translateY(0);
}

.btn-parse {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-parse:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-parse:active {
    transform: translateY(0);
}

.btn-parse:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* 解析状态提示 */
.parse-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--primary);
    font-size: 14px;
}

.parse-status .spinner {
    width: 16px;
    height: 16px;
    border-color: rgba(99, 102, 241, 0.3);
    border-top-color: var(--primary);
}

/* 平台标签 */
.platforms {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.platform-tag {
    padding: 6px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-light);
    transition: all 0.2s;
}

.platform-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.platform-tag[data-platform="douyin"] {
    --platform-color: #fe2c55;
}

.platform-tag[data-platform="kuaishou"] {
    --platform-color: #ff4906;
}

.platform-tag[data-platform="xiaohongshu"] {
    --platform-color: #ff2442;
}

.platform-tag[data-platform="bilibili"] {
    --platform-color: #00a1d6;
}

.platform-tag[data-platform="tiktok"] {
    --platform-color: #000000;
}

.platform-tag[data-platform="youtube"] {
    --platform-color: #ff0000;
}

.platform-tag[data-platform="weibo"] {
    --platform-color: #ff8200;
}

.platform-tag[data-platform="toutiao"] {
    --platform-color: #ff0000;
}

/* 错误提示 */
.error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-msg::before {
    content: "❌";
}

/* 解析结果 */
.result-section {
    margin-bottom: 24px;
}

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

.video-cover {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 比例 */
    background: #000;
    overflow: hidden;
}

.video-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.platform-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.platform-badge[data-platform="douyin"] {
    background: #fe2c55;
}

.platform-badge[data-platform="kuaishou"] {
    background: #ff4906;
}

.platform-badge[data-platform="xiaohongshu"] {
    background: #ff2442;
}

.platform-badge[data-platform="bilibili"] {
    background: #00a1d6;
}

.platform-badge[data-platform="weibo"] {
    background: #ff8200;
}

.platform-badge[data-platform="toutiao"] {
    background: #ff0000;
}

.video-info {
    padding: 20px;
}

.video-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-author {
    color: var(--text-light);
    font-size: 14px;
}

.download-section {
    padding: 0 20px 20px;
    text-align: center;
}

.btn-download {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-download:active {
    transform: translateY(0);
}

/* 下载进度条 */
.progress-container {
    margin-top: 12px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-light);
}

.download-tip {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-light);
}

/* 使用说明 */
.instructions {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.instructions h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text);
}

.instructions ol {
    padding-left: 20px;
    margin-bottom: 16px;
}

.instructions li {
    margin-bottom: 8px;
    color: var(--text-light);
    font-size: 14px;
}

.notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
}

.notice strong {
    display: block;
    margin-bottom: 4px;
}

/* 底部 */
.footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-light);
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 640px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 24px 0 20px;
    }

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

    .logo h1 {
        font-size: 24px;
    }

    .subtitle {
        font-size: 14px;
    }

    .input-section {
        padding: 16px;
    }

    #urlInput {
        padding: 12px 14px;
        font-size: 14px;
    }

    .btn-paste {
        padding: 14px 20px;
        font-size: 14px;
    }

    .btn-parse {
        padding: 12px 20px;
        font-size: 14px;
    }

    .platforms {
        gap: 8px;
    }

    .platform-tag {
        padding: 4px 12px;
        font-size: 12px;
    }

    .video-title {
        font-size: 16px;
    }

    .btn-download {
        padding: 12px 20px;
        font-size: 14px;
    }
}

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

.result-section {
    animation: fadeIn 0.3s ease-out;
}

.error-msg {
    animation: fadeIn 0.3s ease-out;
}

/* 加载状态 */
.btn-parse.loading .btn-text {
    display: none;
}

.btn-parse.loading .btn-loading {
    display: flex !important;
    align-items: center;
    gap: 8px;
}
