/* 基础样式和主题变量 */
:root {
    /* 浅色主题变量 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-color: #4361ee;
    --accent-hover: #3a56d4;
    --border-color: #dee2e6;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --card-bg: #ffffff;
}

.dark-theme {
    /* 深色主题变量 */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2d2d2d;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --accent-color: #5a7dff;
    --accent-hover: #4a6be8;
    --border-color: #404040;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.35);
    --card-bg: #1e1e1e;
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 1.8rem;
    color: var(--accent-color);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
}

.theme-toggle button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle button:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent-color);
}

/* 主内容区 */
main {
    flex: 1;
    padding: 2rem 0;
}

section {
    margin-bottom: 3rem;
}

/* 英雄区域 */
.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
    padding: 3rem 0;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, var(--accent-color), #8a2be2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
}

.hero-illustration {
    font-size: 10rem;
    color: var(--accent-color);
    opacity: 0.7;
}

/* 搜索区域 */
.search-section h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.search-box {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}

.input-group i {
    font-size: 1.2rem;
    color: var(--text-secondary);
    align-self: center;
}

.input-group input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

button {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.search-tips {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-tips i {
    margin-right: 5px;
}

/* 结果区域 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.8rem;
}

.loading {
    display: none;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.novel-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.novel-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.novel-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.novel-info {
    padding: 1.5rem;
}

.novel-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.novel-author {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.novel-stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.download-btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.95rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 下载列表 */
.download-list {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    max-height: 400px;
    overflow-y: auto;
}

.download-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.download-info h4 {
    margin-bottom: 0.3rem;
}

.download-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: conic-gradient(var(--accent-color) 0%, var(--bg-tertiary) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-circle span {
    font-size: 0.7rem;
    font-weight: 600;
}

/* 功能特性 */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.feature-card h4 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
}

/* 关于区域 */
.about-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.about-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* 页脚 */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
}

.footer p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.footer-note {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
}

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

.close-modal {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 1.5rem;
}

.download-options {
    margin-bottom: 2rem;
}

.option {
    margin-bottom: 1rem;
}

.option input {
    display: none;
}

.option label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option label:hover {
    border-color: var(--accent-color);
}

.option input:checked + label {
    border-color: var(--accent-color);
    background-color: rgba(67, 97, 238, 0.1);
}

.option label i {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.option label h4 {
    margin-bottom: 0.2rem;
}

.option label p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chapter-selection h4 {
    margin-bottom: 1rem;
}

.range-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.range-input {
    display: flex;
    flex-direction: column;
}

.range-input label {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.range-input input {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.range-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* 进度条 */
.progress-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-hover);
    display: none;
    z-index: 1000;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-color);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 2rem 0;
    }
    
    .hero-illustration {
        font-size: 6rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .range-selector {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        display: none;
    }
    
    .progress-container {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }
}

/* 添加通知样式（确保已添加）*/
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    transform: translateX(150%);
    transition: transform 0.3s ease;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification-info {
    background-color: var(--accent-color);
    color: white;
}

.notification-success {
    background-color: var(--success-color);
    color: white;
}

.notification-warning {
    background-color: var(--warning-color);
    color: white;
}

.notification-error {
    background-color: var(--error-color);
    color: white;
}

@media (max-width: 768px) {
    .notification {
        left: 20px;
        right: 20px;
        max-width: none;
        transform: translateY(-150%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

/* 小说描述样式 */
.novel-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    max-height: 4.2rem;
}

/* 文本辅助类 */
.text-muted {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* 按钮加载状态 */
.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 输入框验证样式 */
input:invalid {
    border-color: var(--error-color);
}

input:valid {
    border-color: var(--success-color);
}

/* 模态框动画 */
.modal-content {
    animation: modalSlideIn 0.3s ease;
}

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

/* 下载进度动画 */
.progress-fill {
    transition: width 0.3s ease;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .novel-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .novel-stats span {
        font-size: 0.8rem;
    }
}
