/* ============================================
   天涯社区模板皮肤（bbs1）
   经典蓝白论坛风格 · 自适应
   仅覆盖视觉，不改变任何功能结构
   ============================================ */

/* 1. 全局变量：天涯蓝 */
:root {
    --brand: #1e6fb8;
    --brand-hover: #175a97;
    --brand-soft: #e7f1fb;
    --focus-ring: rgba(30, 111, 184, .3);
    --success: #1e6fb8;
    --success-soft: #e7f1fb;
    --bg: #eef2f6;
    --line: #d9e0e8;
    --line-soft: #eef2f6;
    --text: #212a33;
    --text-muted: #5a6b7b;
    --text-subtle: #8a99a8;
    --shadow-base: rgba(16, 24, 40, .05);
    --shadow-medium: rgba(16, 24, 40, .1);
}

/* 2. 顶部导航：天涯深蓝 */
.top {
    position: sticky;
    top: 0;
    z-index: 60;
    background: #1f5f9e;
    background-image: linear-gradient(180deg, #2b7cc4 0%, #1f5f9e 100%);
    border-bottom: 0;
}

.bar {
    height: 54px;
}

.brand {
    color: #fff !important;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: .5px;
}

.brand:before {
    content: "天";
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    border-radius: 5px;
    background: #e8403f;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.forum-link {
    color: rgba(255, 255, 255, .86);
}

.forum-link:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.forum-link.active {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 700;
}

.forum-more-toggle {
    color: rgba(255, 255, 255, .86);
}

.forum-more-toggle:hover,
.forum-more-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.search-page-link {
    border-color: rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .16);
    color: rgba(255, 255, 255, .92);
}

.search-page-link:hover {
    border-color: rgba(255, 255, 255, .5);
    color: #fff;
    box-shadow: none;
}

.search-page-fake-input,
.search-page-fake-icon {
    color: rgba(255, 255, 255, .9);
}

.mobile-menu-button {
    color: #fff !important;
}

.mobile-menu-button:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.nav-mine {
    color: #fff !important;
}

/* “全部”展开面板恢复白底 */
.forum-more-region {
    background: #fff;
    border-bottom: 1px solid var(--line);
}

/* 3. 版块分类导航条（page.header 注入） */
.tianya-catbar {
    background: #fff;
    border-bottom: 1px solid #dbe3ec;
    box-shadow: 0 2px 6px rgba(16, 24, 40, .05);
}

.tianya-catbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.tianya-cat {
    position: relative;
}

.tianya-cat > summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 0 4px;
    list-style: none;
    color: var(--brand);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.tianya-cat > summary::-webkit-details-marker {
    display: none;
}

.tianya-cat > summary:after {
    content: " [+]";
    color: #c00;
    font-size: 12px;
    font-weight: 700;
}

.tianya-cat[open] > summary:after {
    content: " [-]";
}

.tianya-cat-body {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 40;
    display: grid;
    gap: 2px;
    min-width: 190px;
    padding: 8px;
    background: #fff;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(16, 24, 40, .16);
}

.tianya-cat-body a {
    display: block;
    padding: 7px 10px;
    border-radius: 5px;
    color: #333d4a;
    font-size: 13px;
    white-space: nowrap;
}

.tianya-cat-body a:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.tianya-cat-body a.active {
    background: var(--brand);
    color: #fff;
}

.tianya-cat-all {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 6px;
    color: #5a6b7b;
    font-size: 13px;
}

.tianya-cat-all:hover {
    color: var(--brand);
}

/* 4. 主内容容器 */
.wrap {
    padding-top: 10px;
}

/* 5. 首页帖子列表：天涯紧凑风 */
.post-list {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
}

.post-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}

.post-item:hover {
    background: #f7fafc;
}

.post-title {
    color: #1e3a5f;
    font-weight: 700;
}

.post-title:hover {
    color: var(--brand);
}

.post-avatar {
    border-radius: 6px;
}

/* 6. 卡片 / 侧栏 */
.card,
.sidebar-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

/* 7. 页脚：背景横跨整个底部（与 sidebar 卡片视觉连贯），
   内部内容 max-width 居中；子元素自动水平居中堆叠，自适应 */
