/* ================= 1. 全局与变量 ================= */
:root { 
    --primary: #ff2442; 
    --primary-active: #e0203a;
    --bg: #f8f8f8; 
    --text-main: #333;
    --text-sub: #999;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
}

body { 
    background: var(--bg); 
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; 
    padding-bottom: 80px; /* 为底部导航留空间 */
    -webkit-tap-highlight-color: transparent;
}

/* ================= 2. 导航栏 ================= */
/* 顶部导航 */
.navbar { 
    background: #fff; 
    padding: 12px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: 0 1px 0px rgba(0,0,0,0.05);
}

.logo { font-weight: 900; color: var(--primary); font-size: 22px; letter-spacing: -1px; }

/* 桌面端按钮组 */
#desktop-actions { display: flex; gap: 12px; }

/* 底部导航 (移动端) */
.bottom-nav {
    display: none; /* 桌面端隐藏 */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 8px 0;
    z-index: 900;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    color: #999;
    gap: 2px;
    cursor: pointer;
    width: 50px;
}

.nav-item.active { color: #333; font-weight: bold; }
.nav-icon { font-size: 24px; }

/* 核心发布按钮 (红底加号) */
.add-btn-wrapper {
    background: var(--primary);
    width: 45px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 36, 66, 0.4);
}

/* 按钮通用样式 */
.btn { 
    background: var(--primary); 
    color: #fff; 
    border: none; 
    padding: 8px 20px; 
    border-radius: 20px; 
    cursor: pointer; 
    font-size: 14px; 
    font-weight: 600;
    transition: all 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn-outline { background: #fff; color: #333; border: 1px solid #ddd; }

/* ================= 3. 瀑布流与卡片 ================= */
.container { max-width: 1200px; margin: 10px auto; }
.masonry { column-count: 5; column-gap: 12px; }

.card { 
    background: #fff; 
    border-radius: var(--radius); 
    margin-bottom: 12px; 
    break-inside: avoid; 
    overflow: hidden; 
    cursor: pointer; 
    box-shadow: var(--shadow);
    position: relative;
}

/* 图片预加载占位 */
.card-img-wrapper {
    width: 100%;
    background: #f0f0f0;
    min-height: 150px; 
    position: relative;
}

.card img { 
    width: 100%; 
    display: block; 
    opacity: 0; 
    transition: opacity 0.3s ease; 
}
.card img.loaded { opacity: 1; }

.card-body { padding: 10px 12px; }
.card-title { 
    font-weight: 600; 
    font-size: 14px; 
    margin-bottom: 8px; 
    line-height: 1.4; 
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta { 
    font-size: 11px; 
    color: var(--text-sub); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.author-info { display: flex; align-items: center; gap: 6px; }

/* ================= 4. 弹窗与组件 ================= */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.modal-content { 
    background: #fff; 
    padding: 24px; 
    border-radius: 20px; 
    width: 85%; 
    max-width: 480px; 
    max-height: 85vh; 
    overflow-y: auto; 
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #333; }
.form-group input, .form-group textarea, .form-group select { 
    width: 100%; padding: 12px; border: 1px solid #eee; border-radius: 12px; 
    background: #f9f9f9; font-size: 14px; outline: none; transition: border 0.2s; 
}
.form-group input:focus { border-color: var(--primary); background: #fff; }

.close-btn { 
    position: absolute; top: 15px; right: 15px; 
    background: #f0f0f0; width: 30px; height: 30px; border-radius: 50%; border: none; 
    display: flex; align-items: center; justify-content: center; cursor: pointer; color: #666; font-size: 16px;
}

/* 详情页内容 */
#detail-content { font-size: 16px; line-height: 1.8; color: #333; margin-top: 10px; }
#detail-content img { border-radius: 8px; margin: 10px 0; max-width: 100%; }

.tag-lock { background: #f5f5f5; padding: 2px 6px; border-radius: 4px; font-size: 10px; color: #666; display: flex; align-items: center; gap: 2px; }

/* 吐司提示 */
#toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; padding: 10px 20px; border-radius: 30px;
    font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.3s;
    z-index: 2000; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ================= 5. 响应式适配 ================= */
@media (max-width: 1024px) { .masonry { column-count: 4; } }
@media (max-width: 768px) {
    #desktop-actions { display: none; } /* 隐藏顶部按钮 */
    .bottom-nav { display: flex; }      /* 显示底部导航 */
    .masonry { column-count: 2 !important; gap: 6px !important; } /* 调整间距 */
    .container { padding: 0 6px; }
}

/* 给头部信息栏加一个类名，留出右边的位置给关闭按钮 */
.modal-header-row {
    display: flex; 
    align-items: center; 
    margin-bottom: 15px;
    padding-right: 40px; /* ★关键：右侧留出40px，防止被X按钮遮挡 */
}

/* ================= 修复问题 2：自定义确认弹窗样式 ================= */
.confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-danger {
    background: #fff;
    color: #ff2442;
    border: 1px solid #ff2442;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: none;
}