/* ============================================
   XBlog - 仿推特(X)微博客主题样式
   ============================================ */

/* ===== CSS 变量 - 深色模式 ===== */
.theme-dark {
    --bg-primary: #000000;
    --bg-secondary: #16181c;
    --bg-tertiary: #1d1f23;
    --bg-hover: #1d1f23;
    --bg-active: #1d1f23;
    --text-primary: #e7e9ea;
    --text-secondary: #71767b;
    --text-tertiary: #536471;
    --border-color: #2f3336;
    --accent: #1d9bf0;
    --accent-hover: #1a8cd8;
    --accent-bg: rgba(29, 155, 240, 0.1);
    --red: #f4212e;
    --red-bg: rgba(244, 33, 46, 0.1);
    --green: #00ba7c;
    --green-bg: rgba(0, 186, 124, 0.1);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* ===== CSS 变量 - 浅色模式 ===== */
.theme-light {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f9f9;
    --bg-tertiary: #eff3f4;
    --bg-hover: #eff3f4;
    --bg-active: #eff3f4;
    --text-primary: #0f1419;
    --text-secondary: #536471;
    --text-tertiary: #536471;
    --border-color: #eff3f4;
    --accent: #1d9bf0;
    --accent-hover: #1a8cd8;
    --accent-bg: rgba(29, 155, 240, 0.1);
    --red: #f4212e;
    --red-bg: rgba(244, 33, 46, 0.1);
    --green: #00ba7c;
    --green-bg: rgba(0, 186, 124, 0.1);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

::selection { background: var(--accent-bg); }

/* ===== 主布局 ===== */
.app {
    display: flex;
    min-height: 100vh;
    justify-content: center;
    width: 100%;
}

.left-sidebar {
    position: sticky;
    top: 0;
    width: 275px;
    height: 100vh;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding: 0 12px;
    display: flex;
    flex-direction: column;
}

.sidebar-inner {
    flex: 1;
    overflow-y: auto;
    padding-top: 12px;
    padding-bottom: 80px;
}

/* ===== Logo ===== */
.logo {
    display: inline-flex;
    padding: 10px;
    margin-bottom: 4px;
    border-radius: 50%;
    color: var(--text-primary);
    width: fit-content;
}
.logo:hover { background: var(--accent-bg); text-decoration: none; }
.logo svg { fill: currentColor; }

/* ===== 导航菜单 ===== */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px;
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--bg-hover);
    text-decoration: none;
}
.nav-item.active { font-weight: 700; }
.nav-item svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
    flex-shrink: 0;
}
.nav-item span { white-space: nowrap; }

/* ===== 按钮 ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    text-decoration: none;
    line-height: 1;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--accent); }

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    line-height: 1;
}
.btn-outline:hover { background: var(--accent-bg); text-decoration: none; }

.nav-compose-btn {
    margin: 16px 8px 12px;
    min-height: 52px;
}

/* ===== 用户卡片 ===== */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: auto;
}
.user-card:hover { background: var(--bg-hover); }
.user-card img { border-radius: 50%; flex-shrink: 0; }
.user-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.user-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-card-handle {
    font-size: 15px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logout-btn {
    display: flex;
    color: var(--text-secondary);
    padding: 4px;
}
.logout-btn svg { fill: currentColor; }

/* ===== 主题切换 ===== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    margin: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}
.theme-toggle:hover { background: var(--bg-hover); }
.theme-toggle svg { width: 22px; height: 22px; fill: currentColor; }
.theme-dark .theme-icon-moon { display: none; }
.theme-light .theme-icon-sun { display: none; }

/* ===== 内容区域 ===== */
.content-area {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    min-width: 0;
    max-width: 990px;
}

.main-content {
    display: flex;
    max-width: 990px;
    width: 100%;
    gap: 0;
}

/* ===== 信息流 ===== */
.feed {
    flex: 1;
    max-width: 600px;
    min-width: 0;
    border-right: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}

.feed-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}
.theme-light .feed-header { background: rgba(255, 255, 255, 0.65); }

.feed-title {
    padding: 15px 16px;
    font-size: 20px;
    font-weight: 700;
}

