/* ============================================================
   小船AI漫剧 v1.0.0 公共样式
   ============================================================ */
:root {
  --primary: #4f6ef7;
  --primary-light: #6e8bff;
  --primary-bg: #eef1ff;
  --dark: #171a26;
  --text: #2b2f3a;
  --text-2: #8a90a3;
  --border: #e8eaf2;
  --bg: #f7f8fc;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(30, 40, 90, .06);
  --gradient: linear-gradient(135deg, #4f6ef7, #8a5cf6);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ---------- 顶部导航 ---------- */
.topbar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--border); }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.topbar .brand img { width: 32px; height: 32px; border-radius: 8px; }
.topbar .brand .sub { font-size: 12px; color: var(--text-2); font-weight: 400; }
.topbar .nav { display: flex; align-items: center; gap: 4px; }
.topbar .nav a { padding: 7px 14px; border-radius: 8px; color: var(--text); font-size: 14px; }
.topbar .nav a:hover { background: var(--primary-bg); color: var(--primary); }
.topbar .nav a.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.topbar .right .points { display: flex; align-items: center; gap: 4px; padding: 5px 12px; background: #fff7e6; color: #d48806; border-radius: 20px; font-weight: 600; font-size: 13px; }
.topbar .right .avatar-btn { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 2px solid var(--primary); cursor: pointer; background: none; padding: 0; }
.topbar .right .avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 20px; border-radius: 10px; border: none; font-size: 14px; font-weight: 500; transition: .2s; }
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-ghost { background: var(--primary-bg); color: var(--primary); }
.btn-plain { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-block { width: 100%; }

/* ---------- 侧边栏布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: 216px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border); padding: 16px 12px; }
.sidebar .f-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.sidebar .f-tabs span { flex: 1; text-align: center; padding: 6px 0; border-radius: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.sidebar .f-tabs span.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.sidebar .menu { }
.sidebar .menu .group { font-size: 12px; color: var(--text-2); padding: 10px 12px 6px; }
.sidebar .menu a, .sidebar .menu .item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.sidebar .menu a:hover, .sidebar .menu .item:hover { background: var(--primary-bg); color: var(--primary); }
.sidebar .menu a.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.sidebar .menu .item .icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.main { flex: 1; padding: 20px 24px; min-width: 0; }

/* ---------- 卡片与网格 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1400px) { .grid-5 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1100px) { .grid-4, .grid-5 { grid-template-columns: repeat(3, 1fr); } }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.page-title .desc { font-size: 13px; color: var(--text-2); font-weight: 400; }

/* ---------- 工具卡片 ---------- */
.tool-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; transition: .2s; cursor: pointer; }
.tool-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--primary-light); }
.tool-card .icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; }
.tool-card .name { font-weight: 600; font-size: 15px; }
.tool-card .desc { color: var(--text-2); font-size: 12px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool-card .hot { position: absolute; top: -6px; right: 8px; background: #ff4d4f; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; }

/* ---------- 项目卡片 ---------- */
.project-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: .2s; position: relative; }
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.project-card .p-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.project-card .p-desc { color: var(--text-2); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 34px; }
.project-card .p-meta { display: flex; justify-content: space-between; margin-top: 10px; color: var(--text-2); font-size: 12px; }
.project-card .p-stats { display: flex; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.new-project { border: 2px dashed var(--primary-light); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--primary); background: var(--primary-bg); }
.new-project .plus { font-size: 34px; font-weight: 300; }

/* ---------- 表单 ---------- */
.input, textarea.input, select.input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; background: #fff; transition: .2s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,110,247,.12); }
label.field { display: block; margin-bottom: 14px; }
label.field .label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20,24,40,.5); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 16px; padding: 28px; width: 420px; max-width: 92vw; max-height: 86vh; overflow: auto; position: relative; }
.modal .close { position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--bg); color: var(--text-2); font-size: 16px; }
.modal .m-title { font-size: 18px; font-weight: 700; margin-bottom: 18px; text-align: center; }

