/* ========== 基础重置 ========== */
body {
    margin: 0; padding: 0;
    background-color: #ffffff;
    color: #222222;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}
a { text-decoration: none; color: inherit; }

/* ========== 导航栏 ========== */
.header-nav {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 64px;
    background-color: #ffffff; border-bottom: 1px solid #eeeeee;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px; box-sizing: border-box; z-index: 100;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 30px; }
.brand-link { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
.brand-title { color: #111111; font-size: 19px; font-weight: bold; white-space: nowrap; }
.auth-links { color: #555555; font-size: 14px; white-space: nowrap; display: flex; align-items: center; }
.auth-divider { margin: 0 8px; color: #dddddd; }

/* ========== 主导航栏元素 ========== */
.nav-menu { display: flex; gap: 24px; }
.nav-item { color: #666666; font-size: 15px; font-weight: 500; transition: color 0.2s; }
.nav-item:hover, .nav-item.active { color: #000000; }

.search-box { flex-shrink: 0; }
.search-input {
    width: 220px; padding: 8px 16px;
    border: 1px solid #dddddd; border-radius: 20px;
    background-color: #f6f6f6; font-size: 14px; outline: none;
    transition: all 0.2s ease; box-sizing: border-box;
}
.search-input:focus { background-color: #ffffff; border-color: #888888; width: 260px; }

.user-profile { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #333333; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid #eeeeee; }
.user-name { font-weight: 500; color: #111111; }
.btn-logout { color: #999999; font-size: 13px; transition: color 0.2s; margin-left: 4px; }
.btn-logout:hover { color: #ff3b30; }

/* ========== 表单卡片通用 ========== */
.page-wrapper {
    display: flex; justify-content: center; align-items: center;
    min-height: calc(100vh - 64px); margin-top: 64px; box-sizing: border-box;
    background-color: #fafafa;
}
.form-body { padding: 40px 40px 30px 40px; text-align: center; }
.page-title { color: #111111; font-size: 22px; font-weight: bold; margin-bottom: 24px; }

.input-group { position: relative; margin-bottom: 18px; text-align: left; }
.input-group label { display: block; font-size: 13px; color: #666666; margin-bottom: 6px; font-weight: 500; }
.form-input {
    width: 100%; padding: 12px 16px; border: 1px solid #dddddd; border-radius: 8px;
    background-color: #f6f6f6; font-size: 14px; outline: none; box-sizing: border-box; transition: all 0.2s ease;
}
.form-input:focus { background-color: #ffffff; border-color: #222222; }

.form-msg {
    color: #ff3b30; font-size: 13px; margin-top: 8px; text-align: left;
}
.error-msg {
    color: #ff3b30; font-size: 13px; margin-bottom: 16px; text-align: left;
}
.info-msg {
    color: #34c759; font-size: 13px; margin-bottom: 16px; text-align: left;
}

.btn-submit {
    width: 100%; padding: 12px; background-color: #111111; color: #ffffff;
    border: none; border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer;
    transition: background-color 0.2s; margin-top: 8px;
}
.btn-submit:hover { background-color: #333333; }

.card-footer-panel {
    background-color: #f6f6f6; padding: 20px 40px; border-top: 1px solid #eeeeee;
    display: flex; justify-content: space-between; font-size: 13px; color: #666666;
}
.card-footer-panel a:hover { color: #000000; font-weight: 500; }

/* ========== 手机端底部导航栏 ========== */
.mobile-bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; width: 100%; height: 56px;
    background-color: #ffffff; border-top: 1px solid #eeeeee;
    justify-content: space-around; align-items: center; z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 10px; color: #999999; text-decoration: none;
    padding: 6px 0; transition: color 0.2s;
}
.bottom-nav-item svg { flex-shrink: 0; }
.bottom-nav-item.active { color: #111111; }

/* 底部栏存在时给页面留出空间 */
body.has-bottom-nav { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
    .mobile-bottom-nav { display: flex; }
    .header-nav { padding: 0 12px; height: 56px; }
    .brand-title { font-size: 16px; }
    .nav-left, .nav-right { gap: 6px; }
    .nav-menu { display: none; }
    .nav-right { gap: 8px; flex: 1; justify-content: flex-end; margin-left: 10px; min-width: 0; }
    .search-box { flex: 1; max-width: 160px; min-width: 0; }
    .search-box form { display: flex; width: 100%; }
    .search-input { width: 100%; padding: 6px 12px; font-size: 13px; }
    .search-input:focus { width: 100% !important; }
    .auth-links { font-size: 13px; flex-shrink: 0; }
    .user-profile { gap: 6px; font-size: 13px; }
    .user-avatar { width: 26px; height: 26px; }
    .user-name { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

    .page-wrapper { margin-top: 56px; min-height: calc(100vh - 56px); align-items: flex-start; padding-top: 20px; background-color: #ffffff; }
    .form-body { padding: 20px 24px; }
    .card-footer-panel { padding: 16px 24px; background: transparent; }
}

/* ========== 漫画卡片网格（首页/分类/搜索共用） ========== */
.comic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 25px 20px; }
.comic-card { text-align: center; transition: transform 0.2s ease; }
.comic-card:hover { transform: translateY(-4px); }
.cover-wrapper { width: 100%; padding-top: 133.33%; position: relative; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.06); background-color: #f5f5f5; border: 1px solid #eeeeee; }
.comic-cover { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.comic-title { display: block; margin-top: 8px; font-size: 14px; font-weight: 500; color: #444; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comic-card:hover .comic-title { color: #000; }

/* 作者名超链接（详情页/书架共用） */
.author-link { text-decoration: none; cursor: pointer; transition: color 0.15s; }
.author-link:hover { color: #4a9eff; }

@media (max-width: 768px) {
    .comic-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px 12px; }
    .comic-title { font-size: 12px; margin-top: 6px; }
    .comic-card:hover { transform: none; }
    .cover-wrapper { border-radius: 6px; }
}

/* ========== 漫画详情页 ========== */
.detail-container { max-width: 1000px; margin: 88px auto 0; padding: 0 20px; }
.detail-card { display: flex; gap: 28px; padding: 28px 0; border-bottom: 1px solid #eeeeee; }

.detail-cover { width: 180px; flex-shrink: 0; }
.detail-cover img {
    width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
    border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid #eeeeee;
}

.detail-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.detail-title { font-size: 26px; font-weight: 700; color: #111; margin: 0 0 14px; line-height: 1.3; }

.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.meta-item { font-size: 14px; color: #666; display: flex; align-items: center; gap: 5px; }
.meta-item .label { color: #999; }
.meta-item .value { color: #333; font-weight: 500; }
.meta-item .author-link { color: #333; font-weight: 500; }

.status-badge {
    display: inline-block; padding: 3px 12px; border-radius: 12px;
    font-size: 12px; font-weight: 600; color: #fff;
}
.status-completed { background-color: #8e8e93; }
.status-ongoing { background-color: #34c759; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag-badge {
    padding: 3px 12px; border-radius: 12px; font-size: 12px;
    color: #555; background-color: #f0f0f0; border: 1px solid #e5e5e5;
    transition: all 0.2s; cursor: default;
}
.tag-badge:hover { background-color: #e8e8e8; color: #333; }

.action-row { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.btn-action {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 24px; border-radius: 8px; font-size: 14px;
    font-weight: 500; cursor: pointer; transition: all 0.2s;
    border: none; text-decoration: none;
}
.btn-primary { background-color: #111; color: #fff; }
.btn-primary:hover { background-color: #333; }
.btn-secondary { background-color: #fff; color: #555; border: 1px solid #ddd; }
.btn-secondary:hover { border-color: #999; color: #333; }
.btn-secondary.disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary.disabled:hover { border-color: #ddd; color: #555; }
.btn-favorite.active { color: #ff3b30; border-color: #ff3b30; }

.empty-state { text-align: center; padding: 40px; color: #999; font-size: 14px; }

/* ========== 章节目录 ========== */
.chapter-section { padding: 28px 0 60px; }
.chapter-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.chapter-title { font-size: 18px; font-weight: 600; color: #111; }
.chapter-count { font-size: 13px; color: #999; }

.chapter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.chapter-item {
    display: inline-flex; align-items: center;
    padding: 8px 18px; border-radius: 6px;
    background-color: #f7f7f7; border: 1px solid #eee;
    font-size: 14px; color: #555; text-decoration: none;
    transition: all 0.15s; cursor: pointer;
    max-width: 240px;
}
.chapter-item:hover { background-color: #111; color: #fff; border-color: #111; }
.chapter-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== 评论区 ========== */
.comment-section { padding: 32px 0 60px; border-top: 1px solid #eee; }
.comment-section-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 20px; }
.comment-section-title { font-size: 18px; font-weight: 600; color: #111; }

.comment-editor { display: flex; gap: 10px; margin-bottom: 24px; }
.comment-editor-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-editor-body { flex: 1; min-width: 0; }
.comment-editor-body textarea {
    width: 100%; min-height: 70px; padding: 10px 14px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 14px; font-family: inherit; resize: vertical;
    outline: none; transition: border-color 0.2s; box-sizing: border-box;
}
.comment-editor-body textarea:focus { border-color: #999; }
.comment-editor-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.comment-editor-hint { font-size: 12px; color: #999; }
.comment-editor-submit {
    padding: 6px 20px; border-radius: 6px; font-size: 13px; font-weight: 500;
    background-color: #111; color: #fff; border: none; cursor: pointer; transition: background-color 0.2s;
}
.comment-editor-submit:hover { background-color: #333; }
.comment-editor-submit:disabled { background-color: #bbb; cursor: not-allowed; }

.comment-login-hint { text-align: center; padding: 20px; color: #999; font-size: 14px; }
.comment-login-hint a { color: #111; font-weight: 500; }

.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-item { padding: 16px 0; border-bottom: 1px solid #f0f0f0; }
.comment-item-top { display: flex; gap: 10px; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.comment-nickname { font-size: 13px; font-weight: 600; color: #333; }
.comment-time { font-size: 12px; color: #bbb; }
.comment-content { font-size: 14px; color: #444; line-height: 1.6; word-break: break-word; margin-bottom: 6px; }
.comment-actions { display: flex; gap: 16px; }
.comment-reply-btn {
    font-size: 12px; color: #999; cursor: pointer; background: none; border: none; padding: 0;
    transition: color 0.15s;
}
.comment-reply-btn:hover { color: #333; }

.comment-replies { margin-left: 46px; margin-top: 8px; padding: 8px 14px; background-color: #fafafa; border-radius: 8px; }
.comment-reply-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.comment-reply-item:last-child { border-bottom: none; }
.comment-reply-item .comment-meta { margin-bottom: 4px; }
.comment-reply-item .comment-content { font-size: 13px; margin-bottom: 0; }
.comment-avatar-sm { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.comment-reply-to { font-size: 12px; color: #999; }
.comment-reply-to .reply-to-name { color: #4a9eff; text-decoration: none; cursor: pointer; }
.comment-reply-to .reply-to-name:hover { text-decoration: underline; }

.comment-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.comment-page-btn {
    padding: 6px 14px; border-radius: 6px; font-size: 13px; border: 1px solid #ddd;
    background-color: #fff; color: #555; cursor: pointer; transition: all 0.15s;
}
.comment-page-btn:hover { border-color: #999; color: #333; }
.comment-page-btn.active { background-color: #111; color: #fff; border-color: #111; }
.comment-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.comment-loading { text-align: center; padding: 20px; color: #999; }
.comment-error { text-align: center; padding: 20px; color: #ff3b30; }

/* ========== Toast 通知 ========== */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background-color: #333; color: #fff; padding: 10px 24px;
    border-radius: 8px; font-size: 14px; z-index: 9999;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { background-color: #ff3b30; }

/* ========== 详情页移动端适配 ========== */
@media (max-width: 768px) {
    .detail-container { margin: 72px auto 0; padding: 0 12px; }
    .detail-card { flex-direction: column; align-items: center; gap: 16px; padding: 20px 0; text-align: center; }
    .detail-cover { width: 130px; }
    .detail-info { align-items: center; }
    .detail-title { font-size: 20px; margin-bottom: 10px; text-align: center; }
    .meta-row { justify-content: center; gap: 6px 12px; }
    .meta-item { font-size: 13px; }
    .tag-list { justify-content: center; }
    .action-row { justify-content: center; width: 100%; }
    .btn-action { flex: 1; justify-content: center; padding: 10px 12px; max-width: 200px; }
    .chapter-section { padding: 20px 0 40px; }
    .chapter-title { font-size: 16px; }
    .chapter-list { gap: 8px; }
    .chapter-item { padding: 7px 14px; font-size: 13px; max-width: 200px; }
    .comment-replies { margin-left: 36px; }
    .comment-editor-avatar { width: 30px; height: 30px; }
    .comment-avatar { width: 30px; height: 30px; }
}