.footer {
    width: 100%;
    max-width: none;
    margin: 14px 0 0;
    padding: 16px 12px;
    box-sizing: border-box;
    background: var(--panel);
    border-top: 1px solid var(--line);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.7;
    text-align: center;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.footer > * {
    max-width: 1200px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    float: none;
    clear: both;
    text-align: center;
}

.footer p,
.footer div {
    margin: 0 auto;
}

.footer a {
    color: var(--text-muted);
}

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

/* 8. 响应式 */
@media (max-width: 720px) {
    /* 移动端使用 bbs1 自带的横滑版块条，分类导航隐藏 */
    .tianya-catbar {
        display: none;
    }

    .post-list {
        border-radius: 6px;
        padding: 0 10px;
    }

    /* 页脚移动端：100% 填满，紧凑 padding */
    .footer {
        max-width: none;
        margin: 10px 0 0;
        padding: 12px 10px;
        font-size: 12px;
        border-radius: 0;
    }
}

@media (max-width: 640px) {
    .bar {
        height: 46px;
    }

    .brand {
        font-size: 18px;
    }

    .brand:before {
        width: 22px;
        height: 22px;
        flex-basis: 22px;
        font-size: 13px;
    }

    .footer {
        padding: 10px 8px;
        font-size: 11px;
        line-height: 1.6;
    }
}

/* 9. 插件后台设置：分组分类配置 */
.tianya-settings-head {
    margin-bottom: 14px;
}

.tianya-settings-head strong {
    display: block;
    font-size: 14px;
    color: var(--text);
}

.tianya-settings-head span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}

.tianya-group-row {
    display: grid;
    grid-template-columns: 190px 250px 1fr;
    gap: 14px;
    margin-bottom: 12px;
    padding: 14px;
    background: #f7f9fb;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.tianya-group-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.tianya-group-field input[type="text"] {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--text);
    box-sizing: border-box;
}

.tianya-group-field textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    line-height: 1.6;
    background: #fff;
    color: var(--text);
    box-sizing: border-box;
    resize: vertical;
}

.tianya-group-field select {
    width: 100%;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--text);
    box-sizing: border-box;
}

.tianya-group-bound {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--brand);
    word-break: break-word;
}

.tianya-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tianya-preview-table th,
.tianya-preview-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
}

.tianya-preview-table th {
    color: var(--text-muted);
    font-weight: 600;
    background: #f7f9fb;
}

/* 页脚版权设置：预览面板模拟前台页脚效果 */
.tianya-footer-preview {
    margin-top: 8px;
    padding: 16px 12px;
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: 8px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.7;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.tianya-footer-preview a {
    color: var(--text-muted);
}

@media (max-width: 720px) {
    .tianya-group-row {
        grid-template-columns: 1fr;
    }
}

/* 10. 顶部导航：模板设置快捷入口（管理员可见） */
.tianya-admin-entry {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid var(--brand);
    background: var(--brand-soft, #e8f3ff);
    color: var(--brand);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.tianya-admin-entry:hover {
    background: var(--brand);
    color: #fff;
}

.tianya-admin-entry svg {
    flex: 0 0 auto;
}

@media (max-width: 640px) {
    .tianya-admin-entry span {
        display: none;
    }

    .tianya-admin-entry {
        padding: 6px 8px;
    }
}

/* 11. 侧边栏固定（桌面端，滚到顶部栏下方停留） */
@media (min-width: 721px) {
    .forum-layout > .sidebar,
    .forum-layout-has-sidebar > .sidebar {
        position: sticky;
        top: 64px;        /* .top 高度 54 + 10px 间距 */
        align-self: start;
        max-height: calc(100vh - 72px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* 自定义滚动条样式（仅 webkit），更轻盈 */
    .forum-layout > .sidebar::-webkit-scrollbar,
    .forum-layout-has-sidebar > .sidebar::-webkit-scrollbar {
        width: 6px;
    }
    .forum-layout > .sidebar::-webkit-scrollbar-thumb,
    .forum-layout-has-sidebar > .sidebar::-webkit-scrollbar-thumb {
        background: rgba(30, 111, 184, .25);
        border-radius: 3px;
    }
    .forum-layout > .sidebar::-webkit-scrollbar-thumb:hover,
    .forum-layout-has-sidebar > .sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(30, 111, 184, .45);
    }
}

/* 12. 返回顶部按钮：滚动 240px 后浮现，右下角圆形蓝底 */
.tianya-back-top {
    position: fixed;
    right: 22px;
    bottom: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    border: 0;
    padding: 0;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(16, 24, 40, .25);
    z-index: 80;
    transition: background-color .15s ease, transform .15s ease, opacity .15s ease;
    text-decoration: none;
}

.tianya-back-top.show {
    display: flex;
}

.tianya-back-top:hover {
    background: var(--brand-hover);
    transform: translateY(-2px);
}

.tianya-back-top:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.tianya-back-top svg {
    display: block;
}

@media (max-width: 640px) {
    .tianya-back-top {
        right: 14px;
        bottom: 20px;
        width: 40px;
        height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tianya-back-top {
        transition: none;
    }
}

/* 13. 自定义顶部 Logo：日间/夜间切换（跟随系统深色模式） */
.tianya-logo {
    display: block;
    flex: 0 0 auto;
}

.tianya-logo-dark {
    display: none;
}

@media (prefers-color-scheme: dark) {
    .tianya-logo-light {
        display: none;
    }

    .tianya-logo-dark {
        display: block;
    }
}