/* ---------- 弹窗抽屉(头像菜单/个人中心) ---------- */
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 360px; background: #fff; z-index: 200; box-shadow: -8px 0 30px rgba(0,0,0,.1); padding: 24px; overflow: auto; }
.drawer-mask { position: fixed; inset: 0; background: rgba(20,24,40,.4); z-index: 199; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs .tab { padding: 10px 16px; color: var(--text-2); border-bottom: 2px solid transparent; cursor: pointer; font-size: 14px; }
.tabs .tab.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ---------- 表格 ---------- */
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th { background: #fafbff; padding: 12px 14px; text-align: left; color: var(--text-2); font-weight: 500; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.table tr:hover td { background: #fafbff; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag-success { background: #e8f8ef; color: #18a058; }
.tag-warn { background: #fff7e6; color: #d48806; }
.tag-danger { background: #ffeded; color: #e5484d; }
.tag-info { background: var(--primary-bg); color: var(--primary); }
.tag-gray { background: #f2f3f7; color: var(--text-2); }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 18px; }
.pagination button { padding: 6px 14px; border: 1px solid var(--border); background: #fff; border-radius: 8px; color: var(--text); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Toast ---------- */
#toast-box { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #32364a; color: #fff; padding: 10px 22px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: toastIn .25s; }
.toast.success { background: #18a058; }
.toast.error { background: #e5484d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 会员弹窗 ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.plan-item { border: 1px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; transition: .2s; }
.plan-item:hover, .plan-item.active { border-color: var(--primary); background: var(--primary-bg); }
.plan-item .p-name { font-weight: 600; }
.plan-item .p-price { font-size: 20px; font-weight: 700; color: var(--primary); margin: 6px 0; }
.plan-item .p-price small { font-size: 12px; color: var(--text-2); font-weight: 400; }
.plan-item .p-benefit { font-size: 12px; color: var(--text-2); }

/* ---------- 灵感广场作品 ---------- */
.work-card { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); transition: .2s; cursor: pointer; }
.work-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.work-card .w-img { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; }
.work-card .w-body { padding: 12px; }
.work-card .w-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-card .w-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--text-2); font-size: 12px; }
.work-card .w-meta .like { display: flex; align-items: center; gap: 4px; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 60px 0; color: var(--text-2); }
.empty .e-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }

/* ---------- 编辑器 ---------- */
.editor-layout { display: grid; grid-template-columns: 300px 1fr 320px; gap: 16px; align-items: start; }
.editor-layout .col { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.editor-layout .col h3 { font-size: 15px; margin-bottom: 14px; }
@media (max-width: 1200px) { .editor-layout { grid-template-columns: 1fr; } }

/* ---------- 登录页 ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef1ff 0%, #f6efff 100%); }
.auth-card { background: #fff; border-radius: 20px; box-shadow: 0 20px 60px rgba(40,60,140,.12); padding: 40px; width: 420px; }
.auth-card .a-title { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-card .a-sub { text-align: center; color: var(--text-2); margin-bottom: 28px; }
.auth-tabs { display: flex; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.auth-tabs span { flex: 1; text-align: center; padding: 10px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; }
.auth-tabs span.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.auth-switch { text-align: center; margin-top: 16px; color: var(--text-2); font-size: 13px; }
.auth-switch a { color: var(--primary); }

/* 其他 */
.member-badge { display: inline-block; background: linear-gradient(135deg, #f6c453, #e8930c); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }
.section-title { font-size: 17px; font-weight: 700; margin: 24px 0 14px; display: flex; align-items: center; gap: 8px; }
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-16 { gap: 16px; }
.text-2 { color: var(--text-2); } .text-primary { color: var(--primary); }
.font-bold { font-weight: 700; } .text-sm { font-size: 12px; } .text-lg { font-size: 16px; }
