/* =========================================================
   ShareWater · Fluent UI 风格
   组件：Fluent UI Web Components v2（wwwroot/lib/fluentui）
   图标：Fluent UI System Icons（wwwroot/icons）
   ========================================================= */

:root {
  --sw-brand: #0f6cbd;
  --sw-brand-hover: #115ea3;
  --sw-brand-pressed: #0c3b5e;
  --sw-brand-soft: #ebf3fc;
  --sw-bg: #f5f5f5;
  --sw-surface: #ffffff;
  --sw-stroke: #e0e0e0;
  --sw-text: #242424;
  --sw-text-2: #616161;
  --sw-text-3: #707070;
  --sw-danger: #c50f1f;
  --sw-danger-soft: #fdf3f4;
  --sw-radius: 8px;
  --sw-radius-lg: 12px;
  --sw-shadow-4: 0 0 2px rgba(0, 0, 0, .12), 0 2px 4px rgba(0, 0, 0, .14);
  --sw-shadow-8: 0 0 2px rgba(0, 0, 0, .12), 0 4px 8px rgba(0, 0, 0, .14);
  --sw-shadow-16: 0 0 2px rgba(0, 0, 0, .12), 0 8px 16px rgba(0, 0, 0, .14);
  --sw-shadow-28: 0 0 8px rgba(0, 0, 0, .12), 0 14px 28px rgba(0, 0, 0, .14);
  --sw-font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--sw-font);
  font-size: 14px;
  line-height: 20px;
  color: var(--sw-text);
  background: var(--sw-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sw-brand); text-decoration: none; }
a:hover { color: var(--sw-brand-hover); text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 600; }

/* 尚未注册的 Web Components 先隐藏，避免闪烁 */
fluent-button:not(:defined),
fluent-anchor:not(:defined),
fluent-text-field:not(:defined),
fluent-select:not(:defined),
fluent-option:not(:defined),
fluent-card:not(:defined),
fluent-badge:not(:defined),
fluent-divider:not(:defined) { visibility: hidden; }

/* ===================== 图标（CSS mask，跟随 currentColor） ===================== */
.icon {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
}
.icon-16 { width: 16px; height: 16px; }
.icon-24 { width: 24px; height: 24px; }
.icon-28 { width: 28px; height: 28px; }
.icon-32 { width: 32px; height: 32px; }

.i-drop            { --icon: url(../icons/drop.svg); }
.i-person          { --icon: url(../icons/person.svg); }
.i-lock            { --icon: url(../icons/lock_closed.svg); }
.i-enter           { --icon: url(../icons/arrow_enter.svg); }
.i-grid            { --icon: url(../icons/grid.svg); }
.i-star            { --icon: url(../icons/star_emphasis.svg); }
.i-info            { --icon: url(../icons/info.svg); }
.i-live            { --icon: url(../icons/live.svg); }
.i-share           { --icon: url(../icons/share.svg); }
.i-shield          { --icon: url(../icons/shield_checkmark.svg); }
.i-signout         { --icon: url(../icons/sign_out.svg); }
.i-home            { --icon: url(../icons/home.svg); }
.i-refresh         { --icon: url(../icons/arrow_refresh.svg); }
.i-search          { --icon: url(../icons/search.svg); }

/* ===================== 品牌 ===================== */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--sw-text);
  font-weight: 600;
  font-size: 16px;
}
.brand:hover { text-decoration: none; color: var(--sw-text); }
.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--sw-radius);
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #2886de 0%, #0f6cbd 60%, #0c3b5e 100%);
}

/* ===================== 应用外壳 ===================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--sw-surface);
  box-shadow: var(--sw-shadow-4);
}
.app-header-inner {
  max-width: 1200px;
  height: 56px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.app-nav { display: flex; gap: 4px; flex: 1; }
.app-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--sw-radius);
  color: var(--sw-text-2);
}
.app-nav a:hover { background: #f0f0f0; color: var(--sw-text); text-decoration: none; }
.app-nav a.active { color: var(--sw-brand); background: var(--sw-brand-soft); font-weight: 600; }

.app-user { display: flex; align-items: center; gap: 12px; }
.app-user form { margin: 0; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--sw-brand-pressed);
  background: #cfe4fa;
}
.app-user-name { color: var(--sw-text-2); }

.app-main { flex: 1; }

.app-footer {
  padding: 16px 24px;
  text-align: center;
  color: var(--sw-text-3);
  font-size: 12px;
  border-top: 1px solid var(--sw-stroke);
  background: var(--sw-surface);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ===================== 登录页（水平 + 垂直居中） ===================== */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(40, 134, 222, .18), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(15, 108, 189, .16), transparent 60%),
    var(--sw-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px 36px 28px;
  border-radius: var(--sw-radius-lg);
  background: var(--sw-surface);
  box-shadow: var(--sw-shadow-28);
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .brand-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: var(--sw-radius-lg);
  box-shadow: var(--sw-shadow-8);
}
.login-title { font-size: 24px; line-height: 32px; }
.login-subtitle { margin: 4px 0 0; color: var(--sw-text-2); }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form fluent-text-field { width: 100%; }
.login-form fluent-text-field .icon { color: var(--sw-text-3); }
.login-form fluent-button { width: 100%; margin-top: 8px; }

.field-error {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--sw-danger);
}
.field-error:empty { display: none; }

