/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-dark: #111827;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --reader-font-size: 16px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 700;
}

.nav-brand h1 a {
    color: var(--primary-color);
    text-decoration: none;
}

.brand-subtitle {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
}

.nav-search {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-search input {
    padding: 8px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    font-size: 0.9rem;
    width: 200px;
    transition: border-color 0.3s ease;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-btn {
    padding: 8px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.search-btn:hover {
    background: var(--secondary-color);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    transition: all 0.3s ease;
}

/* 轮播图 */
.hero-slider {
    position: relative;
    height: 500px;
    overflow: hidden;
    margin-top: 0;
}

.slider-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.slide.active {
    opacity: 1;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: var(--white);
    padding: 60px 40px 40px;
    z-index: 2;
}

.slide-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.slide-content p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.slider-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 3;
}

.prev-btn, .next-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: var(--white);
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.prev-btn:hover, .next-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: var(--white);
}

/* 按钮样式 */
.btn-primary {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    display: inline-block;
    padding: 12px 30px;
    background: transparent;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* 页面标题 */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 80px 20px;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* 通用区块样式 */
.section-padding {
    padding: 80px 20px;
}

.bg-light {
    background: var(--bg-light);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.section-header p {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* 分类导航 */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
}

.category-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.category-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.category-card h3 {
    padding: 20px;
    text-align: center;
    color: var(--text-dark);
    font-size: 1.2rem;
}

/* 漫画卡片 */
.comics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
}

.comic-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.comic-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.comic-cover {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.comic-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.comic-card:hover .comic-cover img {
    transform: scale(1.1);
}

.comic-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    background: var(--accent-color);
    color: var(--white);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.comic-badge.hot {
    background: #ef4444;
}

.comic-badge.new {
    background: #10b981;
}

.comic-info {
    padding: 20px;
}

.comic-info h3 {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comic-author {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.comic-desc {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.comic-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.comic-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 排行榜 */
.ranking-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 10px 25px;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.tab-btn:hover,
.tab-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.ranking-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.rank-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 50px;
    text-align: center;
}

.ranking-item img {
    width: 100px;
    height: 130px;
    object-fit: cover;
    border-radius: 5px;
}

.ranking-info {
    flex: 1;
}

.ranking-info h3 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.ranking-info p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.ranking-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.btn-read {
    padding: 10px 25px;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-read:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* 筛选栏 */
.filter-section {
    background: var(--white);
    padding: 30px 20px;
    box-shadow: var(--shadow);
}

.filter-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-dark);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.filter-group select {
    padding: 8px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 10px 15px;
    background: var(--white);
    border: 2px solid #e5e7eb;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.page-btn:hover,
.page-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.page-ellipsis {
    padding: 10px 5px;
    color: var(--text-light);
}

/* 漫画详情页 */
.comic-detail {
    background: var(--white);
}

.detail-wrapper {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    align-items: start;
}

.detail-cover {
    position: sticky;
    top: 100px;
}

.detail-cover img {
    width: 100%;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.cover-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-info h1 {
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.detail-meta span {
    color: var(--text-light);
    font-size: 0.9rem;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 10px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.detail-desc {
    margin-bottom: 30px;
}

.detail-desc h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.detail-desc p {
    color: var(--text-light);
    line-height: 1.8;
    font-size: 1rem;
}

.detail-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    padding: 5px 15px;
    background: var(--bg-light);
    color: var(--text-dark);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 章节列表 */
.chapters-section {
    background: var(--bg-light);
}

.chapter-sort {
    display: flex;
    gap: 10px;
}

.sort-btn {
    padding: 8px 20px;
    background: var(--bg-light);
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.sort-btn:hover,
.sort-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.chapters-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
}

.chapter-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.chapter-number {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 80px;
}

.chapter-title {
    flex: 1;
    color: var(--text-dark);
}

.chapter-date {
    color: var(--text-light);
    font-size: 0.9rem;
}

.chapter-read {
    color: var(--primary-color);
    font-weight: 600;
}

/* 阅读器样式 */
.reader-body {
    background: var(--white);
    overflow: hidden;
}

.reader-body.sepia-mode {
    background: #f4e4c1;
}

.reader-body.dark-mode {
    background: #1a1a1a;
}

.reader-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.comic-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.chapter-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

.toolbar-btn {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.reader-container {
    margin-top: 60px;
    min-height: calc(100vh - 60px);
    padding: 20px;
}

.reader-content {
    max-width: 1200px;
    margin: 0 auto;
}

.comic-page {
    margin-bottom: 20px;
    text-align: center;
    position: relative;
}

.comic-page img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.scroll-page {
    margin-bottom: 40px;
}

.page-number {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--white);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.reader-settings {
    position: fixed;
    top: 60px;
    right: -350px;
    width: 350px;
    height: calc(100vh - 60px);
    background: var(--white);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.reader-settings.active {
    right: 0;
}

.settings-content {
    padding: 30px;
}

.settings-content h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 20px;
}

.setting-item {
    margin-bottom: 25px;
}

.setting-item label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.setting-item select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e5e7eb;
    border-radius: 5px;
    font-size: 1rem;
}

.color-options {
    display: flex;
    gap: 10px;
}

.color-btn {
    flex: 1;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.color-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--white);
}

.setting-item input[type="range"] {
    width: 70%;
    margin-right: 10px;
}

.close-settings {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}

.page-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    padding: 15px 30px;
    border-radius: 25px;
    display: none;
    z-index: 998;
}

.hint-content {
    display: flex;
    gap: 30px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--white);
    z-index: 2000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 页脚 */
.footer {
    background: var(--bg-dark);
    color: var(--white);
    padding: 50px 20px 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.footer-section p {
    color: #d1d5db;
    line-height: 1.8;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 1s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 968px) {
    .detail-wrapper {
        grid-template-columns: 1fr;
    }

    .detail-cover {
        position: static;
        max-width: 300px;
        margin: 0 auto;
    }

    .detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .chapters-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--white);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow);
        padding: 20px 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    .nav-search {
        display: none;
    }

    .nav-search.active {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        padding: 15px;
        box-shadow: var(--shadow);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .comics-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 20px;
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 20px;
    }

    .ranking-item {
        flex-direction: column;
        text-align: center;
    }

    .ranking-item img {
        width: 80px;
        height: 100px;
    }

    .filter-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-buttons {
        width: 100%;
    }

    .toolbar-left,
    .toolbar-center,
    .toolbar-right {
        flex-direction: column;
        gap: 10px;
    }

    .reader-settings {
        width: 100%;
        right: -100%;
    }

    .slide-content h2 {
        font-size: 1.5rem;
    }

    .slide-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .comics-grid {
        grid-template-columns: 1fr;
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-stats {
        grid-template-columns: 1fr;
    }
}
