/* ============================================================
   茶室 - 话题页样式
   ============================================================ */

.topic-page {
    max-width: 1100px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* ============================================================
   话题 Hero
   ============================================================ */
.topic-hero {
    position: relative;
    padding: 26px 28px 22px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

/* 顶部彩色条：根据档位注入 --level-color */
.topic-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--level-color, #8b949e), transparent 70%);
    opacity: 0.7;
}

.topic-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.topic-hero-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.topic-hero-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.3px;
    word-break: break-word;
}

.topic-hero-name .hash {
    color: var(--accent);
    opacity: 0.85;
    margin-right: 2px;
}

.topic-hero-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* 关注按钮 */
.btn-follow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #1a1a1a;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(232, 164, 55, 0.3);
    font-family: inherit;
}

.btn-follow:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 164, 55, 0.4);
    filter: brightness(1.08);
}

.btn-follow.following {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    box-shadow: none;
    border: 1px solid var(--border-light);
}

.btn-follow.following:hover {
    background: rgba(224, 82, 82, 0.10);
    border-color: rgba(224, 82, 82, 0.35);
    color: var(--danger);
    box-shadow: none;
    filter: none;
}

.btn-follow.following:hover .follow-text::after {
    content: '取消';
}

.btn-follow.following:hover .follow-text {
    font-size: 0;
}

.btn-follow.following:hover .follow-text::after {
    font-size: 14px;
}

.btn-follow:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 简介 */
.topic-hero-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
    max-width: 800px;
    white-space: pre-wrap;
}

.topic-hero-desc-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 13.5px;
    margin-bottom: 16px;
}

/* 底部数据 */
.topic-hero-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-muted);
}

.topic-hero-stats .item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.topic-hero-stats .item i {
    font-size: 12px;
    opacity: 0.75;
}

.topic-hero-stats .item strong {
    color: var(--accent-bright);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* 堂主/护法区 */
.topic-managers {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px dashed var(--border-light);
}

.topic-manager-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.topic-manager-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.topic-manager-label.owner {
    background: rgba(232, 164, 55, 0.15);
    color: var(--accent);
}

.topic-manager-label.mod {
    background: rgba(74, 144, 217, 0.12);
    color: var(--info);
}

.topic-manager-user {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.topic-manager-user:hover {
    color: var(--accent-bright);
}

.topic-manager-user .avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    flex-shrink: 0;
}

.topic-manager-user .avatar-text {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    font-size: 10px;
    font-weight: 700;
}

/* ============================================================
   工具栏（Tab + 发帖）
   ============================================================ */
.topic-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.topic-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.topic-tabs::-webkit-scrollbar {
    display: none;
}

.topic-tab {
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.topic-tab:hover {
    background: rgba(232, 164, 55, 0.06);
    color: var(--text-primary);
}

.topic-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #1a1a1a;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(232, 164, 55, 0.25);
}

.topic-post-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--accent);
    color: #1a1a1a;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.topic-post-btn:hover {
    background: var(--accent-bright);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 164, 55, 0.35);
}

.topic-post-btn.disabled {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
   帖子流
   ============================================================ */
.topic-post-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.topic-post-list .post-card {
    padding: 18px 22px;
}

/* ============================================================
   新建话题页
   ============================================================ */
.topic-new-page {
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.topic-new-header {
    padding: 12px 0 24px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px;
}

.topic-new-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 14px;
}

.topic-new-header .back-link:hover {
    color: var(--accent-bright);
}

.topic-new-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.topic-new-header .desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.topic-new-form {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px 30px;
}

.topic-new-form .form-field {
    margin-bottom: 22px;
}

.topic-new-form .form-field:last-of-type {
    margin-bottom: 0;
}

.topic-new-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 6px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.topic-new-hint i {
    color: var(--accent);
    opacity: 0.7;
    font-size: 11px;
    margin-top: 3px;
    flex-shrink: 0;
}

.topic-new-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
    .topic-hero {
        padding: 20px 20px 18px;
    }
    .topic-hero-name {
        font-size: 20px;
    }
    .topic-hero-stats {
        gap: 14px;
        font-size: 12.5px;
    }
    .topic-post-list .post-card {
        padding: 14px 16px;
    }
    .topic-new-form {
        padding: 22px 20px;
    }
}

@media (max-width: 640px) {
    .topic-hero-top {
        flex-direction: column;
        align-items: stretch;
    }
    .topic-hero-actions {
        justify-content: flex-start;   /* ★ P3 改动：原为 flex-end */
    }
    .topic-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .topic-tabs {
        justify-content: flex-start;
    }
    .topic-post-btn {
        width: 100%;
        justify-content: center;
    }
    .topic-new-header h1 {
        font-size: 22px;
    }
    .topic-new-actions {
        flex-direction: column-reverse;
    }
    .topic-new-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   D7：编辑话题简介 Modal
   ============================================================ */
.edit-topic-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: editTopicFadeIn 0.2s ease;
}

.edit-topic-modal-backdrop[hidden] {
    display: none !important;
}

@keyframes editTopicFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.edit-topic-modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: editTopicSlideIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes editTopicSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.edit-topic-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(0, 0, 0, 0.15);
}

.edit-topic-modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.edit-topic-modal-header h3 i {
    color: var(--accent);
    font-size: 13px;
}

.edit-topic-modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.edit-topic-modal-close:hover {
    background: rgba(224, 82, 82, 0.15);
    color: var(--danger);
    transform: rotate(90deg);
}

.edit-topic-modal-body {
    padding: 20px;
}

.edit-topic-modal-body .form-textarea {
    width: 100%;
    min-height: 100px;
}

.edit-topic-modal-hint {
    margin-top: 6px;
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
}

.edit-topic-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    background: rgba(0, 0, 0, 0.10);
}

.edit-topic-modal-footer .btn {
    padding: 8px 22px;
    font-size: 13.5px;
    font-weight: 600;
}


/* ============================================================
   D8.3：封座 Modal
   ============================================================ */
.seal-topic-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: sealTopicFadeIn 0.2s ease;
}

.seal-topic-modal-backdrop[hidden] {
    display: none !important;
}

@keyframes sealTopicFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.seal-topic-modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid rgba(224, 82, 82, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: sealTopicSlideIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sealTopicSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.seal-topic-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(224, 82, 82, 0.05);
}

.seal-topic-modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.seal-topic-modal-header h3 i {
    color: var(--danger);
    font-size: 13px;
}

.seal-topic-modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.seal-topic-modal-close:hover {
    background: rgba(224, 82, 82, 0.15);
    color: var(--danger);
    transform: rotate(90deg);
}

.seal-topic-modal-body {
    padding: 20px;
}

.seal-topic-modal-hint {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 16px;
    padding: 10px 14px;
    background: rgba(224, 82, 82, 0.05);
    border-left: 3px solid var(--danger);
    border-radius: 0 6px 6px 0;
}

.seal-topic-modal-hint strong {
    color: var(--danger);
    font-weight: 600;
}

.seal-topic-modal-body .editor-field {
    margin-bottom: 0;
}

.seal-topic-modal-body .editor-field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.seal-topic-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    background: rgba(0, 0, 0, 0.10);
}

.seal-topic-modal-footer .btn {
    padding: 8px 22px;
    font-size: 13.5px;
    font-weight: 600;
}


/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 640px) {
    .edit-topic-modal-footer,
    .seal-topic-modal-footer {
        flex-direction: column-reverse;
    }
    .edit-topic-modal-footer .btn,
    .seal-topic-modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}