/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局变量 */
:root {
    --primary-color: #6366f1;
    --primary-hover: #5a5cf0;
    --secondary-color: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #ffffff;
    --background-alt: #f8fafc;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* 基础样式 */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background-alt);
    min-height: 100vh;
}

/* 布局容器 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* 头部样式 */
.header {
    text-align: center;
    padding: 2rem 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary-color);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

/* 输入区域样式 */
.input-section {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1rem;
}

.input-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--primary-color);
}

#videoUrl {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s ease;
    background: var(--background);
    color: var(--text-primary);
}

#videoUrl:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

#videoUrl::placeholder {
    color: var(--text-muted);
}

/* 按钮样式 */
.parse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 3rem;
}

.parse-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.parse-btn:active {
    transform: translateY(0);
}

.parse-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* 错误提示 */
.error {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-lg);
    color: var(--error-color);
    font-weight: 500;
}

.error-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

/* 视频区域样式 */
.video-section {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.video-info {
    margin-bottom: 1.5rem;
}

/* 标题容器样式 */
.title-container {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.video-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
    margin: 0;
}

/* 复制标题按钮样式 */
.copy-title-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.copy-title-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-1px);
}

.copy-title-btn:active {
    transform: translateY(0);
}

.copy-title-icon {
    width: 1rem;
    height: 1rem;
}

/* 复制成功动画 */
.copy-title-btn.copied {
    border-color: var(--success-color);
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.copy-title-btn.copied .copy-title-icon {
    animation: copySuccess 0.3s ease;
}

@keyframes copySuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-icon {
    width: 1rem;
    height: 1rem;
}

/* 视频容器 */
.video-container {
    position: relative;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
}

#videoPlayer {
    width: 100%;
    height: auto;
    max-height: 70vh;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

.play-btn {
    width: 4rem;
    height: 4rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn:hover {
    background: white;
    transform: scale(1.1);
}

.play-icon {
    width: 1.5rem;
    height: 1.5rem;
    margin-left: 2px;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-buttons button {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--background);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn {
    background: var(--success-color) !important;
    color: white !important;
    border-color: var(--success-color) !important;
}

.download-btn:hover {
    background: #059669 !important;
    border-color: #059669 !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.open-video-btn {
    background: var(--warning-color) !important;
    color: white !important;
    border-color: var(--warning-color) !important;
}

.open-video-btn:hover {
    background: #d97706 !important;
    border-color: #d97706 !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.copy-btn:hover,
.reset-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 使用说明 */
.help-section {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.help-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.help-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-number {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.step-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
}

.footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        gap: 1.5rem;
    }

    .header {
        padding: 1rem 0;
    }

    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-section,
    .video-section,
    .help-section {
        padding: 1.5rem;
    }

    .help-steps {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        min-width: auto;
    }

    .video-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .title-container {
        gap: 0.5rem;
    }

    .copy-title-btn {
        width: 2rem;
        height: 2rem;
    }

    .copy-title-icon {
        width: 0.875rem;
        height: 0.875rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .input-section,
    .video-section,
    .help-section {
        padding: 1rem;
    }

    .step {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-section {
    animation: fadeIn 0.5s ease-out;
}

/* 按钮加载状态 */
.parse-btn.loading .btn-text {
    display: none;
}

.parse-btn.loading::after {
    content: '';
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 播放提示样式 */
.play-tip {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fef7cd 0%, #fef3c7 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-lg);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

.tip-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    color: #d97706;
}

.tip-icon svg {
    width: 100%;
    height: 100%;
}

.tip-content {
    flex: 1;
    color: #92400e;
}

.tip-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #92400e;
}

.tip-content p {
    font-size: 0.875rem;
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

.tip-content ul {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.tip-content li {
    margin-bottom: 0.25rem;
}

.tip-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: none;
    color: #92400e;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.tip-close:hover {
    background: rgba(146, 64, 14, 0.1);
    color: #78350f;
}

.tip-close svg {
    width: 1rem;
    height: 1rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .play-tip {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .tip-icon {
        width: 1.5rem;
        height: 1.5rem;
    }
    
    .tip-close {
        position: static;
        margin-top: 0.5rem;
        align-self: flex-end;
    }
} 