/* ========================================
   Naver漫画页面通用样式
   ======================================== */

/* 基础重置 */
.comic-page * { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

.comic-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

/* ========================================
   漫画列表页样式 (list.html)
   ======================================== */

/* 分类标签区 */
.tag-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.tag-header {
    display: flex;
    align-items: flex-start; /* 顶部对齐，而不是居中 */
    gap: 12px;
    margin-bottom: 0;
}
.tag-title {
    font-size: 16px;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tag-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, #6c5ce7, #a29bfe);
    border-radius: 2px;
}
.tag-list-container {
    flex: 1;
    min-width: 0;
}
.tag-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: #f0f0f5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #6c5ce7;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px; /* 微调垂直位置，与标题文字对齐 */
}
.tag-toggle-btn:hover {
    background: #ede9fe;
    transform: scale(1.05);
}
.tag-toggle-btn .arrow {
    display: inline-block;
    transition: transform 0.3s ease;
}
.tag-toggle-btn.expanded .arrow {
    transform: rotate(180deg);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 36px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.tag-list.expanded {
    max-height: 180px;
    overflow-y: auto;
    padding-right: 8px;
}
/* 自定义滚动条样式 */
.tag-list.expanded::-webkit-scrollbar {
    width: 6px;
}
.tag-list.expanded::-webkit-scrollbar-track {
    background: #f0f0f5;
    border-radius: 3px;
}
.tag-list.expanded::-webkit-scrollbar-thumb {
    background: #6c5ce7;
    border-radius: 3px;
}
.tag-list.expanded::-webkit-scrollbar-thumb:hover {
    background: #5a4bd1;
}
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag-item {
    padding: 6px 16px;
    border-radius: 20px;
    background: #f0f0f5;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid transparent;
}
.tag-item:hover {
    background: #ede9fe;
    color: #6c5ce7;
    border-color: #6c5ce7;
}
.tag-item.active {
    background: #6c5ce7;
    color: #fff;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar label {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}
.filter-bar select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: #333;
    cursor: pointer;
    outline: none;
}
.filter-bar select:focus {
    border-color: #6c5ce7;
}

/* 更新日标签 */
.week-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 200px;
}
.week-tag {
    padding: 4px 12px;
    border-radius: 6px;
    background: #f0f0f5;
    color: #555;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.week-tag:hover {
    background: #ede9fe;
    color: #6c5ce7;
    border-color: #6c5ce7;
}
.week-tag.active {
    background: #6c5ce7;
    color: #fff;
    border-color: #6c5ce7;
}