.feed-tabs {
    display: flex;
}
.feed-tab {
    flex: 1;
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
    transition: background 0.2s, color 0.2s;
    border-bottom: 3px solid transparent;
}
.feed-tab:hover {
    background: var(--bg-hover);
    text-decoration: none;
    color: var(--accent);
}
.feed-tab.active {
    color: var(--text-primary);
    font-weight: 700;
    border-bottom-color: var(--accent);
}

/* ===== 发布推文框 ===== */
.compose-box {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.compose-avatar img { border-radius: 50%; }
.compose-area { flex: 1; }
.compose-area textarea,
.modal-textarea textarea {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 20px;
    font-family: inherit;
    resize: none;
    outline: none;
    padding: 12px 0;
    line-height: 1.4;
}
.compose-area textarea::placeholder,
.modal-textarea textarea::placeholder { color: var(--text-secondary); }

.compose-footer,
.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
}
#compose-count,
#modal-compose-count {
    font-size: 13px;
    color: var(--text-secondary);
}
#compose-count.over-limit,
#modal-compose-count.over-limit {
    color: var(--red);
}

.compose-guest {
    flex-direction: column;
    padding: 24px 16px;
    text-align: center;
}
.compose-guest-text strong {
    font-size: 19px;
    display: block;
    margin-bottom: 8px;
}
.compose-guest-text p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.compose-guest-text .btn-primary {
    display: inline-block;
    padding: 12px 32px;
}

/* ===== 推文卡片 ===== */
.tweet {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}
.tweet:hover { background: var(--bg-hover); }

.tweet-avatar img {
    border-radius: 50%;
    flex-shrink: 0;
}

.tweet-body { flex: 1; min-width: 0; }

.tweet-header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}
.tweet-name {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 15px;
}
.tweet-name:hover { text-decoration: underline; }
.tweet-handle,
.tweet-time,
.tweet-dot {
    color: var(--text-secondary);
    font-size: 15px;
}
.tweet-time:hover { text-decoration: underline; }

.tweet-follow-btn {
    margin-left: auto;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--text-primary);
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tweet-follow-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.tweet-follow-btn.following {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}
.tweet-follow-btn.following:hover {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red);
}
.tweet-follow-btn.following:hover::after { content: ' 取消关注'; }
.tweet-follow-btn.following::after { content: ''; }

.tweet-content {
    font-size: 15px;
    line-height: 1.4;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.tweet-content a.mention,
.tweet-content a.hashtag { color: var(--accent); }

.tweet-media {
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.tweet-media img { width: 100%; border-radius: 16px; }

/* ===== 推文操作栏 ===== */
.tweet-actions {
    display: flex;
    justify-content: space-between;
    max-width: 425px;
    margin-top: 12px;
    padding-right: 8px;
}
.tweet-action {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 999px;
    transition: color 0.2s, background 0.2s;
}
.tweet-action svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.tweet-action-reply:hover { color: var(--accent); background: var(--accent-bg); }
.tweet-action-retweet:hover { color: var(--green); background: var(--green-bg); }
.tweet-action-like:hover { color: var(--red); background: var(--red-bg); }
.tweet-action-like.liked { color: var(--red); }
.tweet-action-like.liked svg { fill: currentColor; }
.tweet-action-share:hover { color: var(--accent); background: var(--accent-bg); }
.tweet-action span { min-width: 16px; }

/* ===== 右侧边栏 ===== */
.sidebar {
    width: 350px;
    flex-shrink: 0;
    padding: 0 16px;
}
.sidebar-section { margin-top: 16px; }

.search-box {
    position: sticky;
    top: 0;
    z-index: 90;
    padding: 8px 0;
    background: var(--bg-primary);
}
.search-form {
    position: relative;
    width: 100%;
}
.search-form input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: none;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: background 0.2s;
}
.search-form input:focus {
    background: var(--bg-primary);
    border: 1px solid var(--accent);
}
.search-form input::placeholder { color: var(--text-secondary); }
.search-form svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
    pointer-events: none;
}

.sidebar-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 16px;
    overflow: hidden;
}
.sidebar-card-title {
    padding: 12px 16px 8px;
    font-size: 20px;
    font-weight: 800;
}

.trend-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.trend-item:hover { background: var(--bg-hover); }
.trend-category {
    font-size: 13px;
    color: var(--text-secondary);
}
.trend-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2px 0;
}
.trend-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.sidebar-card-more {
    display: block;
    padding: 12px 16px;
    color: var(--accent);
    font-size: 15px;
    transition: background 0.2s;
}
.sidebar-card-more:hover { background: var(--bg-hover); text-decoration: none; }

