/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --dark-color: #2d3436;
    --light-color: #f8f9fa;
    --text-color: #333;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
}

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

/* 头部样式 */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

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

.logo h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.logo .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

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

.nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.nav a:hover {
    opacity: 0.8;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    transition: 0.3s;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.nav.active {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.95);
    padding: 1rem;
}

.nav.active ul {
    flex-direction: column;
    gap: 1rem;
}

/* 主要内容区域 */
.main {
    min-height: calc(100vh - 200px);
}

/* 轮播推荐区 */
.hero-section {
    position: relative;
    height: 500px;
    overflow: hidden;
    margin-bottom: 3rem;
}

.hero-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-item {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s;
}

.hero-item.active {
    opacity: 1;
}

.hero-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    position: absolute;
    bottom: 50px;
    left: 50px;
    color: white;
    z-index: 10;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.hero-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s;
}

.dot.active {
    background: white;
}

/* 按钮样式 */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

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

.btn-primary:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.btn-secondary:hover {
    background: #3db8b0;
    transform: translateY(-2px);
}

/* 分类导航 */
.categories-section {
    padding: 3rem 0;
    background: white;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--dark-color);
}

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

.category-card {
    text-decoration: none;
    color: var(--text-color);
    text-align: center;
    transition: transform 0.3s;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

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

.category-card span {
    display: block;
    padding: 1rem;
    font-weight: 600;
    background: white;
}

/* 热门推荐 */
.hot-section {
    padding: 3rem 0;
}

.comics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

.comic-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.comic-card a {
    text-decoration: none;
    color: var(--text-color);
    display: block;
}

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

.comic-info {
    padding: 1rem;
}

.comic-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.comic-author, .comic-update {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.comic-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stars {
    color: #ffc107;
}

.score {
    font-weight: 600;
    color: var(--primary-color);
}

/* 最新更新 */
.latest-section {
    padding: 3rem 0;
    background: white;
}

.latest-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.latest-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--light-color);
    border-radius: 10px;
    transition: transform 0.3s;
}

.latest-item:hover {
    transform: translateX(5px);
}

.latest-item img {
    width: 120px;
    height: 160px;
    object-fit: cover;
    border-radius: 5px;
}

.latest-info h3 {
    margin-bottom: 0.5rem;
}

.latest-info h3 a {
    color: var(--dark-color);
    text-decoration: none;
    font-size: 1.2rem;
}

.latest-info h3 a:hover {
    color: var(--primary-color);
}

.latest-info p {
    color: #666;
    margin-bottom: 0.5rem;
}

.latest-desc {
    color: #888;
    font-size: 0.9rem;
}

/* 热搜排行榜 */
.ranking-section {
    padding: 3rem 0;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.ranking-item:hover {
    transform: translateX(5px);
}

.rank-number {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    background: #ccc;
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #e6a85c);
}

.ranking-info h3 {
    margin-bottom: 0.5rem;
}

.ranking-info h3 a {
    color: var(--dark-color);
    text-decoration: none;
    font-size: 1.1rem;
}

.ranking-info h3 a:hover {
    color: var(--primary-color);
}

.ranking-info p {
    color: #666;
    font-size: 0.9rem;
}

/* 个性化推荐 */
.recommend-section {
    padding: 3rem 0;
    background: white;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.recommend-card {
    background: var(--light-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

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

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

.recommend-info {
    padding: 1.5rem;
}

.recommend-info h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.recommend-info p {
    color: #666;
    margin-bottom: 1rem;
}

/* 页脚 */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--secondary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
}

/* 内页样式 */
.page-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.page-content {
    padding: 3rem 0;
    max-width: 900px;
    margin: 0 auto;
}

.page-content h2 {
    font-size: 1.8rem;
    margin: 2rem 0 1rem;
    color: var(--dark-color);
}

.page-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: #555;
}

.page-content ul, .page-content ol {
    margin: 1rem 0 1rem 2rem;
    line-height: 1.8;
}

.page-content li {
    margin-bottom: 0.5rem;
}

/* 阅读页面样式 */
.reader-container {
    max-width: 100%;
    margin: 0 auto;
    background: #1a1a1a;
    min-height: 100vh;
    padding: 1rem;
}

.reader-controls {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reader-btn {
    padding: 10px 15px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.reader-btn:hover {
    background: white;
}

.reader-content {
    max-width: 800px;
    margin: 0 auto;
}

.reader-image {
    width: 100%;
    display: block;
    margin-bottom: 10px;
    border-radius: 5px;
}

/* 搜索页面 */
.search-section {
    padding: 3rem 0;
}

.search-box {
    max-width: 600px;
    margin: 0 auto 3rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .hero-content {
        left: 20px;
        bottom: 30px;
    }

    .hero-content h2 {
        font-size: 1.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 1rem;
    }

    .comics-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .latest-item {
        flex-direction: column;
    }

    .latest-item img {
        width: 100%;
        height: auto;
    }

    .reader-controls {
        position: relative;
        top: auto;
        right: auto;
        flex-direction: row;
        flex-wrap: wrap;
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }

    .hero-section {
        height: 300px;
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .comics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 夜间模式 */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .comic-card,
body.dark-mode .latest-item,
body.dark-mode .ranking-item,
body.dark-mode .recommend-card {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .page-content {
    color: #e0e0e0;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* 图片懒加载占位 */
img[loading="lazy"] {
    background: #f0f0f0;
    min-height: 200px;
}
