/* ============================================
   十八中论坛 - 主样式（贴吧风格）
   ============================================ */

:root {
    --bg: #f4f4f4;
    --card: #ffffff;
    --text: #333333;
    --text-secondary: #666666;
    --link: #1a6fc4;
    --border: #e0e0e0;
    --muted: #999999;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --accent: #1a6fc4;
    --danger: #d32f2f;
    --success: #388e3c;
    --warning: #f57c00;
    --gold: #ffb300;
}

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

body {
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--link);
    text-decoration: none;
    word-break: break-all;
}

a:active {
    opacity: 0.7;
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   容器
   ============================================ */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 8px;
}

/* ============================================
   卡片
   ============================================ */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.card-title a {
    color: var(--text);
}

.card-body {
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
    color: var(--text-secondary);
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

@media (max-width:480px) {
    .footer-version { display:none; }
}

/* ============================================
   按钮
   ============================================ */
.btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    white-space: nowrap;
    color: var(--text);
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
    opacity: 0.85;
}

.btn-primary {
    background: var(--link);
    color: #fff;
    border-color: var(--link);
    font-weight: 600;
}

.btn-primary:hover {
    background: #165a9e;
    border-color: #165a9e;
}

.btn-sm {
    padding: 3px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 15px;
}

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #ffebee;
}

.btn-success {
    color: var(--success);
    border-color: var(--success);
}

.btn-warning {
    color: var(--warning);
    border-color: var(--warning);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ============================================
   表单
   ============================================ */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--link);
    box-shadow: 0 0 0 2px rgba(26, 111, 196, 0.15);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

label {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

input[type="file"] {
    font-size: 13px;
}

/* ============================================
   工具类
   ============================================ */
.flex {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-col {
    flex-direction: column;
}

.gap-xs {
    gap: 2px;
}

.gap-sm {
    gap: 4px;
}

.gap-md {
    gap: 12px;
}

.gap-lg {
    gap: 16px;
}

.mb-sm {
    margin-bottom: 6px;
}

.mb-md {
    margin-bottom: 10px;
}

.mb-lg {
    margin-bottom: 16px;
}

.mt-sm {
    margin-top: 6px;
}

.mt-md {
    margin-top: 10px;
}

.p-sm {
    padding: 6px;
}

.p-md {
    padding: 12px;
}

.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 11px;
}

.text-lg {
    font-size: 16px;
}

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

.text-secondary {
    color: var(--text-secondary);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.w-full {
    width: 100%;
}

.rounded {
    border-radius: var(--radius);
}

.divider {
    border-top: 1px solid var(--border);
    margin: 10px 0;
}

.hidden {
    display: none !important;
}

/* ============================================
   徽章
   ============================================ */
.badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
    line-height: 1.6;
}

.badge-admin {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(211, 47, 47, 0.3);
}

.badge-mod {
    background: linear-gradient(135deg, #1a6fc4, #0d47a1);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(26, 111, 196, 0.3);
}

.badge-pending {
    background: var(--warning);
    color: #fff;
}

.badge-approved {
    background: var(--success);
    color: #fff;
}

.badge-rejected {
    background: var(--danger);
    color: #fff;
}

/* ============================================
   头像
   ============================================ */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    flex-shrink: 0;
    overflow: hidden;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 14px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 28px;
}

/* ============================================
   帖子列表
   ============================================ */
.post-item {
    transition: transform 0.1s;
}

.post-item:active {
    transform: scale(0.99);
}

.post-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.post-stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--muted);
}

.post-stat.active {
    color: var(--link);
}

/* ============================================
   评论
   ============================================ */
.comment-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-reply {
    margin-left: 24px;
    padding-left: 12px;
    border-left: 2px solid var(--border);
}

/* ============================================
   分页
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 12px 0;
}

.pagination .btn {
    min-width: 32px;
    justify-content: center;
}

.pagination .btn.active {
    background: var(--link);
    color: #fff;
    border-color: var(--link);
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
    text-align: center;
    padding: 36px 16px;
    color: var(--muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 8px;
}

/* ============================================
   加载
   ============================================ */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--link);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 6px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   通知列表
   ============================================ */
.notification-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: rgba(26, 111, 196, 0.04);
    margin: 0 -12px;
    padding: 10px 12px;
}

.notification-item .notif-icon {
    font-size: 20px;
    flex-shrink: 0;
}

/* ============================================
   仪表盘
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--link);
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* ============================================
   搜索
   ============================================ */
.search-box {
    position: relative;
}

.search-box input {
    padding-right: 60px;
}

.search-box .search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.search-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

/* ============================================
   设置
   ============================================ */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item:active {
    background: rgba(0, 0, 0, 0.02);
}

.settings-item .settings-label {
    font-size: 14px;
}

.settings-item .settings-desc {
    font-size: 12px;
    color: var(--muted);
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 480px) {
    .container {
        padding: 6px;
    }

    .card {
        padding: 10px;
        border-radius: 6px;
        margin-bottom: 6px;
    }

    .card-title {
        font-size: 14px;
    }

    .btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   打印
   ============================================ */
@media print {
    .navbar,
    .tab-bar,
    .btn,
    #toast {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
