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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #0f1923;
    color: #e0e0e0;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

.header {
    background: linear-gradient(135deg, #1a2a3a, #0d1b2a);
    border-bottom: 1px solid #2a3a4a;
    padding: 16px 0;
    margin-bottom: 24px;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d4ff, #0099ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.node-info {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-primary {
    background: #0055ff22;
    color: #00d4ff;
    border: 1px solid #0055ff44;
}

.badge-secondary {
    background: #00ff8822;
    color: #00ff88;
    border: 1px solid #00ff8844;
}

.card {
    background: #1a2a3a;
    border: 1px solid #2a3a4a;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: #c0d0e0;
}

.form-inline {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.input-url {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    background: #0d1b2a;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.input-url:focus {
    outline: none;
    border-color: #0099ff;
}

.input-filename {
    width: 160px;
    padding: 10px 14px;
    background: #0d1b2a;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.form-grid input, .form-grid select {
    padding: 10px 14px;
    background: #0d1b2a;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.form-grid select {
    cursor: pointer;
}

.form-grid input:focus, .form-grid select:focus {
    outline: none;
    border-color: #0099ff;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-primary {
    background: #0099ff;
    color: white;
}

.btn-primary:hover {
    background: #0077cc;
}

.btn-success {
    background: #00cc66;
    color: white;
}

.btn-success:hover {
    background: #00994d;
}

.btn-danger {
    background: #cc3344;
    color: white;
}

.btn-danger:hover {
    background: #992233;
}

.btn-small {
    padding: 4px 12px;
    font-size: 0.8rem;
}

.status-msg {
    margin-top: 12px;
    padding: 8px;
    border-radius: 8px;
    display: none;
}

.status-msg.success {
    display: block;
    background: #00ff8822;
    color: #00ff88;
    border: 1px solid #00ff8844;
}

.status-msg.error {
    display: block;
    background: #ff334422;
    color: #ff4455;
    border: 1px solid #ff334444;
}

.node-list {
    margin-top: 16px;
}

.node-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #0d1b2a;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    margin-bottom: 6px;
}

.node-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.node-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.node-status.online { background: #00ff88; }
.node-status.offline { background: #ff4455; }
.node-status.unknown { background: #888; }

.node-type-badge {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.node-type-badge.full { background: #0099ff33; color: #0099ff; }
.node-type-badge.download { background: #00cc6633; color: #00cc66; }
.node-type-badge.upload { background: #ffaa0033; color: #ffaa00; }

.task-item {
    background: #0d1b2a;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
}

.task-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.task-url {
    font-size: 0.85rem;
    color: #80a0b0;
    word-break: break-all;
}

.task-status-badge {
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.task-status-badge.completed,
.task-status-badge.all_completed {
    background: #00ff8822;
    color: #00ff88;
    border: 1px solid #00ff8844;
}

.task-status-badge.downloading {
    background: #0099ff22;
    color: #0099ff;
    border: 1px solid #0099ff44;
}

.task-status-badge.failed {
    background: #ff334422;
    color: #ff4455;
    border: 1px solid #ff334444;
}

.node-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.node-progress-name {
    width: 80px;
    font-size: 0.8rem;
    color: #80a0b0;
    flex-shrink: 0;
}

.progress-bar-wrapper {
    flex: 1;
    height: 6px;
    background: #2a3a4a;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s;
}

.progress-bar.downloading { background: linear-gradient(90deg, #0099ff, #00d4ff); }
.progress-bar.completed { background: #00ff88; }
.progress-bar.seeding { background: #00cc66; }
.progress-bar.failed { background: #ff4455; }

.node-progress-pct {
    width: 40px;
    text-align: right;
    font-size: 0.8rem;
    color: #80a0b0;
}

.source-tag {
    display: inline-block;
    padding: 1px 6px;
    background: #00cc6622;
    color: #00cc66;
    border: 1px solid #00cc6644;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 4px;
}

.loading {
    color: #666;
    text-align: center;
    padding: 20px;
}

.empty {
    color: #555;
    text-align: center;
    padding: 20px;
}

/* Seeding status special */
.task-item.seeding .progress-bar.completed,
.task-item.seeding .progress-bar.seeding {
    background: linear-gradient(90deg, #00cc66, #00ff88);
    animation: pulse 2s infinite;
}

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

/* ============= 标签页 ============= */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: #1a2a3a;
    border: 1px solid #2a3a4a;
    border-radius: 10px;
    padding: 4px;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #80a0b0;
    cursor: pointer;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.tab-btn:hover {
    background: #2a3a4a;
    color: #c0d0e0;
}

.tab-btn.active {
    background: #0099ff;
    color: white;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============= 文件库 ============= */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.input-search {
    flex: 1;
    padding: 10px 14px;
    background: #0d1b2a;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.input-search:focus {
    outline: none;
    border-color: #0099ff;
}

.file-grid {
    display: grid;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0d1b2a;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.file-item:hover {
    border-color: #0099ff44;
}

.file-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.file-icon {
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a2a3a;
    border-radius: 8px;
    flex-shrink: 0;
}

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

.file-name {
    font-weight: 600;
    color: #e0e0e0;
    word-break: break-all;
    font-size: 0.95rem;
}

.file-meta {
    font-size: 0.8rem;
    color: #80a0b0;
    margin-top: 2px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.file-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.file-size {
    color: #00ff88;
    font-weight: 500;
}

.file-date {
    color: #80a0b0;
}

.btn-download {
    padding: 6px 14px;
    background: #0099ff22;
    color: #0099ff;
    border: 1px solid #0099ff44;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-download:hover {
    background: #0099ff44;
}

.file-empty {
    color: #555;
    text-align: center;
    padding: 40px 20px;
    font-size: 0.95rem;
}

/* 文件类型颜色 */
.file-icon.txt { background: #8888ff22; }
.file-icon.pdf { background: #ff444422; }
.file-icon.zip { background: #ffaa0022; }
.file-icon.image { background: #00cc6622; }
.file-icon.video { background: #ff44aa22; }
.file-icon.audio { background: #ff880022; }
.file-icon.default { background: #4488ff22; }

/* 响应式 */
@media (max-width: 640px) {
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .form-inline {
        flex-direction: column;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .tabs {
        flex-direction: column;
    }
}
