/* ========== VCHE Hub 管理后台 - 暗色玻璃拟态风格 (移动优先) ========== */
@import url('./common.css');

/* ========== 布局基础 ========== */
.admin-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ========== 移动端顶栏 (汉堡菜单) ========== */
.admin-mobile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 16px;
  padding-top: max(env(safe-area-inset-top), 0px);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 101;
}

.admin-mobile-bar .mobile-logo {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #34d399, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hamburger-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.hamburger-btn:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--primary-color);
}

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  position: relative;
  transition: all 0.3s ease;
}

.hamburger-btn span::before,
.hamburger-btn span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.3s ease;
}

.hamburger-btn span::before { top: -6px; }
.hamburger-btn span::after { top: 6px; }

.hamburger-btn.active span { background: transparent; }
.hamburger-btn.active span::before { top: 0; transform: rotate(45deg); }
.hamburger-btn.active span::after { top: 0; transform: rotate(-45deg); }

/* ========== 侧边栏遮罩 (移动端) ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 102;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* ========== 侧边栏 ========== */
.admin-sidebar {
  position: fixed;
  top: 0;
  left: -260px;
  width: 260px;
  height: 100vh;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  color: var(--text-primary);
  flex-shrink: 0;
  z-index: 103;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: env(safe-area-inset-top);
}

.admin-sidebar.show { left: 0; }

.sidebar-header {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #34d399, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-menu {
  padding: 12px 8px;
  flex: 1;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

.sidebar-menu a::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary-color);
  opacity: 0;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.sidebar-menu a:hover {
  color: var(--text-primary);
  background: rgba(16, 185, 129, 0.08);
}

.sidebar-menu a:hover::before { opacity: 0.6; }

.sidebar-menu a.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.08) 100%);
  color: var(--primary-light);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.sidebar-menu a.active::before { opacity: 1; }

.sidebar-menu a .menu-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 16px;
}

/* ========== 主内容区 ========== */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.admin-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 24px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-topbar h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-right span {
  color: var(--text-secondary);
  font-size: 14px;
}

.admin-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
  overflow-x: hidden;
}

/* ========== 统计卡片网格 ========== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: rgba(16, 185, 129, 0.25);
  transform: translateY(-2px);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-light);
  background: linear-gradient(135deg, #34d399, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== 卡片标题 ========== */
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ========== 筛选栏 ========== */
.filter-bar {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  flex: 1 1 140px;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.filter-bar input::placeholder {
  color: var(--text-muted);
}

.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(16, 185, 129, 0.05);
}

.filter-bar .btn-primary {
  width: auto;
  height: 40px;
  padding: 0 18px;
  flex: 0 0 auto;
}

/* ========== 表格包装 (移动端横向滚动) ========== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -20px;
  padding: 0 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table th {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  background: rgba(16, 185, 129, 0.05);
  position: sticky;
  top: 0;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ========== 按钮尺寸调整 ========== */
.btn-primary {
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

.btn-primary[style*="height:28px"],
.btn-primary[style*="height:32px"] {
  height: auto !important;
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13px;
  width: auto !important;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
}

.btn-link {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.btn-link:hover {
  border-color: var(--primary-color);
  color: var(--primary-light);
}

/* ========== 日志/代码块 ========== */
pre {
  font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
  background: rgba(15, 23, 42, 0.8) !important;
  color: #94a3b8;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid var(--glass-border);
}

#outLogs { color: #94a3b8; }
#errLogs { color: #f87171; }

h4 {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin: 16px 0 8px;
}

/* ========== 弹窗 ========== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: rgba(30, 41, 59, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-box h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== 告警分区列表 ========== */
.alert-section {
  margin-top: 20px;
}

.alert-section-title {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.alert-list li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.alert-list li:last-child { border-bottom: none; }

/* ========== 分页 ========== */
.pagination-box {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ========== 消息提示 ========== */
.msg-inline {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}

.msg-inline.show { display: block; }

.msg-inline.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.msg-inline.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--primary-light);
}

/* ========== 登录页 ========== */
.admin-login-bg {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.admin-login-card h2 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #34d399, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-login-card .sub-title {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ========== 响应式 - 平板 ========== */
@media (min-width: 600px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .admin-content {
    padding: 20px;
  }
}

/* ========== 响应式 - PC端 ========== */
@media (min-width: 1024px) {
  .admin-layout {
    flex-direction: row;
  }

  .admin-mobile-bar {
    display: none;
  }

  .sidebar-overlay { display: none !important; }

  .admin-sidebar {
    position: sticky;
    top: 0;
    left: 0;
    width: 240px;
    z-index: 1;
  }

  .admin-main {
    min-width: 0;
  }

  .admin-topbar {
    display: flex;
  }

  .admin-content {
    padding: 24px 32px;
    padding-bottom: 32px;
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .stat-card {
    padding: 20px;
  }

  .stat-card .stat-value {
    font-size: 28px;
  }

  .data-table {
    min-width: auto;
  }

  .table-wrapper {
    overflow-x: visible;
    margin: 0;
    padding: 0;
  }
}

@media (min-width: 1400px) {
  .stat-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .admin-content {
    padding: 32px 40px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
  }
}