.message-bar {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #f1bbbc;
  background: var(--sw-danger-soft);
  color: var(--sw-danger);
}
.message-bar ul { margin: 0; padding: 0; list-style: none; }
.message-bar.validation-summary-valid { display: none; }

.login-footer {
  margin: 28px 0 0;
  text-align: center;
  color: var(--sw-text-3);
  font-size: 12px;
}

/* ===================== 首页 ===================== */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, #0c3b5e 0%, #0f6cbd 55%, #2886de 100%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -60% auto;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 65%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 24px;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
}
.hero-title { margin-top: 20px; font-size: 40px; line-height: 52px; font-weight: 700; }
.hero-lead { margin: 12px 0 0; font-size: 16px; line-height: 24px; color: rgba(255, 255, 255, .86); }
.hero-actions { margin-top: 32px; display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }

.section-head { text-align: center; margin-bottom: 28px; }
.section-head h2 { font-size: 24px; line-height: 32px; }
.section-head p { margin: 6px 0 0; color: var(--sw-text-2); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.grid-3 + .grid-3 { margin-top: 16px; }

fluent-card.feature-card {
  padding: 24px;
  border-radius: var(--sw-radius-lg);
  transition: box-shadow .2s ease, transform .2s ease;
}
fluent-card.feature-card:hover { transform: translateY(-2px); box-shadow: var(--sw-shadow-16); }
.feature-card h3 { font-size: 16px; line-height: 22px; margin: 16px 0 6px; }
.feature-card p { margin: 0; color: var(--sw-text-2); }

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--sw-radius-lg);
  display: grid;
  place-items: center;
}
.feature-icon-1 { color: #0f6cbd; background: #ebf3fc; }
.feature-icon-2 { color: #0b6a0b; background: #f1faf1; }
.feature-icon-3 { color: #5c2e91; background: #f5f0fa; }

fluent-card.stat-card {
  padding: 24px;
  border-radius: var(--sw-radius-lg);
  border-top: 3px solid var(--sw-brand);
}
.stat-label { color: var(--sw-text-2); }
.stat-value { margin-top: 4px; font-size: 32px; line-height: 40px; font-weight: 700; color: var(--sw-brand); }

/* ===================== 页面头部 ===================== */
.page-head {
  background: var(--sw-surface);
  border-bottom: 1px solid var(--sw-stroke);
}
.page-head-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  line-height: 30px;
  color: var(--sw-text);
}
.page-title .icon { color: var(--sw-brand); }
.page-desc { margin: 6px 0 0; color: var(--sw-text-2); font-size: 13px; }
.page-head-actions { display: flex; gap: 8px; }

.summary-row { margin-bottom: 24px; }

/* ===================== 表格卡片 ===================== */
.table-card {
  position: relative;
  background: var(--sw-surface);
  border-radius: var(--sw-radius-lg);
  box-shadow: var(--sw-shadow-8);
}

.table-toolbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sw-stroke);
  border-radius: var(--sw-radius-lg) var(--sw-radius-lg) 0 0;
}
.table-toolbar-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.table-toolbar-title .icon { color: var(--sw-brand); }
.table-toolbar-fields {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.table-toolbar-fields fluent-text-field { width: 240px; }
.table-toolbar-fields fluent-select { min-width: 140px; }

.table-scroll { overflow-x: auto; }

.rain-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.rain-table thead th,
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
  color: var(--sw-text-2);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sw-stroke);
}
.rain-table tbody td,
.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}
.rain-table tbody tr:hover td,
.data-table tbody tr:hover td { background: #f7fbff; }
.rain-table tbody tr:last-child td,
.data-table tbody tr:last-child td { border-bottom: none; }

.col-index { width: 64px; color: var(--sw-text-3); }
.col-num { text-align: right; }
.cell-name { font-weight: 600; }
.cell-code { color: var(--sw-text-2); font-family: Consolas, "Courier New", monospace; }
.cell-rain { font-weight: 600; font-variant-numeric: tabular-nums; }
.cell-time { color: var(--sw-text-3); }

.table-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--sw-stroke);
  border-radius: 0 0 var(--sw-radius-lg) var(--sw-radius-lg);
  color: var(--sw-text-3);
  font-size: 12px;
  background: #fafafa;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 22px;
  white-space: nowrap;
}
.tag-blue   { color: #0f6cbd; background: #ebf3fc; }
.tag-green  { color: #0b6a0b; background: #f1faf1; }
.tag-purple { color: #5c2e91; background: #f5f0fa; }
.tag-amber  { color: #8a5300; background: #fff9e6; }
.tag-teal   { color: #006666; background: #e6f7f7; }
.tag-red    { color: var(--sw-danger); background: var(--sw-danger-soft); }
.tag-gray   { color: var(--sw-text-2); background: #f0f0f0; }

.empty-state {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 64px 24px;
  background: var(--sw-surface);
  border-radius: var(--sw-radius-lg);
  box-shadow: var(--sw-shadow-8);
  color: var(--sw-text-2);
}
.empty-state .icon { color: #c7c7c7; }
.empty-state p { margin: 0; }

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .hero-title { font-size: 28px; line-height: 36px; }
  .app-user-name { display: none; }
  .app-header-inner { padding: 0 16px; gap: 12px; }
  .login-card { padding: 32px 24px 24px; }
  .table-toolbar-fields fluent-text-field { width: 100%; }
  .table-toolbar-fields fluent-select { flex: 1; min-width: 0; }
}