/* 推荐关注 */
.suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.suggest-item:hover { background: var(--bg-hover); }
.suggest-item img { border-radius: 50%; flex-shrink: 0; }
.suggest-info { flex: 1; min-width: 0; }
.suggest-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.suggest-name:hover { text-decoration: underline; }
.suggest-handle {
    font-size: 13px;
    color: var(--text-secondary);
}

.follow-small-btn {
    padding: 6px 16px;
    border-radius: 999px;
    border: none;
    background: var(--text-primary);
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.follow-small-btn:hover { background: var(--accent-hover); color: #fff; }
.follow-small-btn.following {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* ===== 空状态 ===== */
.empty-state {
    padding: 48px 16px;
    text-align: center;
}
.empty-state h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}
.empty-state p {
    color: var(--text-secondary);
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    list-style: none;
}
.page-item {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--accent);
    font-size: 14px;
    transition: background 0.2s;
}
.page-item:hover { background: var(--accent-bg); text-decoration: none; }
.page-item.current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ===== 个人资料页 ===== */
.profile-header {
    border-bottom: 1px solid var(--border-color);
}
.profile-banner {
    height: 200px;
    background: var(--bg-tertiary);
    background-size: cover;
    background-position: center;
}
.profile-info {
    padding: 0 16px;
    margin-top: -67px;
    margin-bottom: 16px;
}
.profile-avatar {
    width: 134px;
    height: 134px;
    border-radius: 50%;
    border: 4px solid var(--bg-primary);
    overflow: hidden;
    display: inline-block;
    margin-bottom: 16px;
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}
.profile-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}
.profile-details {
    padding-bottom: 16px;
}
.profile-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}
.profile-handle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.profile-bio {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
}
.profile-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.profile-meta a { color: var(--text-secondary); }
.profile-meta a:hover { text-decoration: underline; color: var(--accent); }
.profile-meta a span { color: var(--text-primary); font-weight: 700; }
.profile-stats {
    display: flex;
    gap: 20px;
    font-size: 15px;
    color: var(--text-secondary);
}
.profile-stats a { color: var(--text-secondary); }
.profile-stats a:hover { text-decoration: underline; color: var(--accent); }
.profile-stats span { color: var(--text-primary); font-weight: 700; }

.profile-follow-btn {
    padding: 8px 24px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--text-primary);
    color: var(--bg-primary);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.profile-follow-btn:hover { background: var(--accent-hover); color: #fff; border-color: var(--accent-hover); }
.profile-follow-btn.following {
    background: transparent;
    color: var(--text-primary);
}
.profile-follow-btn.following:hover {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red);
}

/* ===== 推文详情页 ===== */
.tweet-detail {
    border-bottom: 1px solid var(--border-color);
}
.tweet-detail .tweet {
    cursor: default;
}
.tweet-detail .tweet-content {
    font-size: 20px;
    line-height: 1.4;
    margin: 12px 0;
}
.tweet-detail-time {
    color: var(--text-secondary);
    font-size: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.tweet-detail-stats {
    display: flex;
    gap: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
    color: var(--text-secondary);
}
.tweet-detail-stats span { color: var(--text-primary); font-weight: 700; }

/* ===== 评论/回复 ===== */
.comments-section {
    padding: 0;
}
.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.comment-avatar img { border-radius: 50%; }
.comment-body { flex: 1; min-width: 0; }
.comment-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}
.comment-name {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 15px;
}
.comment-name:hover { text-decoration: underline; }
.comment-handle,
.comment-time {
    color: var(--text-secondary);
    font-size: 15px;
}

.comment-form {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.comment-form img { border-radius: 50%; flex-shrink: 0; }
.comment-form-area { flex: 1; }
.comment-form textarea {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 20px;
    font-family: inherit;
    resize: none;
    outline: none;
    padding: 12px 0;
}
.comment-form textarea::placeholder { color: var(--text-secondary); }
.comment-form-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
}

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-box {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 600px;
    max-width: 90vw;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}
.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background 0.2s;
}
.modal-close:hover { background: var(--bg-hover); }
.modal-body {
    display: flex;
    gap: 12px;
    padding: 16px;
}
.modal-avatar img { border-radius: 50%; }
.modal-textarea { flex: 1; }
.modal-textarea textarea {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 20px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.4;
}
.modal-textarea textarea::placeholder { color: var(--text-secondary); }

