﻿/* 方策检测系统 - 赛博风格 */
:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --border: #1e1e30;
  --primary: #00f0ff;
  --accent: #ff00ff;
  --text: #e0e0e8;
  --text-dim: #6a6a80;
  --green: #00ff88;
  --red: #ff3366;
  --yellow: #ffdd00;
  --orange: #ff8a00;
  --on-primary: #001018;
  --on-success: #001018;
  --nav-bg: linear-gradient(135deg, #0a0a15 0%, #12122a 100%);
  --nav-shadow: 0 0 20px rgba(0,240,255,0.1);
  --brand-glow: 0 0 10px rgba(0,240,255,0.5);
  --popover-shadow: 0 8px 32px rgba(0,0,0,0.5);
  --primary-soft: rgba(0,240,255,0.1);
  --primary-faint: rgba(0,240,255,0.05);
  --primary-row: rgba(0,240,255,0.02);
  --primary-shadow: 0 0 20px rgba(0,240,255,0.1);
  --field-bg: rgba(255,255,255,0.03);
  --backdrop: rgba(0, 0, 0, 0.72);
  --danger-panel-bg: linear-gradient(180deg, rgba(255, 51, 102, 0.12), rgba(18, 18, 26, 0.98));
  --danger-title: #ffd7df;
  --danger-text: #ffb8c7;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-card: #ffffff;
  --border: #d8e0ea;
  --primary: #007f9e;
  --accent: #a02fb7;
  --text: #172033;
  --text-dim: #667085;
  --green: #12805c;
  --red: #d92d55;
  --yellow: #9b6b00;
  --orange: #c65d00;
  --on-primary: #ffffff;
  --on-success: #ffffff;
  --nav-bg: linear-gradient(135deg, #ffffff 0%, #eef8fb 100%);
  --nav-shadow: 0 8px 24px rgba(16,24,40,0.08);
  --brand-glow: none;
  --popover-shadow: 0 12px 30px rgba(16,24,40,0.14);
  --primary-soft: rgba(0,127,158,0.09);
  --primary-faint: rgba(0,127,158,0.08);
  --primary-row: rgba(0,127,158,0.045);
  --primary-shadow: 0 12px 28px rgba(0,127,158,0.12);
  --field-bg: #ffffff;
  --backdrop: rgba(15, 23, 42, 0.42);
  --danger-panel-bg: linear-gradient(180deg, #fff7f8, #ffffff);
  --danger-title: #9f1239;
  --danger-text: #be123c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 70px;
  transition: background 0.2s ease, color 0.2s ease;
}

/* 顶部导航 */
.nav-header {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--primary);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--nav-shadow);
}

.nav-brand {
  color: var(--primary);
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: var(--brand-glow);
}

.nav-actions { display: flex; gap: 8px; align-items: center; }

/* 下拉菜单 */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-content {
  display: block;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  min-width: 180px;
  z-index: 200;
  border-radius: 4px;
  box-shadow: var(--popover-shadow);
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}
.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown.open .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.nav-dropbtn { user-select: none; }
.nav-dropdown-content a {
  color: var(--text);
  padding: 10px 16px;
  display: block;
  text-decoration: none;
  font-size: 14px;
}
.nav-dropdown-content a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.theme-toggle {
  min-width: 82px;
  justify-content: center;
}
.theme-toggle-icon {
  width: 16px;
  text-align: center;
}

/* 按钮 */
.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-success { background: var(--green); color: var(--on-success); border-color: var(--green); }

/* 容器 */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 18px; font-weight: 600; color: var(--primary); }

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
  cursor: pointer;
}
.stat-card:hover {
  border-color: var(--primary);
  box-shadow: var(--primary-shadow);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.stat-value { font-size: 36px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

/* 表格 */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  background: var(--primary-faint);
  color: var(--primary);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--primary);
  font-weight: 600;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tr:hover td { background: var(--primary-row); }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(0,240,255,0.2);
}
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { cursor: pointer; }
select option,
select optgroup {
  background: #ffffff;
  color: #111111;
}
select option:disabled {
  color: #666666;
}

/* 表单行 */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* 搜索框 */
.search-box {
  padding: 8px 14px;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  width: 240px;
}
.search-box:focus { outline: none; border-color: var(--primary); }

/* 搜索栏（表单行） */
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.search-bar .form-control {
  max-width: 360px;
  flex: 1;
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}
.tag-primary { background: rgba(0,240,255,0.15); color: var(--primary); }
.tag-success { background: rgba(0,255,136,0.15); color: var(--green); }
.tag-warning { background: rgba(255,221,0,0.15); color: var(--yellow); }
.tag-danger { background: rgba(255,51,102,0.15); color: var(--red); }

/* 详情 */
.detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.detail-label { color: var(--text-dim); font-weight: 500; }
.detail-value { color: var(--text); }

/* 底部导航(手机) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--primary);
  padding: 8px 0;
  z-index: 100;
  justify-content: space-around;
}
.bottom-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-nav a.active { color: var(--primary); }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state .text { font-size: 16px; }

/* 响应式 */
@media (max-width: 768px) {
  .container { padding: 12px; }
  .nav-header { padding: 10px 12px; }
  .nav-brand { font-size: 16px; }
  .nav-actions .btn { font-size: 11px; padding: 5px 10px; }
  .bottom-nav { display: flex; }
  .search-box { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  table { font-size: 12px; }
  th, td { padding: 8px 6px; }
}

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.toolbar-left { display: flex; gap: 8px; align-items: center; }

/* 警告 */
.alert {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-info { background: rgba(0,240,255,0.1); border: 1px solid var(--primary); color: var(--primary); }
.alert-success { background: rgba(0,255,136,0.1); border: 1px solid var(--green); color: var(--green); }
.alert-warning { background: rgba(255,221,0,0.1); border: 1px solid var(--yellow); color: var(--yellow); }
.alert-danger { background: rgba(255,51,102,0.1); border: 1px solid var(--red); color: var(--red); }


/* Delete strategy: admin only + shared modal */
body:not(.is-admin) form[action$="/delete"]:not(.inline-delete-form) {
  display: none !important;
}

.delete-confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}
.delete-confirm-modal.active {
  display: block;
}
.delete-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
}
.delete-confirm-panel {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  margin: 12vh auto 0;
  padding: 20px;
  border-radius: 16px;
  background: var(--danger-panel-bg);
  border: 1px solid rgba(255, 51, 102, 0.55);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.delete-confirm-head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 51, 102, 0.35);
}
.delete-confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 51, 102, 0.14);
  color: var(--red);
  font-size: 22px;
  border: 1px solid rgba(255, 51, 102, 0.45);
  flex: 0 0 auto;
}
.delete-confirm-title {
  color: var(--danger-title);
  font-size: 18px;
  font-weight: 700;
}
.delete-confirm-text,
.delete-confirm-body {
  color: var(--danger-text);
  font-size: 12px;
  line-height: 1.6;
}
.delete-confirm-body {
  padding: 14px 0 4px;
}
.delete-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
}
.delete-confirm-actions .btn {
  min-width: 96px;
  justify-content: center;
}
@media (max-width: 760px) {
  .delete-confirm-panel {
    margin-top: 18vh;
    padding: 16px;
  }
  .delete-confirm-actions {
    flex-direction: column-reverse;
  }
  .delete-confirm-actions .btn {
    width: 100%;
  }
}
