/* =====================================================
   发帖机网站 - 全局样式（前台 + 后台）
   主色调：绿色（与论坛主题一致）
   ===================================================== */
:root {
    --primary: #16a34a;
    --primary-dark: #15803d;
    --primary-light: #dcfce7;
    --accent: #07c160;
    --danger: #e53935;
    --warning: #f59e0b;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --bg: #f4f6f8;
    --card: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ========== 顶部导航 ========== */
.topbar {
    background: linear-gradient(90deg, #16a34a, #07c160);
    color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 16px; }
.brand:hover { color: #fff; }
.brand-logo {
    width: 30px; height: 30px; border-radius: 7px;
    background: #fff; color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 17px;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
    color: rgba(255,255,255,.88);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
.nav a.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.user-chip {
    font-size: 12px; color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.15);
    padding: 3px 9px; border-radius: 20px;
}
.user-chip b { font-weight: 600; }
.user-chip b.expired { color: #ffd6d6; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 18px; border-radius: 7px; border: 1px solid transparent;
    font-size: 14px; cursor: pointer; transition: all .15s;
    line-height: 1.4;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: transparent; border-color: currentColor; color: inherit; }
.btn-outline:hover { background: rgba(0,0,0,.05); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c62828; color: #fff; }
.btn-success { background: var(--primary); color: #fff; }
.btn-success:hover { background: var(--primary-dark); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 4px 11px; font-size: 13px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.topbar .btn-outline { border-color: rgba(255,255,255,.7); color: #fff; }
.topbar .btn-outline:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ========== 卡片 ========== */
.card {
    background: var(--card);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    margin-bottom: 18px;
    overflow: hidden;
}
.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 15px;
    display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 20px; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-label .req { color: var(--danger); }
.form-control {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: 7px;
    font-size: 14px; font-family: inherit; color: var(--text);
    background: #fff; transition: border .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
textarea.form-control { resize: vertical; }
select.form-control { height: 40px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.form-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 颜色选择 */
.color-row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.color-dot {
    width: 26px; height: 26px; border-radius: 5px; cursor: pointer;
    border: 2px solid transparent; display: inline-block;
}
.color-dot.on { border-color: var(--text); transform: scale(1.12); }
#title.title-bold { font-weight: 700; }
#title.title-underline { text-decoration: underline; }

/* ========== 富文本工具栏 ========== */
.editor-box { border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.editor-toolbar {
    display: flex; flex-wrap: wrap; gap: 3px; padding: 6px;
    background: #f9fafb; border-bottom: 1px solid var(--border);
}
.editor-toolbar button {
    min-width: 30px; height: 30px; padding: 0 8px;
    border: 1px solid var(--border); background: #fff; border-radius: 5px;
    cursor: pointer; font-size: 13px; font-family: inherit; color: var(--text);
}
.editor-toolbar button:hover { background: var(--primary-light); border-color: var(--primary); }
.editor-toolbar .sep { width: 1px; background: var(--border); margin: 2px 4px; }
.editor-box textarea { border: 0; border-radius: 0; resize: vertical; }

/* ========== 提示 ========== */
.alert { padding: 11px 15px; border-radius: 7px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ========== 表格 ========== */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #f9fafb; font-weight: 600; color: var(--text-light); white-space: nowrap; }
.table tr:hover td { background: #fafafa; }
.table .text-truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 状态徽章 */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 12px; font-weight: 600; line-height: 1.6;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-green { background: var(--primary); color: #fff; }

/* ========== 分页 ========== */
.pagination { display: flex; gap: 5px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; color: var(--text); background: #fff;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .cur { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== 登录/注册卡片 ========== */
.auth-wrap { max-width: 420px; margin: 40px auto; }
.auth-wrap .form-control { font-size: 16px; } /* 16px 防止 iOS 聚焦输入框自动放大 */
.auth-title { text-align: center; margin-bottom: 22px; }
.auth-title h1 { font-size: 22px; }
.auth-title p { color: var(--text-light); font-size: 13px; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-light); }

/* ========== 页脚 ========== */
.footer { text-align: center; padding: 22px 0; color: var(--text-light); font-size: 12px; margin-top: 10px; }

/* ========== 可视化富文本编辑器 ========== */
.rt-editor-wrap { border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: #fff; }
.rt-toolbar { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px; background: #f9fafb; border-bottom: 1px solid var(--border); }
.rt-toolbar button {
    min-width: 28px; height: 28px; padding: 0 8px; border: 1px solid var(--border);
    background: #fff; border-radius: 5px; cursor: pointer; font-size: 13px; color: var(--text);
}
.rt-toolbar button:hover { background: var(--primary-light); border-color: var(--primary); }
.rt-toolbar .sep { width: 1px; background: var(--border); margin: 2px 4px; }
.rt-editor { min-height: 220px; padding: 10px 12px; font-size: 14px; line-height: 1.7; outline: none; word-break: break-word; }
.rt-editor:focus { box-shadow: inset 0 0 0 1px var(--primary); }
.rt-editor img { max-width: 100%; }
.rt-editor blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--primary); background: #f9fafb; }
.rt-editor hr { border: none; border-top: 1px solid #ddd; margin: 10px 0; }
.rt-editor pre { margin: 6px 0; padding: 8px 10px; background: #f6f8fa; border: 1px solid #e5e7eb; border-radius: 5px; font-family: Consolas, Monaco, monospace; font-size: 13px; white-space: pre-wrap; word-break: break-all; }
.rt-editor ul, .rt-editor ol { padding-left: 22px; }

/* 内容预览（HTML 排版显示，点击打开弹窗） */
.content-preview { max-height: 60px; overflow: hidden; font-size: 13px; line-height: 1.6; word-break: break-word; }
.content-preview img { max-width: 40px; max-height: 40px; vertical-align: middle; }
.content-preview b, .content-preview strong { font-weight: 700; }
.content-click { cursor: pointer; }
.content-click:hover { background: var(--primary-light); }

/* 弹窗 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: #fff; border-radius: 10px; width: 100%; max-width: 680px; max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal-header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.modal-close { font-size: 24px; color: #999; text-decoration: none; line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 16px 18px; overflow-y: auto; font-size: 14px; line-height: 1.7; word-break: break-word; }
.modal-body img { max-width: 100%; }
.modal-body blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--primary); background: #f9fafb; }
.modal-body hr { border: none; border-top: 1px solid #ddd; margin: 10px 0; }
.modal-body pre { margin: 6px 0; padding: 8px 10px; background: #f6f8fa; border: 1px solid #e5e7eb; border-radius: 5px; white-space: pre-wrap; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ========== 开奖彩球（3D 球体） ========== */
.lotto-ball {
    display: inline-block; width: 40px; height: 40px; line-height: 40px;
    border-radius: 50%; color: #fff; text-align: center; font-size: 18px;
    font-weight: 700; vertical-align: middle;
    text-shadow: 0 1px 1px rgba(0,0,0,.4);
    box-shadow: inset 0 -3px 5px rgba(0,0,0,.35), 0 2px 3px rgba(0,0,0,.25);
    position: relative;
}
.lotto-ball::after {
    content: ''; position: absolute; top: 6px; left: 9px; width: 16px; height: 10px;
    background: rgba(255,255,255,.6); border-radius: 50%; transform: rotate(-20deg);
}
.lotto-ball-cell {
    display: inline-block; text-align: center;
    margin-right: 6px; vertical-align: middle;
}
.ball-sub {
    display: block; font-size: 12px; color: #555; line-height: 1.2; margin-top: 2px; white-space: nowrap;
}
.ball-red   { background: radial-gradient(circle at 35% 30%, #ff8a80, #e53935 55%, #b71c1c); }
.ball-blue  { background: radial-gradient(circle at 35% 30%, #90caf9, #1e88e5 55%, #0d47a1); }
.ball-green { background: radial-gradient(circle at 35% 30%, #a5d6a7, #16a34a 55%, #0b6623); }
.plus { display: inline-block; margin: 0 4px; color: #999; font-weight: 700; }

/* ========== 空状态 ========== */
.empty { text-align: center; padding: 40px 0; color: var(--text-light); }
.empty .icon { font-size: 40px; display: block; margin-bottom: 8px; }

/* ========== 统计卡片 ========== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
    background: var(--card); border-radius: 10px; padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-card .num { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-card .lbl { font-size: 13px; color: var(--text-light); margin-top: 2px; }
.stat-card.green { border-top: 3px solid #16a34a; }
.stat-card.green .num { color: #16a34a; }
.stat-card.orange { border-top: 3px solid var(--warning); }
.stat-card.red { border-top: 3px solid var(--danger); }
.stat-card.blue { border-top: 3px solid #3b82f6; }
.stat-card.blue .num { color: #3b82f6; }
.stat-card.red .num { color: var(--danger); }
.stat-card.orange .num { color: var(--warning); }

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .topbar-inner { height: auto; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
    .nav { order: 3; width: 100%; }
    .form-row .form-group { flex: 1 1 100%; }
}