/* 漫画网格 */
.comic-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 固定5列 */
    gap: 20px;
}
.comic-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
}
.comic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.comic-cover {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
    background: #e8e8e8;
}
.comic-cover-placeholder {
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #dfe6e9, #b2bec3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #636e72;
    font-size: 48px;
}
.comic-info {
    padding: 12px;
}
.comic-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.comic-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}
.comic-author {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.comic-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: auto;
}
.badge-up { background: #fdcb6e; color: #d68910; }
.badge-rest { background: #dfe6e9; color: #636e72; }
.badge-finish { background: #fab1a0; color: #e17055; }
.badge-genre { background: #dfe6e9; color: #636e72; }

/* ========================================
   漫画详情页样式 (detail.html)
   ======================================== */

/* 返回导航 */
.back-nav {
    margin-bottom: 20px;
}
.back-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6c5ce7;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
.back-nav a:hover { color: #5a4bd1; }

/* 漫画信息区 */
.comic-header {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    gap: 28px;
}
.comic-cover-wrap {
    flex-shrink: 0;
    width: 200px;
}
.comic-cover-wrap img {
    width: 200px;
    height: 280px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.cover-placeholder {
    width: 200px;
    height: 280px;
    background: linear-gradient(135deg, #dfe6e9, #b2bec3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    color: #636e72;
}
.comic-info-wrap {
    flex: 1;
    min-width: 0;
}
.comic-info-wrap h1 {
    font-size: 26px;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 12px;
    line-height: 1.3;
}
.comic-meta-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #636e72;
    background: #f5f5f5;
    padding: 4px 12px;
    border-radius: 6px;
}
.meta-item .icon { font-size: 14px; }
.meta-item.star { background: #fff8e1; color: #f39c12; }
.meta-item.views { background: #e8f5e9; color: #27ae60; }
.meta-item.fav { background: #fce4ec; color: #e91e63; }
.comic-synopsis {
    font-size: 14px;
    color: #636e72;
    line-height: 1.8;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}
.comic-synopsis h4 {
    font-size: 14px;
    color: #2d3436;
    margin-bottom: 8px;
}

/* 状态标签 */
.status-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-updating { background: #d4edda; color: #155724; }
.badge-rest { background: #fff3cd; color: #856404; }
.badge-finished { background: #f8d7da; color: #721c24; }
.badge-age { background: #e2e3e5; color: #383d41; }
.badge-day { background: #cce5ff; color: #004085; }

/* 章节列表 */
.chapter-section {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.chapter-section h2 {
    font-size: 20px;
    color: #2d3436;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chapter-section h2::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 22px;
    background: linear-gradient(180deg, #6c5ce7, #a29bfe);
    border-radius: 3px;
}
.chapter-count {
    font-size: 14px;
    color: #999;
    font-weight: 400;
    margin-left: 8px;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
}
.chapter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #fafafa;
    border-radius: 8px;
    text-decoration: none;
    color: #2d3436;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.chapter-item:hover {
    background: #ede9fe;
    border-color: #6c5ce7;
    color: #6c5ce7;
}
.chapter-thumb {
    width: 101px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e8e8e8;
}
.chapter-text {
    flex: 1;
    min-width: 0;
}
.chapter-no {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}
.chapter-subtitle {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chapter-lock {
    font-size: 14px;
    color: #f39c12;
    flex-shrink: 0;
}

/* ========================================
   漫画阅读页样式 (reader.html)
   ======================================== */

.reader-page {
    background: #1a1a2e;
    color: #eee;
}

/* 顶部导航栏 */
.reader-header {
    background: #16213e;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #a29bfe;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
.back-btn:hover { color: #6c5ce7; }
.comic-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}
.chapter-name {
    font-size: 14px;
    color: #a29bfe;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-btn {
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #ddd;
}
.nav-btn:hover {
    background: #6c5ce7;
    border-color: #6c5ce7;
    color: #fff;
}
.nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* 图片阅读区域 */
.reader-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}
.reader-images {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.reader-images img {
    width: 100%;
    display: block;
    background: #0f0f23;
}

/* 底部导航 */
.reader-footer {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.footer-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}
.footer-btn.prev {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #ccc;
}
.footer-btn.prev:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.footer-btn.next {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff;
    border: none;
}
.footer-btn.next:hover {
    background: linear-gradient(135deg, #5a4bd1, #8c7ae6);
}
.footer-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.chapter-indicator {
    font-size: 14px;
    color: #888;
    text-align: center;
}

/* 加载动画 */
.img-loading {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f0f23;
    color: #555;
    font-size: 14px;
}
.img-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #333;
    border-top-color: #6c5ce7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #b2bec3;
}
.empty-state .empty-icon { 
    font-size: 64px; 
    margin-bottom: 16px; 
}
.empty-state p { 
    font-size: 16px; 
}

/* 图片懒加载占位 */
.lazy-img {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.lazy-img.loaded {
    opacity: 1;
}

/* ========================================
   分页样式 (通用)
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px 0;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}
.pagination a {
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
}
.pagination a:hover {
    background: #6c5ce7;
    color: #fff;
    border-color: #6c5ce7;
}
.pagination .current { 
    background: #6c5ce7; 
    color: #fff; 
}
.pagination .disabled { 
    background: #f0f0f0; 
    color: #ccc; 
    cursor: not-allowed; 
}
.page-info { 
    font-size: 13px; 
    color: #999; 
    margin: 0 8px; 
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1200px) {
    /* 平板：4列 */
    .comic-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    /* 小平板：3列 */
    .comic-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    /* 手机横屏：2列 */
    .comic-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 640px) {
    /* 详情页响应式 */
    .comic-header { 
        flex-direction: column; 
        align-items: center; 
        text-align: center; 
    }
    .comic-cover-wrap { width: 160px; }
    .comic-cover-wrap img { width: 160px; height: 224px; }
    .cover-placeholder { width: 160px; height: 224px; }
    .comic-meta-list { justify-content: center; }
    
    /* 列表页响应式 - 保持2列 */
    .comic-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* 阅读页响应式 */
    .reader-header {
        flex-direction: column;
        gap: 12px;
        padding: 10px 15px;
    }
    .header-left, .header-right {
        width: 100%;
        justify-content: center;
    }
    .reader-footer {
        flex-direction: column;
        gap: 12px;
    }
    .footer-btn {
        width: 100%;
    }
}
