/* ============================================
   多平台视频下载器 - 样式表
   ============================================ */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #1a1a3e;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6c6c8a;
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --gradient-1: linear-gradient(135deg, #6c63ff, #e63e6d);
    --gradient-2: linear-gradient(135deg, #00d2ff, #3a7bd5);
    --gradient-3: linear-gradient(135deg, #f093fb, #f5576c);
    --success: #00e676;
    --warning: #ffab40;
    --error: #ff5252;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.4);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 粒子背景 */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--accent);
    animation: floatUp linear infinite;
    opacity: 0;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* 主容器 */
.container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 42px;
    filter: drop-shadow(0 4px 12px var(--accent-glow));
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.logo h1 {
    font-size: 42px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    letter-spacing: 2px;
}

/* 章节标题 */
.section-title {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    letter-spacing: 1px;
}

/* 平台选择 */
.platforms-section {
    margin-bottom: 32px;
}

.platforms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.platform-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
    color: var(--text-secondary);
    user-select: none;
}

.platform-tag:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.platform-tag.active {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

.platform-tag .platform-icon {
    font-size: 18px;
}

.platform-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* 下载区域 */
.download-section {
    margin-bottom: 32px;
}

.input-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.input-group:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 30px var(--accent-glow);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.input-icon {
    position: absolute;
    left: 16px;
    font-size: 20px;
    z-index: 2;
    pointer-events: none;
}

#videoUrl {
    width: 100%;
    padding: 16px 50px 16px 50px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: all var(--transition);
    font-family: inherit;
}

#videoUrl::placeholder {
    color: var(--text-muted);
}

#videoUrl:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.clear-btn {
    position: absolute;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.clear-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 选项行 */
.options-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.option-label {
    color: var(--text-secondary);
    font-size: 14px;
}

#qualitySelect {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

#qualitySelect:focus {
    border-color: var(--accent);
}

.checkbox-item {
    position: relative;
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: inline-block;
    transition: all var(--transition);
    position: relative;
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* 下载按钮 */
.download-btn {
    width: 100%;
    padding: 16px 32px;
    background: var(--gradient-1);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.download-btn:disabled::before {
    display: none;
}

.download-btn.loading {
    pointer-events: none;
}

.download-btn.loading .btn-text {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.btn-icon {
    font-size: 22px;
}

/* 进度区域 */
.progress-section {
    margin-bottom: 32px;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.progress-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-percent {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,0.3) 50%,
        transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 视频信息 */
.video-info {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.info-thumbnail {
    width: 120px;
    height: 68px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    background-color: var(--bg-card);
}

.info-details {
    flex: 1;
    min-width: 0;
}

.info-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-meta {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* 下载操作按钮 */
.download-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    border-radius: var(--radius-xs);
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    border: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.download-file-btn {
    background: var(--gradient-2);
    color: white;
}

.download-file-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 210, 255, 0.3);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 500;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #1b5e20;
    color: var(--success);
    border: 1px solid var(--success);
}

.toast.error {
    background: #5e1b1b;
    color: var(--error);
    border: 1px solid var(--error);
}

.toast.info {
    background: #1a237e;
    color: #64b5f6;
    border: 1px solid #64b5f6;
}

/* 帮助说明 */
.help-section {
    margin-bottom: 40px;
}

.help-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.help-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    transition: all var(--transition);
}

.help-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.help-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
}

.help-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.help-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

.footer p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 2;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 20px 16px;
    }

    .logo h1 {
        font-size: 32px;
    }

    .logo-icon {
        font-size: 32px;
    }

    .subtitle {
        font-size: 14px;
    }

    .input-group {
        padding: 16px;
    }

    #videoUrl {
        font-size: 14px;
        padding: 14px 44px 14px 44px;
    }

    .options-row {
        flex-direction: column;
        gap: 12px;
    }

    .download-btn {
        font-size: 16px;
        padding: 14px 24px;
    }

    .help-cards {
        grid-template-columns: 1fr;
    }

    .video-info {
        flex-direction: column;
    }

    .info-thumbnail {
        width: 100%;
        height: 160px;
    }

    .download-actions {
        flex-direction: column;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 选中文本美化 */
::selection {
    background: var(--accent);
    color: white;
}

/* ============================================
   用户区域
   ============================================ */
.user-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.auth-btn {
    padding: 8px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
}

.auth-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.auth-btn.primary {
    background: var(--gradient-1);
    border: none;
    color: white;
}

.auth-btn.primary:hover {
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-2px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.user-icon {
    font-size: 20px;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.user-plan {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 50px;
    font-weight: 600;
}

.user-plan.free {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.user-plan.pro {
    background: linear-gradient(135deg, #f5af19, #f12711);
    color: white;
}

.user-quota {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 50px;
    font-weight: 500;
}

.user-quota.free {
    background: rgba(0, 210, 255, 0.1);
    color: #00d2ff;
}

.user-quota.empty {
    background: rgba(255, 82, 82, 0.15);
    color: var(--error);
}

.user-quota.pro {
    background: rgba(0, 230, 118, 0.1);
    color: var(--success);
}

.upgrade-btn {
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #f5af19, #f12711);
    border: none;
    color: white;
    transition: all var(--transition);
    font-family: inherit;
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 175, 25, 0.4);
}

.logout-btn {
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all var(--transition);
    font-family: inherit;
}

.logout-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

/* ============================================
   模态弹窗
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 90%;
    max-width: 420px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.modal-input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all var(--transition);
    font-family: inherit;
}

.modal-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-input::placeholder {
    color: var(--text-muted);
}

.modal-submit {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: var(--gradient-1);
    border: none;
    border-radius: var(--radius-xs);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.modal-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.modal-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.modal-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.modal-switch a:hover {
    text-decoration: underline;
}

/* ============================================
   升级弹窗
   ============================================ */
.upgrade-modal {
    max-width: 600px;
    padding: 36px;
}

.upgrade-header {
    text-align: center;
    margin-bottom: 28px;
}

.upgrade-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.upgrade-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.upgrade-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upgrade-plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px 20px;
    text-align: center;
    position: relative;
    transition: all var(--transition);
}

.plan-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.plan-price {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 16px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.plan-price span {
    font-size: 14px;
    font-weight: 400;
    -webkit-text-fill-color: var(--text-secondary);
}

.plan-card ul {
    list-style: none;
    text-align: left;
    margin-bottom: 20px;
}

.plan-card li {
    font-size: 14px;
    padding: 6px 0;
    color: var(--text-secondary);
}

.plan-card li::before {
    content: "✓ ";
    color: var(--success);
}

.pro-plan {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(108, 99, 255, 0.1), var(--bg-card));
}

.plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 16px;
    background: var(--gradient-1);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.upgrade-pro-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f5af19, #f12711);
    border: none;
    border-radius: var(--radius-xs);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.upgrade-pro-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(245, 175, 25, 0.4);
}

.upgrade-pro-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 600px) {
    .upgrade-plans {
        grid-template-columns: 1fr;
    }
    .modal {
        padding: 28px 22px;
    }
}