/* ===== 认证表单 ===== */
.auth-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}
.form-group textarea {
    resize: vertical;
    min-height: 80px;
}
.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}
.auth-form button {
    width: 100%;
    padding: 10px;
}
#login-to-register,
#register-to-login {
    margin-top: 8px;
}
.profile-bio {
    margin: 8px 0;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
}

/* ===== 页脚 ===== */
.site-footer {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
}
.footer-inner {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.footer-inner a { color: var(--text-secondary); }
.footer-inner a:hover { text-decoration: underline; }

/* ===== 归档页标题 ===== */
.archive-title-bar {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 20px;
    font-weight: 800;
}

/* ===== 404页面 ===== */
.error-page {
    padding: 48px 16px;
    text-align: center;
}
.error-page h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 16px;
}
.error-page p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===== 移动端底部导航 ===== */
.mobile-nav {
    display: none;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1100px) {
    .sidebar { display: none; }
    .feed { border-right: none; }
}

@media (max-width: 900px) {
    .left-sidebar {
        width: 88px;
        padding: 0 8px;
    }
    .nav-item span,
    .nav-compose-btn span,
    .user-card-info {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .nav-compose-btn {
        padding: 16px;
        margin: 16px auto 12px;
    }
    .nav-compose-btn::after {
        content: '+';
        font-size: 24px;
    }
    .user-card {
        justify-content: center;
        padding: 8px;
    }
    .user-card img { width: 40px; height: 40px; }
}

@media (max-width: 600px) {
    .left-sidebar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        height: 56px;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 0;
        z-index: 200;
        background: var(--bg-primary);
    }
    .sidebar-inner {
        display: none;
    }
    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 100%;
        padding: 0 8px;
    }
    .mobile-nav-item {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px 16px;
        color: var(--text-secondary);
        border-radius: 50%;
        transition: color 0.2s;
    }
    .mobile-nav-item.active { color: var(--accent); }
    .mobile-nav-item svg { width: 26px; height: 26px; fill: currentColor; }
    .mobile-nav-compose {
        display: flex;
        align-items: center;
        padding: 8px;
        background: var(--accent);
        color: #fff;
        border-radius: 50%;
    }
    .mobile-nav-compose svg { width: 22px; height: 22px; fill: currentColor; }
}

/* ===== 图片上传预览（发布推文弹窗内） ===== */
.compose-preview {
    margin: 8px 0;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    max-height: 300px;
}
.compose-preview-item {
    position: relative;
    display: block;
}
.compose-preview-item img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
    border-radius: 16px;
}
.compose-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.compose-preview-remove:hover {
    background: rgba(244, 33, 46, 0.9);
}

/* ===== 推文图片样式 ===== */
.tweet-media {
    margin: 10px 0 4px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    cursor: zoom-in;
}
.tweet-media img {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.tweet-media:hover img {
    transform: scale(1.02);
}

/* ===== 发布推文弹窗工具栏 ===== */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}
.modal-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
}
.compose-tool-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.compose-tool-btn:hover {
    background: var(--accent-bg);
}
.compose-tool-btn svg {
    fill: currentColor;
}

/* ===== 灯箱样式 ===== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.lightbox-container {
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-container img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
    user-select: none;
    -webkit-user-drag: none;
}
.lightbox-close,
.lightbox-nav {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    backdrop-filter: blur(4px);
}
.lightbox-close {
    top: 20px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
}
.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
}
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-close:hover,
.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 12px;
}

/* ===== 优化布局美化 ===== */

/* 顶部 sticky 搜索框美化 */
.sidebar .search-box {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
    padding: 12px 0;
    margin: -12px 0 0;
}
.search-form {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 999px;
    padding: 10px 16px;
    transition: background 0.2s;
}
.search-form:focus-within {
    background: var(--bg-secondary);
    box-shadow: 0 0 0 1px var(--accent);
}
.search-form svg {
    width: 18px;
    height: 18px;
    fill: var(--text-secondary);
    margin-right: 10px;
    flex-shrink: 0;
}
.search-form input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    font-family: inherit;
}
.search-form input::placeholder {
    color: var(--text-secondary);
}

