/* 移动端专属样式 (< 768px) */

/* 侧边栏/抽屉 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80%;
    background-color: var(--sidebar-bg);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 99;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    height: var(--navbar-height);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: var(--font-size-lg);
    font-weight: 500;
}

.sidebar-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-secondary);
    line-height: 1;
}

.sidebar-nav {
    padding: var(--space-sm) 0;
}

.topic-item {
    display: block;
    padding: var(--space-lg);
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    min-height: 48px;
    display: flex;
    align-items: center;
    transition: background-color var(--transition-fast);
}

.topic-item:active {
    background-color: var(--bg-color);
}

.topic-item.active {
    background-color: var(--bg-color);
    color: var(--accent-color);
    font-weight: 500;
}

/* 消息气泡 - 移动端 */
.message {
    margin-bottom: 10px;  /* 微信风格：紧凑的消息间距 */
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;  /* 微信风格：减小头像与气泡间距 */
}

.message-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 4px;
    margin-right: var(--space-md);
    object-fit: cover;
    flex-shrink: 0;
}

.message-author {
    /* 微信官方设计：浅灰色，小字体，无粗体 */
    font-size: 13px;
    color: #999999;  /* 与时间戳相同的灰色 */
    font-weight: normal;
}

.message-bubble {
    background-color: var(--bubble-bg);
    border-radius: 12px;
    padding: var(--space-md);
    box-shadow: var(--shadow);
    margin-left: calc(var(--avatar-size) + var(--space-md));
    max-width: 80%;
    word-wrap: break-word;
    word-break: break-word;
}

.message-content {
    font-size: var(--font-size-base);
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-time {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    margin-left: calc(var(--avatar-size) + var(--space-md));
}

/* 时间戳分隔符 - 微信风格 */
.timestamp-separator {
    text-align: center;
    margin: 12px 0 8px 0;  /* 微信风格：更紧凑的时间戳间距 */
    position: relative;
}

.timestamp-text {
    display: inline-block;
    font-size: 12px;
    color: #999999;
    /* 微信官方设计：无背景色，纯文字显示 */
    line-height: 1.4;
}

/* 暗色模式下的时间戳样式 */
@media (prefers-color-scheme: dark) {
    .timestamp-text {
        /* 暗色模式下也不需要背景色 */
        color: #8b8b8b;
    }
}

/* 话题容器 */
.topic-container {
    min-height: 100vh;
    padding: 10px 12px;  /* 微信风格：更紧凑的边距 */
    transition: background-color 0.3s ease;
    margin-bottom: 2px;
    position: relative;
}

/* 主题分隔 */
.topic-title {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--text-primary);
    padding: 10px 0;  /* 微信风格：更紧凑的标题间距 */
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;  /* 减小标题下方的间距 */
    position: sticky;
    top: 0;
    background-color: inherit;
    z-index: 10;
    text-align: center;
}

.thread-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 12px 0;  /* 微信风格：更紧凑的讨论串间距 */
}

/* 底部进度条样式 - 移动端专属 */
.topic-progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    z-index: 90;
    overflow: hidden;
}

/* 进度条项目 */
.progress-item {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f5f5f5;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding: 4px 2px;
}

.progress-item:last-child {
    border-right: none;
}

/* 进度条标题 - 竖向排列 */
.progress-item-title {
    font-size: 10px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.progress-item-title span {
    display: block;
    margin: 2px 0;
    letter-spacing: 0;
}

/* 4个字的特殊处理（量子计算）- 两列布局 */
.progress-item-title.four-char {
    flex-direction: row;
    gap: 2px;
}

/* 每一列的样式 */
.progress-item-title.four-char .char-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.progress-item-title.four-char .char-column span {
    display: block;
    margin: 1px 0;
    letter-spacing: 0;
}

/* 进度条指示器 */
.progress-item-indicator {
    width: 100%;
    height: 3px;
    background-color: rgba(0, 0, 0, 0.1);
    position: absolute;
    bottom: 0;
    left: 0;
    transition: all 0.3s ease;
}

/* 活动状态 */
.progress-item.active {
    background-color: var(--topic-bg, #fef3e7);
}

.progress-item.active .progress-item-title {
    color: #222;
    font-weight: 600;
    font-size: 11px;
}

/* 活动状态下4个字保持相同字体大小 */

.progress-item.active .progress-item-indicator {
    height: 4px;
    background-color: rgba(0, 0, 0, 0.6);
}

/* 已访问状态 */
.progress-item.visited {
    opacity: 0.8;
}

.progress-item.visited .progress-item-title {
    color: #888;
}

/* 为消息容器添加底部内边距，避免被进度条遮挡 */
.main-content {
    padding-bottom: 56px;
}

/* 移动端隐藏返回按钮（因为有底部导航栏） */
@media (max-width: 767px) {
    .navbar-back {
        display: none;
    }
}

/* 在大屏幕上隐藏进度条 */
@media (min-width: 768px) {
    .topic-progress-bar {
        display: none;
    }

    .main-content {
        padding-bottom: 0;
    }
}