/* ============================================================
 * UGC 模块通用样式（社区列表 / 详情 / 发布 / 协议弹窗）
 * - mobile-first，max-width 在外层容器
 * - 颜色风格沿用 style.css 的主色 #1aad5d / 背景 #f5f6f7
 * ============================================================ */

/* ----------- 协议弹窗 ----------- */
.ugc-agree-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.ugc-agree-noscroll {
    overflow: hidden;
}
.ugc-agree-dialog {
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    background: #fff;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}
.ugc-agree-header {
    padding: 16px 20px 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.ugc-agree-header h3 { margin: 0; font-size: 17px; }
.ugc-agree-version { font-size: 12px; color: #999; }
.ugc-agree-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    line-height: 1.7;
    color: #333;
    font-size: 14px;
    border-bottom: 1px dashed #eee;
}
.ugc-agree-body h1, .ugc-agree-body h2, .ugc-agree-body h3 {
    margin: 14px 0 8px; line-height: 1.4;
}
.ugc-agree-body h1 { font-size: 17px; }
.ugc-agree-body h2 { font-size: 15px; }
.ugc-agree-body h3 { font-size: 14px; color: #555; }
.ugc-agree-body p { margin: 8px 0; }
.ugc-agree-body ul { padding-left: 22px; margin: 8px 0; }
.ugc-agree-body hr { border: none; border-top: 1px dashed #ddd; margin: 14px 0; }
.ugc-agree-footer {
    padding: 12px 20px 16px;
    background: #fafafa;
}
.ugc-agree-check {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: #666;
}
.ugc-agree-actions {
    display: flex; gap: 10px; margin-top: 10px;
}
.ugc-agree-actions button {
    flex: 1;
    height: 40px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    cursor: pointer;
}
.ugc-agree-actions .btn-cancel { background: #eee; color: #333; }
.ugc-agree-actions .btn-ok { background: #1aad5d; color: #fff; }
.ugc-agree-actions .btn-ok[disabled] { background: #bce3cb; cursor: not-allowed; }

/* ----------- 社区列表（community.html）----------- */

/* 顶部精简 header */
.community-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}
.community-header .back-btn {
    color: #1aad5d;
    font-size: 22px;
    font-weight: 600;
    text-decoration: none;
}
.community-header h2 {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 16px;
    color: #222;
}
.community-header .header-link {
    color: #1aad5d;
    font-size: 14px;
    text-decoration: none;
}

/* Hero 介绍区 */
.community-hero {
    margin: 12px 12px 4px;
    padding: 14px 16px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1aad5d 0%, #34c97a 60%, #6cd398 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(26,173,93,0.25);
}
.community-hero .hero-text h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}
.community-hero .hero-text p {
    margin: 0;
    font-size: 12.5px;
    opacity: 0.92;
    line-height: 1.5;
}
.community-hero .hero-cta {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.community-hero .hero-btn {
    flex: 1;
    height: 36px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.1s;
}
.community-hero .hero-btn:active { transform: scale(0.97); }
.community-hero .hero-btn.primary {
    background: #fff;
    color: #1aad5d;
}
.community-hero .hero-btn.ghost {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.45);
}

/* tab pill 风格 */
.ugc-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: transparent;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.ugc-tabs::-webkit-scrollbar { display: none; }
.ugc-tabs button {
    flex: 0 0 auto;
    padding: 6px 14px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 16px;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}
.ugc-tabs button .ic { font-size: 14px; }
.ugc-tabs button.active {
    background: #1aad5d; color: #fff; border-color: #1aad5d;
    box-shadow: 0 2px 6px rgba(26,173,93,0.25);
}

/* 列表网格：mobile 单列大卡片 → tablet 双列 */
.ugc-list {
    padding: 4px 12px 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 600px) {
    .ugc-list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
    .ugc-list { grid-template-columns: 1fr 1fr 1fr; }
}
.ugc-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    display: flex;
    flex-direction: row;       /* mobile 横向：图片 + 信息 */
    text-decoration: none;
    color: inherit;
    position: relative;
    transition: transform 0.1s;
}
.ugc-card:active { transform: scale(0.985); }
.ugc-card .cover {
    flex: 0 0 110px;
    width: 110px;
    height: 110px;
    background: #eee no-repeat center / cover;
}
.ugc-card .cover.placeholder {
    background: linear-gradient(135deg, #d4f1e0, #f4f7e8);
    display: flex; align-items: center; justify-content: center;
    color: #1aad5d; font-size: 30px;
}
.ugc-card .info {
    padding: 10px 12px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.ugc-card .title {
    font-size: 14.5px; line-height: 1.4;
    color: #222;
    font-weight: 500;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.ugc-card .meta {
    margin-top: 6px;
    font-size: 12px;
    color: #888;
    display: flex; justify-content: space-between;
    gap: 6px;
}
.ugc-card .meta span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* 大屏（2/3 列）切回纵向卡 */
@media (min-width: 600px) {
    .ugc-card { flex-direction: column; }
    .ugc-card .cover { flex: 0 0 auto; width: 100%; height: auto; aspect-ratio: 4 / 3; }
}
.ugc-tag-strip { font-size: 11px; color: #1aad5d; margin-top: 4px; }
.ugc-empty { padding: 60px 20px; text-align: center; color: #888; }

/* 美化空态：emoji + 标题 + 描述 + 双 CTA */
.ugc-empty-rich {
    margin: 24px 16px;
    padding: 36px 20px 32px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.ugc-empty-rich .emoji {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 14px;
}
.ugc-empty-rich h4 {
    margin: 0 0 6px;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}
.ugc-empty-rich p {
    margin: 0 0 18px;
    color: #999;
    font-size: 13px;
    line-height: 1.5;
}
.ugc-empty-rich .empty-cta {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.ugc-empty-rich .cta-btn {
    padding: 10px 22px;
    border-radius: 22px;
    font-size: 13.5px;
    text-decoration: none;
    font-weight: 500;
}
.ugc-empty-rich .cta-btn.primary {
    background: #1aad5d;
    color: #fff;
    box-shadow: 0 3px 8px rgba(26,173,93,0.3);
}
.ugc-empty-rich .cta-btn.ghost {
    background: #f0f9f3;
    color: #1aad5d;
    border: 1px solid #c8eeda;
}

/* 卡片右上角徽章（草稿 / 待审 / 拒绝 / 加精）*/
.ugc-card { position: relative; }
.ugc-badge {
    position: absolute; top: 6px; right: 6px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    color: #fff;
    background: rgba(0,0,0,0.5);
}
.ugc-badge.pending  { background: #f59e0b; }
.ugc-badge.rejected { background: #ef4444; }
.ugc-badge.removed  { background: #94a3b8; }
.ugc-badge.featured { background: #1aad5d; }

/* ----------- 发布页（ugc-publish.html / ugc-route-publish.html）----------- */
.ugc-form { padding: 14px; }
.ugc-form .field { margin-bottom: 14px; }
.ugc-form label { font-size: 13px; color: #555; display: block; margin-bottom: 6px; }
.ugc-form input[type="text"],
.ugc-form input[type="number"],
.ugc-form input[type="date"],
.ugc-form select,
.ugc-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-sizing: border-box;
}
.ugc-form textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.ugc-form .hint { font-size: 12px; color: #999; margin-top: 4px; }
.ugc-form .submit {
    width: 100%;
    height: 44px;
    background: #1aad5d;
    color: #fff;
    border: none;
    border-radius: 22px;
    font-size: 15px;
    cursor: pointer;
}
.ugc-form .submit[disabled] { background: #bce3cb; }
.ugc-tags-input { display: flex; gap: 6px; flex-wrap: wrap; }
.ugc-tag-chip {
    background: #eef9f1; color: #1aad5d;
    padding: 4px 10px; border-radius: 12px; font-size: 12px;
    cursor: pointer;
}
.ugc-tag-chip.active { background: #1aad5d; color: #fff; }

/* 图片网格（最多 9 张） */
.ugc-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ugc-imgs .cell {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
}
.ugc-imgs .cell img { width: 100%; height: 100%; object-fit: cover; }
.ugc-imgs .cell .rm {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; line-height: 22px;
    text-align: center; border-radius: 50%;
    background: rgba(0,0,0,0.5); color: #fff; font-size: 14px;
    cursor: pointer;
}
.ugc-imgs .add {
    aspect-ratio: 1 / 1;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #999; font-size: 32px; cursor: pointer;
    background: #fafafa;
}

/* ----------- 攻略路线编辑器 ----------- */
.route-day {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.route-day-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.route-day-head h4 { margin: 0; font-size: 15px; }
.route-day-head button {
    background: #fee; color: #ef4444; border: none;
    padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.route-node {
    border-left: 3px solid #1aad5d;
    padding: 8px 10px;
    background: #fafafa;
    border-radius: 0 6px 6px 0;
    margin-bottom: 8px;
    font-size: 13px;
    position: relative;
}
.route-node .rm {
    position: absolute; top: 6px; right: 6px;
    color: #ef4444; cursor: pointer; font-size: 12px;
}
.route-node-add {
    border: 1px dashed #1aad5d; color: #1aad5d;
    padding: 8px; border-radius: 6px;
    text-align: center; cursor: pointer; font-size: 13px;
}
.route-day-add {
    margin: 0 12px 12px;
    border: 1px dashed #aaa; color: #555;
    padding: 10px; border-radius: 8px;
    text-align: center; cursor: pointer;
}

/* ----------- 详情 ----------- */
.ugc-detail {
    padding: 14px;
}
.ugc-detail .author {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px;
}
.ugc-detail .author img {
    width: 36px; height: 36px; border-radius: 50%;
    background: #eee;
}
.ugc-detail .author .name { font-size: 14px; color: #333; }
.ugc-detail .author .time { font-size: 12px; color: #999; }
.ugc-detail .title { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.ugc-detail .body { font-size: 15px; line-height: 1.7; color: #333; white-space: pre-wrap; }
.ugc-detail .imgs { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
.ugc-detail .imgs img { width: 100%; border-radius: 8px; }
.ugc-detail .stats {
    margin-top: 16px;
    padding: 10px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    display: flex; justify-content: space-around;
    font-size: 13px; color: #666;
}
.ugc-detail .stats button {
    background: none; border: none; color: #666;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 12px; cursor: pointer;
}
.ugc-detail .stats button.liked { color: #ef4444; }
.ugc-detail .stats button .icon { font-size: 18px; }

/* 路线详情节点列表 */
.ugc-detail .day-block {
    margin-top: 16px;
    background: #f7faf8;
    padding: 10px 12px;
    border-radius: 8px;
}
.ugc-detail .day-block h4 { margin: 0 0 8px; font-size: 14px; color: #1aad5d; }
.ugc-detail .day-block .node {
    padding: 6px 0;
    border-bottom: 1px dashed #ddd;
    font-size: 13px;
    color: #333;
}
.ugc-detail .day-block .node:last-child { border-bottom: none; }

/* 浮动发布按钮 */
.ugc-fab {
    position: fixed;
    right: 18px; bottom: 78px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #1aad5d;
    color: #fff;
    border: none;
    font-size: 28px;
    box-shadow: 0 6px 16px rgba(26,173,93,0.45);
    cursor: pointer;
    z-index: 99;
}
.ugc-fab.menu {
    width: auto; height: auto;
    border-radius: 14px;
    padding: 6px;
    bottom: 78px;
    right: 18px;
    background: #fff;
    color: #333;
    display: flex; flex-direction: column; gap: 4px;
}
.ugc-fab.menu button {
    background: none; border: none;
    padding: 8px 14px;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
}
.ugc-fab.menu button:hover { background: #f5f5f5; }
