/* 基础样式 */
:root {
    --primary: #1a1a2e;
    --secondary: #16213e;
    --accent: #0f8b8b;
    --accent-light: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --text: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #334155;
    --card-bg: rgba(30, 41, 59, 0.5);
    --modal-bg: rgba(15, 23, 42, 0.95);
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    padding: 40px 0 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(15, 139, 139, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(14, 165, 233, 0.1) 0%, transparent 50%);
    z-index: -1;
}

.header-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: gradientShift 8s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: 1.4rem;
    color: var(--accent-light);
    margin-bottom: 20px;
    opacity: 0.9;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 区域样式 */
.section-header {
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--accent-light);
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* 输入区域 */
.url-section {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-group input {
    flex: 1;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 139, 139, 0.2);
}

.input-hints {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 10px;
}

/* 测速模块 */
.speedtest-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    border: 1px solid var(--border);
}

.speedtest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.speedtest-node {
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.speedtest-node.active {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.speedtest-node::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: var(--progress-width, 0%);
    height: 3px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.node-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.node-status {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
}

.node-status.testing { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.node-status.success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.node-status.error { background: rgba(239, 68, 68, 0.2); color: var(--error); }

.node-speed {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 5px;
}

.node-latency {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.speedtest-progress {
    margin-top: 20px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 软件库样式 */
.software-section {
    margin-bottom: 40px;
}

.section-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
}

.category-btn:hover,
.category-btn.active {
    background: rgba(15, 139, 139, 0.2);
    border-color: var(--accent);
    color: var(--accent-light);
}

.view-controls {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
    border-radius: 8px;
}

.view-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.view-btn:hover,
.view-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-light);
}

.software-container {
    margin: 30px 0;
}

.software-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.software-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.software-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.software-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.software-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), var(--accent-light));
}

.software-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.software-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-light);
}

.software-popularity {
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.software-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.software-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.software-actions {
    display: flex;
    gap: 10px;
}

.software-card.list-view {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.software-card.list-view .software-header {
    margin-bottom: 0;
    flex: 1;
}

.software-card.list-view .software-description {
    margin-bottom: 0;
    flex: 2;
}

.software-card.list-view .software-meta {
    margin-bottom: 0;
    flex: 1;
    justify-content: flex-end;
}

.software-card.list-view .software-actions {
    flex: 0 0 auto;
}

/* 按钮样式 */
.btn-primary, .btn-secondary, .btn-small {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(15, 139, 139, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--modal-bg);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--accent-light);
    font-size: 1.4rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--error);
}

.modal-body {
    padding: 30px;
}

/* 下载管理器 */
.download-manager {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 40px;
    border: 1px solid var(--border);
    position: sticky;
    bottom: 20px;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.manager-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-light);
}

.badge {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.manager-controls {
    display: flex;
    gap: 10px;
}

.download-list {
    max-height: 300px;
    overflow-y: auto;
}

.download-item {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.download-item:last-child {
    margin-bottom: 0;
}

.download-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.download-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.download-item-status {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
}

.status-downloading { background: rgba(14, 165, 233, 0.2); color: var(--accent-light); }
.status-paused { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.status-completed { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.status-error { background: rgba(239, 68, 68, 0.2); color: var(--error); }

.download-item-progress {
    margin-top: 10px;
}

.progress-bar-small {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill-small {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.download-item-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 页脚 */
footer {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    color: var(--accent-light);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.footer-section p, .footer-section li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 8px;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-section li::before {
    content: '›';
    color: var(--accent);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.footer-bottom {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 通知 */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1001;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-icon {
    font-size: 1.2rem;
}

.notification-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2.5rem;
    }
    
    .section-header {
        text-align: center;
    }
    
    .section-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .software-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}