/* ======================================================
   Portal 门户网站 — 共享样式
   ====================================================== */

/* --- 基础重置 & CSS变量 --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, "Microsoft YaHei", sans-serif; }

:root {
  --bg-body: #f5f6f7;
  --bg-card: #fff;
  --text-main: #1a1a1a;
  --text-second: #858a93;
  --primary: #e64340;
  --line: #eee;
  --tag-blue: #e8f3ff;
  --tag-blue-text: #0066cc;
  --tag-orange: #fff7e6;
  --tag-orange-text: #fa8c16;
  --tag-green: #e6ffed;
  --tag-green-text: #009944;
  --tag-purple: #f3e8ff;
  --tag-purple-text: #9333ea;
  --step-blue: #e8f3ff;
  --step-text: #0066cc;
}

body { background: var(--bg-body); color: var(--text-main); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 12px; }

/* --- 顶部导航 --- */
.top-nav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 99; overflow: visible; }
.nav-inner { height: 60px; display: flex; align-items: center; gap: 30px; }
.logo { font-size: 22px; font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 4px; letter-spacing: 1px; }
.logo-icon { display: inline-flex; align-items: center; }
.logo-text { color: #333; background: linear-gradient(135deg, #333 0%, #555 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.logo-ai { color: #fff; background: linear-gradient(135deg, #e64340 0%, #ff6b6b 100%); padding: 2px 8px; border-radius: 6px; font-size: 14px; font-weight: 800; letter-spacing: 0; margin-left: 2px; box-shadow: 0 2px 8px rgba(230,67,64,.25); }
.back { color: var(--text-second); text-decoration: none; }
.search { flex: 1; max-width: 520px; height: 38px; background: #fff; border: 1px solid #e0e0e0; border-radius: 20px; display: flex; align-items: center; padding: 0 4px 0 18px; transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(230,67,64,.1); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 14px; color: #333; }
.search input:-webkit-autofill,
.search input:-webkit-autofill:hover,
.search input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 30px #fff inset !important; -webkit-text-fill-color: #333 !important; }
.search input::placeholder { color: #bbb; }
.search-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--primary); color: #fff; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: opacity .2s; padding: 0; line-height: 1; margin-right: -2px; }
.search-btn svg { display: block; width: 16px; height: 16px; }
.search-btn:hover { opacity: .85; }
.nav-right { display: flex; gap: 16px; align-items: center; margin-left: auto; }

/* --- 汉堡菜单按钮（默认隐藏，手机端显示） --- */
.hamburger { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 36px; height: 36px; padding: 6px; margin-left: auto; border: none; background: transparent; cursor: pointer; z-index: 101; flex-shrink: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.hamburger-line { display: block; width: 100%; height: 2px; background: #333; border-radius: 2px; transition: transform .3s, opacity .3s; }
/* 汉堡菜单激活时变成 X */
.hamburger.active .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active .hamburger-line:nth-child(2) { opacity: 0; }
.hamburger.active .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- 手机端下拉菜单面板 --- */
.nav-mobile-panel { display: none; position: fixed; top: 48px; left: 0; right: 0; background: #fff; border-bottom: 2px solid var(--primary); box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 100; padding: 12px 16px; flex-direction: column; gap: 10px; max-height: calc(100vh - 48px); overflow-y: auto; }
.nav-mobile-panel.show { display: flex; }
.nav-mobile-panel .btn { width: 100%; text-align: center; padding: 10px 0; font-size: 15px; border-radius: 6px; }
.nav-mobile-panel .btn-login { border: 1px solid var(--primary); color: var(--primary); }
.nav-mobile-panel .btn-ai { background: var(--primary); color: #fff; }
.nav-mobile-panel .btn-publish { justify-content: center; padding: 10px 0; font-size: 15px; }

/* --- 按钮 --- */
.btn { padding: 6px 14px; border-radius: 4px; font-size: 14px; border: none; cursor: pointer; }
.btn-login { background: transparent; border: 1px solid var(--line); }
.btn-ai { background: var(--primary); color: #fff; }

/* --- 页脚 --- */
.portal-footer { margin-top: 40px; padding: 30px 0; background: #fff; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-second); text-align: center; }

/* --- 弹窗通用 --- */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; display: none; align-items: center; justify-content: center; padding: 20px; }
.mask.show { display: flex; }
.modal { width: 420px; background: #fff; border-radius: 8px; padding: 24px; position: relative; }
.modal h4 { margin-bottom: 12px; font-size: 16px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 28px; height: 28px; text-align: center; line-height: 28px; font-size: 20px; color: #999; cursor: pointer; }
.modal-btns { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* --- 大号弹窗（资讯预览等） --- */
.modal.modal-lg { width: 840px; max-height: 90vh; overflow-y: auto; }
.modal.modal-lg h2 { font-size: 22px; line-height: 1.4; margin-bottom: 12px; }
.modal-meta { font-size: 13px; color: var(--text-second); padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.modal-content { font-size: 16px; line-height: 1.8; color: #222; }
.modal-content p { margin-bottom: 14px; }
.modal-bottom { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: flex-end; }

/* --- Toast 组件 --- */
.portal-toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 10000; padding: 10px 24px; border-radius: 6px; font-size: 14px; color: #fff; background: #333; box-shadow: 0 4px 12px rgba(0,0,0,0.15); opacity: 0; transition: opacity .3s; pointer-events: none; }
.portal-toast.show { opacity: 1; }
.portal-toast.success { background: #52c41a; }
.portal-toast.error { background: #f5222d; }
.portal-toast.warning { background: #fa8c16; }

/* --- 分类标签通用 --- */
.tag span { font-size: 12px; padding: 3px 8px; border-radius: 4px; margin-right: 8px; }
.tag-industry { background: #e1f5fe; color: #0277bd; }
.tag-product { background: var(--tag-purple); color: var(--tag-purple-text); }
.tag-ai { background: var(--tag-blue); color: var(--tag-blue-text); }
.tag-template { background: var(--tag-green); color: var(--tag-green-text); }

/* --- 空状态 --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-second); font-size: 14px; }

/* --- 发布作品按钮 --- */
.btn-publish { display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; border-radius: 20px; background: #fff; border: 1px solid var(--primary); color: var(--primary); font-size: 14px; text-decoration: none; cursor: pointer; transition: all .2s; white-space: nowrap; }
.btn-publish:hover { background: var(--primary); color: #fff; }
.btn-publish .publish-icon { font-size: 18px; font-weight: 700; line-height: 1; }

/* --- 用户头像 --- */
.user-avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; flex-shrink: 0; }
.user-avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; flex-shrink: 0; }
.user-name-nav { font-size: 14px; color: #333; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- 用户菜单下拉 --- */
.user-menu-wrap { position: relative; }
.user-trigger { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: background .2s; }
.user-trigger:hover { background: #f5f5f5; }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 150px; padding: 6px 0; display: none; z-index: 200; }
.user-dropdown.show { display: block; }
.user-dropdown .dropdown-item { display: block; padding: 10px 20px; font-size: 14px; color: #333; text-decoration: none; transition: background .15s; white-space: nowrap; }
.user-dropdown .dropdown-item:hover { background: #f5f6f7; color: var(--primary); }
.user-dropdown .dropdown-divider { border-top: 1px solid #f0f0f0; margin-top: 4px; padding-top: 14px; }

/* --- 关注菜单下拉 --- */
.follow-menu-wrap { position: relative; }
.follow-trigger { display: flex; align-items: center; gap: 4px; cursor: pointer; padding: 6px 12px; border-radius: 8px; font-size: 14px; color: #333; transition: background .2s; user-select: none; }
.follow-trigger:hover { background: #f5f5f5; }
.follow-arrow { font-size: 10px; color: #999; transition: transform .2s; }
.follow-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 260px; max-width: 360px; padding: 0; display: none; z-index: 200; overflow: hidden; }
.follow-dropdown.show { display: block; }
.follow-loading { text-align: center; padding: 24px 16px; font-size: 13px; color: var(--text-second); }
.follow-empty { text-align: center; padding: 20px 16px 8px; font-size: 13px; color: var(--text-second); }
.follow-go { display: block; text-align: center; padding: 6px 16px 16px; font-size: 13px; color: var(--primary); text-decoration: none; }
.follow-go:hover { text-decoration: underline; }
.follow-group { padding: 12px 16px 4px; }
.follow-group + .follow-group { border-top: 1px solid #f0f0f0; }
.follow-group-title { font-size: 12px; color: var(--text-second); margin-bottom: 8px; }
.follow-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.follow-tag { padding: 3px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; }
.tag-industry-style { background: #e1f5fe; color: #0277bd; }
.tag-product-style { background: var(--tag-purple); color: var(--tag-purple-text); }
.follow-edit { display: block; text-align: center; padding: 10px 16px; font-size: 13px; color: var(--primary); text-decoration: none; border-top: 1px solid #f0f0f0; margin-top: 4px; }
.follow-edit:hover { background: #fafafa; }

/* --- 个人页通用样式 --- */
.profile-header { display: flex; align-items: center; gap: 20px; padding: 24px; background: #fff; border-radius: 8px; margin-bottom: 16px; }
.profile-info { flex: 1; }
.profile-name { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.profile-stats { display: flex; gap: 24px; font-size: 14px; color: var(--text-second); margin-bottom: 8px; }
.profile-stats .stat-num { color: var(--text-main); font-weight: 600; margin-right: 4px; }
.profile-bio { font-size: 14px; color: #666; }
.profile-tabs { display: flex; gap: 0; background: #fff; border-radius: 8px 8px 0 0; border-bottom: 2px solid var(--line); padding: 0 16px; }
.profile-tab { padding: 14px 20px; font-size: 15px; color: var(--text-second); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; text-decoration: none; }
.profile-tab:hover { color: var(--text-main); }
.profile-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* --- 个人页左侧导航 --- */
.profile-left-nav .user-card { background: #fff; border-radius: 8px; padding: 20px 16px; text-align: center; margin-bottom: 8px; }
.profile-left-nav .user-card .user-avatar-lg { width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; margin: 0 auto 10px; }
.profile-left-nav .user-card .uc-name { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.profile-left-nav .user-card .uc-stats { display: flex; justify-content: center; gap: 14px; font-size: 12px; color: var(--text-second); }
.profile-left-nav .user-card .uc-stats .stat-num { color: var(--text-main); font-weight: 600; }
.profile-nav { display: flex; flex-direction: column; gap: 2px; background: #fff; border-radius: 8px; padding: 8px; }
.profile-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 6px; font-size: 14px; color: #555; text-decoration: none; transition: all .15s; }
.profile-nav-item:hover { background: #f5f6f7; color: var(--primary); }
.profile-nav-item.active { background: #eceffe; color: var(--primary); font-weight: 600; }
.profile-nav-item .pnav-icon { font-size: 16px; width: 20px; text-align: center; line-height: 1; }

/* --- 收藏/文章列表项 --- */
.collect-item { display: flex; gap: 16px; padding: 16px 20px; background: #fff; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: background .15s; }
.collect-item:hover { background: #fafafa; }
.collect-item:last-child { border-bottom: none; }
.collect-body { flex: 1; min-width: 0; }
.collect-title { font-size: 15px; font-weight: 500; line-height: 1.5; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.collect-meta { font-size: 12px; color: var(--text-second); display: flex; gap: 12px; flex-wrap: wrap; }
.collect-img { width: 120px; height: 80px; background: #e5e7eb; border-radius: 6px; object-fit: cover; flex-shrink: 0; }

/* --- 创作平台 --- */
.publish-wrap { background: #fff; border-radius: 8px; padding: 32px; margin-top: 0; }
.publish-wrap h2 { font-size: 20px; font-weight: 600; margin-bottom: 24px; }
.publish-field { margin-bottom: 20px; }
.publish-field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: #333; }
.publish-input { width: 100%; height: 44px; border: 1px solid #e0e0e0; border-radius: 8px; padding: 0 14px; font-size: 14px; outline: none; transition: border-color .2s; }
.publish-input:focus { border-color: var(--primary); }
.publish-textarea { width: 100%; min-height: 300px; border: 1px solid #e0e0e0; border-radius: 8px; padding: 14px; font-size: 14px; line-height: 1.8; outline: none; resize: vertical; font-family: inherit; transition: border-color .2s; }
.publish-textarea:focus { border-color: var(--primary); }
.publish-select { width: 100%; height: 44px; border: 1px solid #e0e0e0; border-radius: 8px; padding: 0 14px; font-size: 14px; outline: none; background: #fff; transition: border-color .2s; }
.publish-select:focus { border-color: var(--primary); }
.publish-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }
.publish-btn { padding: 10px 32px; border-radius: 8px; font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: all .2s; }
.publish-btn-primary { background: var(--primary); color: #fff; }
.publish-btn-primary:hover { opacity: .9; }
.publish-btn-secondary { background: #f5f5f5; color: #666; }
.publish-btn-secondary:hover { background: #e8e8e8; }

/* --- 个人页布局 --- */
.profile-layout { display: flex; gap: 20px; margin-top: 20px; padding: 0 12px; }
.profile-left-nav { width: 170px; flex-shrink: 0; }
.profile-main { flex: 1; min-width: 0; }
.profile-sidebar { width: 280px; flex-shrink: 0; }
.profile-list { background: #fff; border-radius: 0 0 8px 8px; }

/* --- 侧边栏通用卡片 --- */
.sidebar-card { background: #fff; border-radius: 8px; padding: 16px 20px; margin-bottom: 16px; }
.sidebar-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }

/* --- 排行榜 --- */
.rank-list { display: flex; flex-direction: column; gap: 0; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; border-radius: 4px; transition: background .15s; }
.rank-item:hover { background: #f5f6f7; }
.rank-num { width: 20px; height: 20px; border-radius: 4px; background: #e0e0e0; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.rank-num.top { background: var(--primary); }
.rank-text { flex: 1; font-size: 13px; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-meta { font-size: 11px; color: var(--text-second); flex-shrink: 0; }

/* --- 响应式 --- */

/* 平板及以下：收窄导航间距 */
@media (max-width: 960px) {
    .profile-left-nav { display: none; }
    .profile-sidebar { display: none; }
    .nav-inner { gap: 16px; }
    .logo { font-size: 18px; }
    .logo-ai { font-size: 12px; padding: 1px 6px; }
    .back { font-size: 14px; }
    .search { max-width: 280px; height: 34px; }
    .search input { font-size: 13px; }
    .btn { padding: 5px 10px; font-size: 13px; }
}

/* 手机端：进一步精简导航，防止折行 */
@media (max-width: 640px) {
    .top-nav { position: fixed; width: 100%; overflow: visible; }
    body { padding-top: 48px; }
    .nav-inner {
        height: 48px;
        gap: 8px;
        padding: 0 4px;
    }
    .logo {
        font-size: 15px;
        gap: 2px;
        letter-spacing: 0;
        flex-shrink: 0;
    }
    .logo-icon { display: none; }        /* 手机端隐藏 SVG 星标图标 */
    .logo-ai { font-size: 10px; padding: 1px 4px; border-radius: 4px; }
    .logo-text { white-space: nowrap; }
    .back {
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .search {
        max-width: 160px;
        height: 32px;
        padding: 0 4px 0 8px;
        border-radius: 16px;
    }
    .search input { font-size: 12px; }
    .search input::placeholder { font-size: 11px; }
    .search-btn { width: 26px; height: 26px; font-size: 14px; }
    /* 手机端：隐藏原始导航按钮组，显示汉堡菜单 */
    .nav-right { display: none; }
    .hamburger { display: flex; }
    /* 搜索框扩展占满剩余空间 */
    .search { flex: 1; max-width: none; }
    .back-text { display: none; }         /* 手机端返回只显示箭头，不显示"返回"文字 */
    .back-arrow { font-size: 16px; }
}
