/* ==========================================================================
   STD 文件管理系统 — 现代化主题 (app.css)
   移动优先 · 圆角卡片 · 柔和阴影 · 大号触控
   ========================================================================== */

:root {
  --brand:        #2563eb;   /* 主色 蓝 */
  --brand-dark:   #1d4ed8;
  --brand-light:  #dbeafe;
  --success:      #16a34a;
  --success-dark: #15803d;
  --warning:      #d97706;
  --danger:       #dc2626;
  --ink:          #0f172a;   /* 主文字 */
  --muted:        #64748b;   /* 次要文字 */
  --line:         #e2e8f0;   /* 分隔线 */
  --bg:           #f1f5f9;   /* 页面背景 */
  --card:         #ffffff;
  --radius:       16px;
  --radius-sm:    12px;
  --shadow:       0 1px 3px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
  --shadow-sm:    0 1px 2px rgba(15,23,42,.08);
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans SC", "Noto Sans Lao", -apple-system, BlinkMacSystemFont,
               "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* 内容主容器统一宽度 */
.app-main { max-width: 980px; margin: 0 auto; padding: 18px 16px 28px; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ============================ 顶部导航 ============================ */
.app-navbar {
  position: sticky; top: 0; z-index: 1030;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.app-navbar .nav-inner {
  max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; min-height: 58px;
}
.app-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); font-size: 1.02rem; }
.app-brand img { height: 34px; width: auto; border-radius: 8px; }
.app-brand span { line-height: 1.1; }
.nav-spacer { flex: 1; }

/* 桌面端横向链接 */
.nav-links { display: none; align-items: center; gap: 4px; }
.nav-links a {
  color: var(--muted); font-weight: 600; font-size: .94rem;
  padding: 8px 12px; border-radius: 10px;
}
.nav-links a:hover { background: var(--brand-light); color: var(--brand-dark); }
.nav-links a.active { background: var(--brand-light); color: var(--brand-dark); }

/* 语言切换 */
.lang-switch { display: inline-flex; background: #eef2f7; border-radius: 999px; padding: 3px; }
.lang-switch a { padding: 5px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.lang-switch a.active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

/* ============================ 卡片 ============================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card .card-header {
  background: transparent; border-bottom: 1px solid var(--line);
  font-weight: 700; padding: 16px 20px;
}
.card .card-body { padding: 20px; }

/* ============================ 按钮 ============================ */
.btn {
  border-radius: 12px; font-weight: 600; padding: 10px 18px;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; transition: transform .04s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 38px; padding: 7px 14px; font-size: .88rem; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 1.05rem; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--ink); }
.btn-secondary:hover { background: #cbd5e1; color: var(--ink); }

.btn-outline-primary { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-outline-primary:hover { background: var(--brand); color: #fff; }
.btn-outline-success { background: #fff; color: var(--success); border: 1.5px solid var(--success); }
.btn-outline-success:hover { background: var(--success); color: #fff; }
.btn-outline-warning { background: #fff; color: var(--warning); border: 1.5px solid var(--warning); }
.btn-outline-warning:hover { background: var(--warning); color: #fff; }
.btn-outline-secondary { background: #fff; color: var(--muted); border: 1.5px solid var(--line); }
.btn-outline-secondary:hover { background: #f1f5f9; color: var(--ink); }
.btn-outline-danger { background: #fff; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }

/* ============================ 表单 ============================ */
.form-label { font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.form-control, .form-select {
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 1rem; min-height: 48px;
  background: #fff; color: var(--ink);
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
  outline: none;
}
.form-text { color: var(--muted); }
textarea.form-control { min-height: 90px; }

.form-check-input { width: 1.25em; height: 1.25em; margin-top: .15em; border-radius: 6px; border: 1.5px solid #cbd5e1; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-label { padding-left: 4px; }

/* ============================ 提示框 ============================ */
.alert { border: none; border-radius: 12px; padding: 14px 16px; font-weight: 500; }
.alert-info    { background: var(--brand-light); color: var(--brand-dark); }
.alert-success { background: #dcfce7; color: var(--success-dark); }
.alert-danger  { background: #fee2e2; color: #b91c1c; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* ============================ 徽章 ============================ */
.badge-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700;
}
.badge-cat   { background: #eef2ff; color: #4338ca; }
.badge-lock  { background: #fef2f2; color: #b91c1c; }
.badge-open  { background: #ecfdf5; color: #047857; }
.badge-lang  { background: #f1f5f9; color: var(--muted); }

/* ============================ 文件卡片列表 ============================ */
.file-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .file-grid { grid-template-columns: 1fr 1fr; } }

.file-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.file-card .fc-top { display: flex; align-items: flex-start; gap: 12px; }
.file-card .fc-icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand-light); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.file-card .fc-title { font-weight: 700; line-height: 1.3; word-break: break-word; }
.file-card .fc-meta { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.file-card .fc-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.file-card .fc-desc { color: var(--muted); font-size: .9rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-card .fc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.file-card .fc-actions .btn { flex: 1 1 auto; }

/* 顶部搜索 / 筛选条 */
.filter-bar { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 18px; }
@media (min-width: 640px) { .filter-bar { grid-template-columns: 160px 1fr auto; align-items: end; } }

/* ============================ 表格（桌面） ============================ */
.table { color: var(--ink); }
.table > :not(caption) > * > * { padding: 12px 14px; }
.table thead th { color: var(--muted); font-weight: 700; font-size: .82rem; text-transform: none; border-bottom: 2px solid var(--line); }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ============================ 页面标题 ============================ */
.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 1.5rem; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

/* ============================ 登录页 ============================ */
.auth-wrap {
  min-height: calc(100vh - 58px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 50% -10%, #dbeafe 0%, rgba(219,234,254,0) 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 410px; }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo img { height: 56px; border-radius: 14px; }
.auth-logo .name { font-weight: 800; font-size: 1.15rem; margin-top: 10px; }
.auth-logo .desc { color: var(--muted); font-size: .9rem; }

/* ============================ 仪表盘 ============================ */
.dash-hero { text-align: center; padding: 12px 0 22px; }
.dash-hero h1 { font-size: 1.7rem; }
.dash-hero p { color: var(--muted); }
.dash-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.dash-tile {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; color: var(--ink); font-weight: 700;
}
.dash-tile:hover { box-shadow: 0 6px 20px rgba(37,99,235,.15); color: var(--brand-dark); transform: translateY(-1px); transition: all .15s ease; }
.dash-tile .ti { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 auto; }
.ti-blue { background: var(--brand-light); color: var(--brand-dark); }
.ti-green { background: #dcfce7; color: var(--success-dark); }
.ti-amber { background: #fef3c7; color: #b45309; }
.ti-slate { background: #e2e8f0; color: #475569; }
.ti-red { background: #fee2e2; color: #b91c1c; }
.dash-tile small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* ============================ 移动端底部导航 ============================ */
.bottom-nav { display: none; }
@media (max-width: 767.98px) {
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 16px rgba(15,23,42,.06);
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); font-size: .68rem; font-weight: 600; padding: 4px 2px; border-radius: 10px;
  }
  .bottom-nav a svg { width: 24px; height: 24px; stroke: currentColor; }
  .bottom-nav a.active { color: var(--brand); }
  /* 给固定底栏留出空间 */
  body.has-bottom-nav { padding-bottom: 76px; }
}

/* ============================ 页脚 ============================ */
.app-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 22px 16px; }

/* 通用小工具 */
.text-muted2 { color: var(--muted); }
.stack-gap { display: grid; gap: 12px; }