/* 侧边栏卡片美化 */
.sidebar-card {
    background: var(--bg-secondary);
    border-radius: 14px;
    margin-top: 14px;
    padding: 4px 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.sidebar-card-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-primary);
    padding: 12px 16px 8px;
    margin: 0;
}
.trend-item,
.suggest-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
    gap: 10px;
}
.trend-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.trend-item:hover,
.suggest-item:hover {
    background: var(--bg-hover);
}
.trend-category {
    font-size: 12px;
    color: var(--text-secondary);
}
.trend-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.trend-count {
    font-size: 13px;
    color: var(--text-secondary);
}
.sidebar-card-more {
    display: block;
    padding: 12px 16px;
    color: var(--accent);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s;
}
.sidebar-card-more:hover {
    background: var(--bg-hover);
}

/* 推荐关注项 */
.suggest-item img {
    border-radius: 50%;
    flex-shrink: 0;
}
.suggest-info {
    flex: 1;
    min-width: 0;
}
.suggest-name {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.suggest-name:hover {
    text-decoration: underline;
}
.suggest-handle {
    color: var(--text-secondary);
    font-size: 13px;
}
.follow-small-btn {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.1s;
}
.follow-small-btn:hover {
    opacity: 0.9;
}
.follow-small-btn.following {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.follow-small-btn.following:hover {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red);
}

/* 页脚链接美化 */
.site-footer {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}
.footer-inner {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 990px;
    margin: 0 auto;
}
.footer-inner a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-inner a:hover {
    color: var(--accent);
}

/* 推文卡片整体优化 */
.tweet {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
}
.tweet:hover {
    background: var(--bg-hover);
}
.tweet-avatar img {
    border-radius: 50%;
    flex-shrink: 0;
}
.tweet-body {
    flex: 1;
    min-width: 0;
}
.tweet-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.tweet-name {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
}
.tweet-name:hover {
    text-decoration: underline;
}
.tweet-handle,
.tweet-dot,
.tweet-time {
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
}
.tweet-time:hover {
    text-decoration: underline;
    color: var(--accent);
}
.tweet-content {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.tweet-content a {
    color: var(--accent);
    text-decoration: none;
}
.tweet-content a:hover {
    text-decoration: underline;
}
.tweet-actions {
    display: flex;
    justify-content: space-between;
    max-width: 425px;
    margin-top: 10px;
}
.tweet-action {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 999px;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
}
.tweet-action svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.tweet-action-reply:hover {
    color: var(--accent);
    background: var(--accent-bg);
}
.tweet-action-retweet:hover {
    color: var(--green);
    background: var(--green-bg);
}
.tweet-action-like:hover {
    color: var(--red);
    background: var(--red-bg);
}
.tweet-action-like.liked {
    color: var(--red);
}
.tweet-action-like.liked svg {
    fill: currentColor;
}
.tweet-follow-btn {
    margin-left: auto;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.tweet-follow-btn.following {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.tweet-follow-btn.following:hover {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red);
}

/* 发推按钮 */
.btn-primary,
.btn-outline {
    border-radius: 999px;
    padding: 8px 20px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--border-color);
}
.btn-outline:hover {
    background: var(--accent-bg);
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 14px;
    z-index: 10000;
    animation: toast-in 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    text-align: center;
}
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== 响应式（移动端） ===== */
@media (max-width: 1100px) {
    .sidebar { display: none; }
}
@media (max-width: 700px) {
    .left-sidebar {
        display: none;
    }
    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 0;
        z-index: 200;
        background: var(--bg-primary);
    }
    .mobile-nav-compose {
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--accent);
        border: none;
        border-radius: 50%;
        width: 48px;
        height: 48px;
        cursor: pointer;
    }
    .mobile-nav-compose svg { width: 24px; height: 24px; fill: #fff; }
    .main-content { padding-bottom: 56px; }
    .feed { border-left: none; }
    .compose-box { padding: 12px; }
    .compose-area textarea { font-size: 16px; }
    .modal-box { width: 95vw; border-radius: 0; }
    .modal-overlay { padding-top: 0; align-items: stretch; }
}

@media (max-width: 400px) {
    .tweet-avatar img { width: 40px; height: 40px; }
    .tweet-actions { max-width: 100%; }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ===== 加载动画 ===== */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 24px;
}
.loading-spinner::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 通知提示 ===== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
