/* ═══════════════════════════════════════════════════════════
   LiveAI — 应用内页全局样式（深色主题）
   ═══════════════════════════════════════════════════════════ */
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --bg-sidebar:#13161f;
  --bg-card:   #1a1d27;
  --bg-card2:  #1e2130;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --grad:      linear-gradient(135deg,#6366f1,#a855f7,#ec4899);
  --grad-text: linear-gradient(135deg,#6366f1 0%,#a855f7 50%,#ec4899 100%);
  --c-primary: #6366f1;
  --c-purple:  #a855f7;
  --c-pink:    #ec4899;
  --c-green:   #22c55e;
  --c-yellow:  #f59e0b;
  --c-red:     #ef4444;
  --c-white:   #ffffff;
  --c-gray:    rgba(255,255,255,0.55);
  --c-gray2:   rgba(255,255,255,0.35);
  --sidebar-w: 240px;
  --topbar-h:  64px;
  --radius:    12px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--c-white);
  font-family: "PingFangSC","苹方","Microsoft YaHei",Inter,system-ui,sans-serif;
  line-height: 1.6; overflow-x: hidden;
}

/* ── 布局 ─────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── 侧边栏 ──────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px; text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo svg { width: 36px; height: 36px; flex-shrink: 0; }
.sidebar-logo-text {
  font-size: 16px; font-weight: 700;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--c-gray); text-decoration: none; font-size: 14px;
  transition: background .2s, color .2s;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: var(--c-white); }
.sidebar-nav a.active { background: rgba(99,102,241,.18); color: var(--c-white); }
.sidebar-nav a .icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px; }
.sidebar-section-label {
  padding: 8px 14px 4px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; color: var(--c-gray2); letter-spacing: .8px;
}
.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
}
.user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,.04);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad); display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.user-info-text { flex: 1; min-width: 0; }
.user-info-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info-role { font-size: 11px; color: var(--c-gray); }
.logout-btn {
  background: none; border: none; color: var(--c-gray);
  cursor: pointer; font-size: 16px; padding: 4px; transition: color .2s;
}
.logout-btn:hover { color: var(--c-red); }

/* ── 侧边栏收起按钮 ──────────────────── */
.sidebar-collapse-btn {
  margin-left: auto;
  background: none; border: none;
  color: var(--c-gray); cursor: pointer;
  font-size: 16px; padding: 4px 6px;
  border-radius: 6px; line-height: 1;
  transition: background .2s, color .2s;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.08); color: var(--c-white); }

/* ── 侧边栏收起态 ────────────────────── */
.sidebar.collapsed {
  width: 64px;
}
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-nav a span:not(.icon),
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-divider,
.sidebar.collapsed .user-info-text,
.sidebar.collapsed .logout-btn {
  display: none;
}
.sidebar.collapsed .sidebar-logo {
  justify-content: center; padding: 20px 0 16px;
}
.sidebar.collapsed .sidebar-nav {
  padding: 16px 8px;
}
.sidebar.collapsed .sidebar-nav a {
  justify-content: center; padding: 11px 0;
}
.sidebar.collapsed .sidebar-footer {
  padding: 12px 8px;
}
.sidebar.collapsed .user-info {
  justify-content: center; padding: 10px 0;
}
.sidebar.collapsed .sidebar-collapse-btn {
  margin: 0 auto;
}

