/* ========== CSS Variables ========== */
:root {
    --primary-color: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #4F46E5;
    --secondary-color: #EC4899;
    --accent-color: #F59E0B;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    
    --bg-color: #0F172A;
    --bg-secondary: #1E293B;
    --card-bg: #1E293B;
    --card-border: rgba(255,255,255,0.08);
    
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
    
    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
    --gradient-card: linear-gradient(145deg, rgba(30,41,59,0.9) 0%, rgba(15,23,42,0.9) 100%);
}

/* ========== Base Styles ========== */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

html {
    scroll-behavior: smooth;
}

body { 
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; 
    background: var(--bg-color);
    background-image: 
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary); 
    min-height: 100vh;
    line-height: 1.6;
}

/* ========== Layout ========== */
.app-container { 
    max-width: 480px; 
    margin: 0 auto; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* PC 端适配 */
@media (min-width: 768px) {
    .app-container {
        max-width: 640px;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 720px;
    }
    
    body {
        padding: 40px 20px;
    }
    
    .app-header {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    
    .main-content {
        background: var(--card-bg);
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        border: 1px solid var(--card-border);
        border-top: none;
    }
}

/* ========== Header ========== */
.app-header { 
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 20px;
    position: sticky; 
    top: 0; 
    z-index: 100; 
    border-bottom: 1px solid var(--card-border);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 720px;
    margin: 0 auto;
}

.app-header h1 { 
    font-size: 20px; 
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-settings {
    font-size: 16px;
    padding: 4px 8px;
    text-decoration: none;
}

.btn-logout {
    font-size: 13px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-radius: var(--radius-sm);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

.main-content { 
    padding: 24px 20px; 
    flex: 1;
}

/* ========== Footer ========== */
.app-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.app-footer p {
    margin: 0;
}

.btn-donate {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-donate:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-donate:active {
    transform: scale(0.98);
}

/* Donate Modal */
.donate-modal-content {
    max-width: 320px;
    padding: 24px;
    text-align: center;
}

.donate-image {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ========== Cards ========== */
.card { 
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius); 
    padding: 24px; 
    margin-bottom: 20px; 
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow);
    border-color: rgba(255,255,255,0.12);
}

/* ========== Input Area ========== */
.input-group { position: relative; }

textarea { 
    width: 100%; 
    height: 120px; 
    padding: 16px; 
    border: 2px solid var(--card-border);
    border-radius: var(--radius-sm); 
    resize: none; 
    font-size: 15px; 
    font-family: inherit; 
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    transition: all 0.3s ease;
    line-height: 1.5;
}

textarea::placeholder {
    color: var(--text-muted);
}

textarea:focus { 
    border-color: var(--primary-color);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.input-actions { 
    display: flex; 
    justify-content: flex-start;
    gap: 8px;
    margin-top: 12px; 
}

.btn-link { 
    background: rgba(99, 102, 241, 0.1);
    border: none; 
    color: var(--primary-light);
    font-size: 14px; 
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-link:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
}

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

.btn-link-danger { 
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.btn-link-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.task-actions { 
    display: flex; 
    gap: 8px; 
}

/* ========== Buttons ========== */
.btn { 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px; 
    border-radius: var(--radius-sm); 
    border: none; 
    font-size: 16px; 
    font-weight: 600; 
    cursor: pointer; 
    text-align: center; 
    text-decoration: none; 
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn:active { 
    transform: scale(0.98);
}

.btn-primary { 
    background: var(--gradient-primary);
    color: white; 
    width: 100%; 
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.btn-primary:disabled { 
    opacity: 0.5; 
    cursor: not-allowed;
    transform: none;
}

.btn-secondary { 
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-sm { 
    padding: 8px 16px; 
    font-size: 13px; 
    background: var(--primary-color); 
    color: white; 
    border-radius: var(--radius-sm); 
}

.btn-nas { 
    background: var(--gradient-primary);
    color: white; 
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-block { display: block; width: 100%; }

/* ========== Loading ========== */
.loading { 
    display: none; 
    text-align: center; 
    padding: 40px 20px;
}

.spinner { 
    width: 40px; 
    height: 40px; 
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--primary-color);
    border-radius: 50%; 
    animation: spin 0.8s linear infinite; 
    margin: 0 auto 16px;
}

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

/* ========== Result Card ========== */
.result-card {
    animation: slideUp 0.4s ease;
}

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

.result-header { 
    display: flex; 
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px; 
}

.platform-tag { 
    font-size: 11px; 
    font-weight: 700;
    text-transform: uppercase; 
    padding: 4px 10px; 
    border-radius: 20px; 
    color: white; 
    background: var(--text-muted);
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.platform-tag.douyin { 
    background: linear-gradient(135deg, #000 0%, #333 100%);
}

.platform-tag.redbook { 
    background: linear-gradient(135deg, #FF2442 0%, #FF6B81 100%);
}

.platform-tag.bilibili { 
    background: linear-gradient(135deg, #FB7299 0%, #FF9AB4 100%);
}

.title { 
    font-size: 17px; 
    font-weight: 600; 
    line-height: 1.5;
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden;
    flex: 1;
}

.author-info { 
    font-size: 14px; 
    color: var(--text-secondary); 
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========== Video ========== */
.video-wrapper video { 
    width: 100%; 
    border-radius: var(--radius-sm); 
    background: #000; 
    max-height: 400px;
}

/* ========== Image Grid ========== */
.image-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 10px;
}

@media (min-width: 768px) {
    .image-grid {
        gap: 12px;
    }
}

.image-item { 
    position: relative; 
    aspect-ratio: 1; 
    display: flex; 
    flex-direction: column;
}

.image-item .image-wrapper { 
    flex: 1;
    position: relative; 
    overflow: hidden; 
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
}

.image-item .image-wrapper img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    cursor: pointer; 
    transition: all 0.4s ease;
}

.image-item .image-wrapper:hover img { 
    transform: scale(1.1);
}

.image-item .image-wrapper::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 24px;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.image-item .image-wrapper:hover::after {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.image-item-no-btn { aspect-ratio: 1; }
.image-item-no-btn .image-wrapper { 
    flex: 1; 
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
}

/* ========== Task List ========== */
.task-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}

.task-list-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.task-item { 
    border-bottom: 1px solid var(--card-border);
    padding: 16px 0;
    transition: all 0.2s ease;
}

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

.task-item:hover {
    background: rgba(99, 102, 241, 0.05);
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: var(--radius-sm);
}

.task-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    gap: 12px;
}

.task-title { 
    font-size: 14px; 
    font-weight: 500; 
    margin-bottom: 8px; 
    white-space: nowrap; 
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-source {
    flex-shrink: 0;
    font-size: 14px; 
    text-overflow: ellipsis; 
    flex: 1;
    color: var(--text-primary);
}

.btn-delete { 
    width: 28px; 
    height: 28px; 
    border: none; 
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-radius: 50%; 
    font-size: 16px; 
    cursor: pointer; 
    flex-shrink: 0; 
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover { 
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

.task-meta { 
    font-size: 12px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
}

.task-time { color: var(--text-muted); }

.status-badge { 
    padding: 4px 10px; 
    border-radius: 20px; 
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-pending { 
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

.status-processing { 
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status-completed { 
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.status-error { 
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.task-error { 
    color: var(--danger-color); 
    font-size: 12px; 
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
}

/* ========== Image Preview Modal ========== */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    z-index: 1000;
}

.modal.active { 
    display: flex; 
    align-items: center; 
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
}

.modal-content { 
    position: relative; 
    max-width: 95vw; 
    max-height: 90vh; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    z-index: 1001;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.9);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close { 
    position: absolute; 
    top: -50px; 
    right: 0; 
    width: 44px; 
    height: 44px; 
    background: rgba(255,255,255,0.1);
    border: none; 
    color: white; 
    font-size: 24px; 
    border-radius: 50%; 
    cursor: pointer; 
    z-index: 1002;
    transition: all 0.2s ease;
}

.modal-close:hover { 
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.modal-content img { 
    max-width: 100%; 
    max-height: 75vh; 
    object-fit: contain; 
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-actions { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 24px; 
    margin-top: 20px;
}

.modal-nav-btn { 
    width: 52px; 
    height: 52px; 
    background: rgba(255,255,255,0.1);
    border: none; 
    color: white; 
    font-size: 28px; 
    border-radius: 50%; 
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-nav-btn:hover { 
    background: var(--primary-color);
    transform: scale(1.1);
}

.modal-nav-btn:disabled { 
    opacity: 0.3; 
    cursor: not-allowed;
    transform: none;
}

.image-counter { 
    color: white; 
    font-size: 15px; 
    min-width: 80px; 
    text-align: center;
    font-weight: 500;
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 20px;
}

body.modal-open { overflow: hidden; }

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ========== Utilities ========== */
.text-sm { font-size: 13px; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }

.error-card { 
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger-color); 
    text-align: center;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========== Selection ========== */
::selection {
    background: var(--primary-color);
    color: white;
}

/* ========== Create User Modal ========== */
.modal-dialog {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group:last-of-type {
    margin-bottom: 0;
}

.modal-body .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-body .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--card-border);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

.modal-body .form-group input:focus {
    border-color: var(--primary-color);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.modal-body .form-group input::placeholder {
    color: var(--text-muted);
}

.modal-body .error-msg {
    color: var(--danger-color);
    font-size: 14px;
    text-align: center;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    display: none;
}

.modal-body .error-msg.show {
    display: block;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    background: rgba(15, 23, 42, 0.3);
}

.modal-footer .btn {
    min-width: 80px;
    white-space: nowrap;
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ========== Dropdown Menu ========== */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.menu-icon {
    font-size: 18px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.dropdown-item .item-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.dropdown-item-danger {
    color: var(--danger-color);
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.dropdown-divider {
    height: 1px;
    background: var(--card-border);
    margin: 4px 0;
}

/* ========== Tab Navigation ========== */
.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 6px;
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ========== Batch Parse Styles ========== */
.batch-phase {
    animation: fadeIn 0.3s ease;
}

#batchUrlInput {
    height: 200px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
}

.link-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Progress Bar */
.batch-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.progress-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-light);
}

.progress-bar-wrapper {
    height: 8px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-percent {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Batch Parsing List */
.batch-parsing-list {
    max-height: 400px;
    overflow-y: auto;
}

.batch-parsing-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
}

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

.parsing-status-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.parsing-status-icon.success { color: var(--success-color); }
.parsing-status-icon.parsing { 
    color: var(--primary-light);
    animation: pulse 1.5s ease-in-out infinite;
}
.parsing-status-icon.pending { color: var(--text-muted); }
.parsing-status-icon.error { color: var(--danger-color); }

.parsing-item-content {
    flex: 1;
    min-width: 0;
}

.parsing-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parsing-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.parsing-item-loader {
    height: 4px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.parsing-item-loader::after {
    content: '';
    display: block;
    height: 100%;
    width: 30%;
    background: var(--primary-color);
    border-radius: 2px;
    animation: loadingSlide 1s ease-in-out infinite;
}

@keyframes loadingSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Batch Result Styles */
.batch-result-header {
    padding: 16px 20px;
}

.result-summary {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.result-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Custom Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--card-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-wrapper:hover .checkmark {
    border-color: var(--primary-light);
}

/* Batch Result List */
.batch-result-list {
    max-height: 500px;
    overflow-y: auto;
}

.batch-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.batch-result-item:hover {
    background: rgba(99, 102, 241, 0.05);
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    border-radius: var(--radius-sm);
}

.batch-result-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.result-item-checkbox {
    flex-shrink: 0;
    margin-top: 2px;
}

.result-item-content {
    flex: 1;
    min-width: 0;
}

.result-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.result-item-platform {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
    background: var(--text-muted);
    flex-shrink: 0;
}

.result-item-platform.douyin { background: #000; }
.result-item-platform.redbook { background: #FF2442; }
.result-item-platform.bilibili { background: #FB7299; }

.result-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.result-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-item-type {
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-item-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-retry {
    background: rgba(99, 102, 241, 0.1);
    border: none;
    color: var(--primary-light);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-retry:hover {
    background: rgba(99, 102, 241, 0.2);
}

.result-item-error {
    font-size: 12px;
    color: var(--danger-color);
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
}

/* Batch Item Action Buttons */
.batch-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
}

.btn-action-save {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

.btn-action-save:hover {
    background: rgba(16, 185, 129, 0.25);
}

.btn-action-nas {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.btn-action-nas:hover {
    background: rgba(99, 102, 241, 0.25);
}

/* Batch Bottom Actions */
.batch-bottom-actions {
    margin-top: 20px;
}

/* ========== Batch Task Display (Expandable) ========== */
.task-item.batch-task {
    cursor: pointer;
}

.task-item.batch-task .task-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-expand-icon {
    font-size: 12px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.task-item.batch-task.expanded .task-expand-icon {
    transform: rotate(90deg);
}

.batch-subtasks {
    display: none;
    margin-top: 12px;
    padding-left: 20px;
    border-left: 2px solid var(--card-border);
}

.task-item.batch-task.expanded .batch-subtasks {
    display: block;
}

.batch-subtask-item {
    padding: 8px 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px dashed var(--card-border);
}

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

.subtask-title {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 12px;
}

.subtask-status {
    font-size: 12px;
    flex-shrink: 0;
}

.subtask-status.success { color: var(--success-color); }
.subtask-status.processing { color: var(--primary-light); }
.subtask-status.error { color: var(--danger-color); }
.subtask-status.pending { color: var(--text-muted); }

/* ========== License / Activation Styles ========== */

/* 激活状态按钮（Header） */
.btn-license {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

.btn-license:hover {
    transform: scale(1.05);
}

.btn-license.activated {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.btn-license.trial {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.btn-license.expired {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
    animation: pulse 2s ease-in-out infinite;
}

/* 返回按钮 */
.back-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
    min-width: 60px;
}

.back-btn:hover {
    color: var(--text-primary);
}

/* 激活状态卡片 */
.activation-status-card {
    padding: 0;
    overflow: hidden;
}

.status-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.status-loading .spinner {
    margin-bottom: 12px;
}

.status-content {
    padding: 0;
}

.activation-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
}

.activation-status .status-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.activation-status .status-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activation-status .status-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activation-status .status-value {
    font-size: 20px;
    font-weight: 700;
}

.activation-status.activated {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.activation-status.activated .status-value {
    color: var(--success-color);
}

.activation-status.trial {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.activation-status.trial .status-value {
    color: var(--warning-color);
}

.activation-status.expired {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.activation-status.expired .status-value {
    color: var(--danger-color);
}

.trial-remaining {
    font-size: 14px;
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    flex-shrink: 0;
}

.expired-notice {
    font-size: 13px;
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 500;
    flex-shrink: 0;
}

.activated-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* 设备码盒子 */
.device-id-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-top: 12px;
}

.device-id {
    flex: 1;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-light);
    letter-spacing: 1px;
}

.btn-copy {
    width: 40px;
    height: 40px;
    background: rgba(99, 102, 241, 0.15);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
}

.btn-copy:active {
    transform: scale(0.95);
}

/* 卡片标题和描述 */
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* 成功消息 */
.success-message {
    text-align: center;
    padding: 20px 0;
}

.success-message .success-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.success-message h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.success-message p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* 帮助卡片 */
.help-card {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
}

.help-list {
    margin: 12px 0 0 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 2;
}

.help-list li {
    padding-left: 8px;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 41, 59, 0.95);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
}

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

/* ========== Activation Input Card (Enhanced) ========== */
.activation-input-card {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.15) 0%, rgba(236, 72, 153, 0.1) 100%);
    border: 2px solid rgba(99, 102, 241, 0.3);
    padding: 0;
    overflow: hidden;
}

.activation-input-header {
    text-align: center;
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.activation-input-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.activation-input-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.activation-input-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.activation-input-body {
    padding: 24px;
}

.license-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 20px;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    letter-spacing: 3px;
    text-align: center;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(99, 102, 241, 0.4);
    border-radius: var(--radius);
    color: var(--primary-light);
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.license-input::placeholder {
    color: var(--text-muted);
    letter-spacing: 2px;
    font-weight: 400;
}

.license-input:focus {
    border-color: var(--primary-color);
    background: rgba(15, 23, 42, 1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), 0 0 20px rgba(99, 102, 241, 0.15);
    outline: none;
}

.activation-error {
    color: var(--danger-color);
    font-size: 14px;
    text-align: center;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: none;
}

.activation-error.show {
    display: block;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.btn-activate {
    width: 100%;
    padding: 16px 28px;
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-activate::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 ease;
}

.btn-activate:hover::before {
    left: 100%;
}

.btn-activate:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

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

.btn-activate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-activate .btn-icon {
    font-size: 20px;
}