/* ── 主内容区 ────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w); flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
  transition: margin-left .25s;
}
.sidebar.collapsed ~ .main-content,
.main-content.sidebar-collapsed {
  margin-left: 64px;
}
.topbar {
  height: var(--topbar-h); background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 100;
}
.page-title { font-size: 20px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-body { padding: 28px; flex: 1; }

/* ── 卡片 ────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--c-gray); }

/* ── 统计卡 ──────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  transition: border-color .3s, box-shadow .3s;
}
.stat-card:hover { border-color: rgba(99,102,241,.35); box-shadow: 0 0 20px rgba(99,102,241,.12); }
.stat-card-label { font-size: 13px; color: var(--c-gray); margin-bottom: 8px; }
.stat-card-val { font-size: 30px; font-weight: 800; line-height: 1; }
.stat-card-sub { font-size: 12px; color: var(--c-gray); margin-top: 6px; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ── 表格 ────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-table th { color: var(--c-gray); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,.03); }

/* ── 徽章 ────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
}
.badge-green  { background: rgba(34,197,94,.12);  color: var(--c-green); }
.badge-red    { background: rgba(239,68,68,.12);   color: var(--c-red); }
.badge-yellow { background: rgba(245,158,11,.12);  color: var(--c-yellow); }
.badge-purple { background: rgba(168,85,247,.12);  color: var(--c-purple); }
.badge-gray   { background: rgba(255,255,255,.07); color: var(--c-gray); }
.badge-blue   { background: rgba(99,102,241,.12);  color: #818cf8; }

/* ── 按钮 ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 9px; font-size: 14px;
  font-weight: 600; cursor: pointer; border: none; text-decoration: none;
  transition: all .2s;
}
.btn-grad { background: var(--grad); color: #fff; box-shadow: 0 3px 12px rgba(99,102,241,.3); }
.btn-grad:hover { opacity: .88; transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border2); color: var(--c-white); }
.btn-outline:hover { background: rgba(255,255,255,.06); }
.btn-danger { background: rgba(239,68,68,.12); color: var(--c-red); border: 1px solid rgba(239,68,68,.2); }
.btn-danger:hover { background: rgba(239,68,68,.2); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px; min-width: 36px; justify-content: center; }

/* ── 表单 ────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: var(--c-gray); margin-bottom: 7px; }
.form-input {
  width: 100%; padding: 11px 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border); border-radius: 9px;
  color: #fff; font-size: 14px; outline: none;
  transition: border-color .2s;
}
.form-input:focus { border-color: var(--c-primary); }
.form-input::placeholder { color: rgba(255,255,255,.2); }
select.form-input option { background: #1a1d27; }
textarea.form-input { resize: vertical; min-height: 100px; }

/* ── 模态框 ──────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 28px; width: 480px; max-width: 94vw;
  transform: translateY(20px); transition: transform .25s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--c-gray); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ── 空状态 ──────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--c-gray); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ── 加载 ────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.2);
  border-top-color: var(--c-primary); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes pulse { 0%,100%{opacity:.4} 50%{opacity:1} }
.pulse { animation: pulse 1.5s ease infinite; }

/* ── Kanban ──────────────────────────── */
.kanban-board { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
.kanban-col {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; min-height: 500px;
}
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.kanban-col-title { font-size: 14px; font-weight: 600; }
.kanban-col-count {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.1); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.kanban-cards { min-height: 60px; }
.kanban-card {
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; margin-bottom: 10px;
  cursor: grab; transition: box-shadow .2s, border-color .2s;
}
.kanban-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.4); border-color: var(--border2); }
.kanban-card.dragging { opacity: .5; cursor: grabbing; }
.kanban-col.drag-over { border-color: var(--c-primary); background: rgba(99,102,241,.05); }
.card-type-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  margin-bottom: 8px; display: inline-block;
}
.card-type-video   { background: rgba(99,102,241,.15); color: #818cf8; }
.card-type-image   { background: rgba(236,72,153,.15);  color: #f472b6; }
.card-type-component { background: rgba(34,197,94,.15); color: var(--c-green); }
.card-type-other   { background: rgba(255,255,255,.08); color: var(--c-gray); }
.card-title-text { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.card-footer-row { display: flex; align-items: center; justify-content: space-between; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.priority-high   { background: var(--c-red); }
.priority-medium { background: var(--c-yellow); }
.priority-low    { background: var(--c-green); }
.card-date { font-size: 11px; color: var(--c-gray2); }

/* ════════════════════════════════════════════
   移动端响应式 — 侧边栏 & 后台布局
   ════════════════════════════════════════════ */

/* 侧边栏背景遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* 侧边栏关闭按钮（仅移动端可见） */
.sidebar-close-btn {
  display: none;
  background: none; border: none; color: var(--c-gray);
  font-size: 22px; cursor: pointer; padding: 8px; line-height: 1;
  transition: color .2s; margin-left: auto; flex-shrink: 0;
  min-width: 44px; min-height: 44px; display: none; align-items: center; justify-content: center;
}
.sidebar-close-btn:hover { color: var(--c-white); }

/* 顶栏汉堡按钮 */
.topbar-menu-btn {
  display: none;
  background: none; border: none; color: var(--c-white);
  font-size: 24px; cursor: pointer; padding: 8px 10px 8px 0;
  line-height: 1; flex-shrink: 0; min-height: 44px;
}

@media (max-width: 768px) {
  /* 侧边栏默认隐藏到左侧，点击汉堡滑入 */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); }
  /* 移动端不显示收起按钮 */
  .sidebar-collapse-btn { display: none; }

  /* 移动端显示关闭按钮和汉堡按钮 */
  .sidebar-close-btn { display: flex; align-items: center; }
  .sidebar-logo { padding: 16px 16px 14px; }
  .topbar-menu-btn { display: flex; align-items: center; }

  /* 主内容区不偏移（侧边栏 fixed 不占空间） */
  .main-content { margin-left: 0 !important; }

  /* 顶栏内边距 */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .page-title { font-size: 15px; }
  .topbar-right { gap: 8px; }

  /* 页面内边距 */
  .page-body { padding: 12px; }

  /* 统计卡 2 列 */
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px; margin-bottom: 14px;
  }

  /* 图表行：单列（覆盖 dashboard inline style） */
  .charts-row { grid-template-columns: 1fr !important; }

  /* 看板：横向滚动 */
  .page-body:has(.kanban-board) { overflow-x: auto; padding-bottom: 0; }
  .kanban-board { grid-template-columns: repeat(4, minmax(260px, 1fr)); min-width: 1040px; }

  /* 创作页：上下堆叠 */
  .create-layout { grid-template-columns: 1fr !important; }

  /* 表格横向滚动 */
  .data-table { min-width: 480px; }

  /* 管理后台编辑器横向滚动 */
  .plan-editor-wrap { overflow-x: auto; }
  .section-card { overflow-x: auto; }

  /* 模态框 */
  .modal { padding: 16px 14px; margin: 10px; width: calc(100% - 20px); }
  .modal-title { font-size: 16px; }

  /* 表单组 */
  .form-row-2col { grid-template-columns: 1fr !important; }

  /* 按钮组 */
  .btn { font-size: 13px; padding: 8px 14px; }
  .btn-sm { font-size: 12px; padding: 6px 10px; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .stat-cards-compact { grid-template-columns: repeat(2, 1fr) !important; }
  .topbar-right .btn { display: none; }
  .topbar-right .btn.topbar-primary { display: inline-flex; }
}

/* ── 语言切换器 ─────────────────────────────── */
.lang-switcher {
  display: inline-flex; align-items: center; gap: 2px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px; padding: 3px; flex-shrink: 0;
}
.lang-btn {
  padding: 6px 10px; border: none; border-radius: 5px;
  background: transparent; color: rgba(255,255,255,.5);
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all .2s; white-space: nowrap; letter-spacing: .3px;
  min-height: 32px;
}
@media (max-width: 768px) {
  .lang-btn { padding: 8px 12px; min-height: 36px; }
}
.lang-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.lang-btn.active { background: rgba(99,102,241,.3); color: #c4b5fd; }

/* ── 浮动促销弹窗（内部页）── */
.promo-float {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  width: 280px;
  background: linear-gradient(135deg, #1e1b4b 0%, #2d1b69 100%);
  border: 1px solid rgba(99,102,241,.4);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  overflow: hidden;
  animation: promo-float-in .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes promo-float-in {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.promo-float-img { width: 100%; height: 130px; object-fit: cover; display: block; }
.promo-float-body { padding: 14px 16px 16px; }
.promo-float-text { font-size: 13px; color: #e0e7ff; line-height: 1.5; margin-bottom: 12px; }
.promo-float-btn {
  display: block; width: 100%; text-align: center;
  padding: 9px 0;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; border-radius: 8px;
  font-size: 13px; font-weight: 700;
  text-decoration: none; cursor: pointer; border: none;
  transition: opacity .2s;
}
.promo-float-btn:hover { opacity: .85; }
.promo-float-close {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.4); border: none; color: #fff;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 14px; cursor: pointer; line-height: 26px; text-align: center;
  transition: background .2s;
}
.promo-float-close:hover { background: rgba(0,0,0,.65); }
@media (max-width: 480px) {
  .promo-float { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
}
@media (max-width: 360px) {
  .promo-float { width: calc(100vw - 24px); right: 12px; bottom: 12px; }
  .promo-float-text { font-size: 12px; }
}
