/* ============================================================
   数智泰州 - 后台管理样式
   ============================================================ */
:root {
  --admin-primary: #C41E3A;
  --admin-primary-light: #e8334e;
  --admin-bg: #f0f2f5;
  --admin-sidebar: #1a1f2e;
  --admin-sidebar-hover: #2a3142;
  --admin-card: #ffffff;
  --admin-text: #1a1a2e;
  --admin-text-secondary: #6b7280;
  --admin-border: #e5e7eb;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--admin-bg); color: var(--admin-text); font-size: 14px;
}
a { color: var(--admin-primary); text-decoration: none; }
a:hover { color: var(--admin-primary-light); }

/* ====== 登录页 ====== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(135deg, rgba(10,15,18,0.72) 0%, rgba(20,27,40,0.55) 50%, rgba(10,15,18,0.72) 100%),
    url('/images/login-bg.jpg') center / cover no-repeat;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,255,224,0.08) 0%, transparent 70%);
  top: -200px; right: -100px;
}
.login-page::after {
  content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,107,216,0.06) 0%, transparent 70%);
  bottom: -150px; left: -100px;
}
.login-card {
  background: rgba(20, 27, 40, 0.8); backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
  padding: 48px 40px; width: 400px; position: relative; z-index: 1;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 56px; margin: 0 auto 12px; }
.login-logo h1 { color: #fff; font-size: 24px; font-weight: 700; }
.login-logo p { color: #6b7280; font-size: 13px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; color: #b0b8c0; font-size: 13px; margin-bottom: 6px; }
.login-form .form-group input {
  width: 100%; padding: 12px 16px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 8px;
  color: #fff; font-size: 14px; font-family: inherit;
  caret-color: #00FFE0;
}
.login-form .form-group input::placeholder { color: rgba(255,255,255,0.35); }
.login-form .form-group input:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px rgba(20,27,40,0.9) inset;
  transition: background-color 9999s ease-in-out 0s;
}
.login-form .form-group input:focus { outline: none; border-color: rgba(0,255,224,0.5); }
/* 密码显隐小眼睛：叠在输入框内右侧（加权 .login-form .pwd-eye，压过 .login-form button 的全宽渐变按钮规则） */
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 46px; }
.login-form .pwd-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; min-width: 0; padding: 0; border: none; border-radius: 6px;
  background: transparent; box-shadow: none; color: rgba(255,255,255,0.45); font-size: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: color .15s, transform .15s, background .15s;
}
.login-form .pwd-eye:hover { color: #00FFE0; background: rgba(255,255,255,0.06); transform: translateY(-50%); }
.login-form button {
  width: 100%; padding: 14px; background: linear-gradient(135deg, #00FFE0 0%, #5B9BFF 100%);
  border: none; border-radius: 8px; color: #0A0F12; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.3s; font-family: inherit;
}
.login-form button:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,255,224,0.3); }
.login-error {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 13px;
}

/* ====== 管理后台布局 ====== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: var(--admin-sidebar); color: #fff;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  display: flex; flex-direction: column; overflow-y: auto;
}
.admin-sidebar-header {
  padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center; gap: 0;
}
.admin-sidebar-header img { height: 48px; filter: drop-shadow(0 0 10px rgba(0,255,224,0.18)); }
.admin-nav { flex: 1; padding: 16px 0; }
.admin-nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  color: #b0b8c0; font-size: 14px; transition: all 0.2s; cursor: pointer;
}
.admin-nav-item:hover { background: var(--admin-sidebar-hover); color: #fff; }
.admin-nav-item.active { background: var(--admin-sidebar-hover); color: #00FFE0; border-left: 3px solid #00FFE0; }
.admin-nav-item i { width: 20px; text-align: center; }
.admin-nav-arrow { margin-left: auto; font-size: 10px !important; opacity: 0.7; }
.admin-nav-sub {
  background: rgba(0,0,0,0.15);
  padding: 6px 0;
}
.admin-nav-item-sub {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 24px 8px 50px;
  color: #8a94a0; font-size: 13px; text-decoration: none; transition: all 0.2s;
}
.admin-nav-item-sub:hover { color: #fff; background: rgba(255,255,255,0.04); }
.admin-nav-item-sub.active { color: #00FFE0; border-left: 3px solid #00FFE0; }
.admin-nav-item-sub i { width: 16px; text-align: center; font-size: 12px; }
.admin-sidebar-footer {
  padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; color: #6b7280;
}

.admin-main { flex: 1; margin-left: 240px; }
.admin-topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--admin-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 50;
}
.admin-topbar h1 { font-size: 20px; font-weight: 700; }
.admin-topbar-user { display: flex; align-items: center; gap: 12px; }
.admin-topbar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--admin-primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.admin-content { padding: 24px 32px; }

/* ====== 通用组件 ====== */
.card { background: var(--admin-card); border-radius: var(--admin-radius); padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-header h2 { font-size: 18px; font-weight: 700; }

.btn { padding: 8px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.btn-primary { background: var(--admin-primary); color: #fff; }
.btn-primary:hover { background: var(--admin-primary-light); }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-success { background: var(--admin-success); color: #fff; }
.btn-danger { background: var(--admin-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 12px 16px; background: #f9fafb; font-size: 13px; font-weight: 600; color: #6b7280; border-bottom: 1px solid var(--admin-border); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--admin-border); font-size: 14px; }
.table tr:hover { background: #f9fafb; }
.table img.thumb { width: 60px; height: 40px; object-fit: cover; border-radius: 4px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--admin-border);
  border-radius: 6px; font-size: 14px; font-family: inherit; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--admin-primary); }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: 12px; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

.stat-card-admin { background: #fff; border-radius: var(--admin-radius); padding: 24px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.stat-card-admin .icon { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-card-admin .value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-card-admin .label { font-size: 13px; color: #6b7280; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }

.empty { text-align: center; padding: 48px; color: #9ca3af; }
.empty i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 32px; width: 600px; max-width: 90%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f3f4f6; }
.modal-header h2 { font-size: 20px; font-weight: 700; }
.modal-header h2 i { color: #00FFE0; margin-right: 4px; }
.modal-close { font-size: 24px; cursor: pointer; color: #9ca3af; background: none; border: none; padding: 0; line-height: 1; }
.modal-close:hover { color: #111827; }

/* ====== AI 管理 ====== */
.ai-tabs {
  display: flex; gap: 4px; margin: 24px 0;
  border-bottom: 1px solid var(--admin-border);
  padding-bottom: 0;
}
.ai-tab {
  padding: 10px 20px;
  font-size: 14px; font-weight: 600;
  color: #6b7280; text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.ai-tab:hover { color: #111827; }
.ai-tab.active { color: var(--admin-primary); border-bottom-color: var(--admin-primary); }
.ai-tab i { opacity: 0.7; }

.ai-quick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px;
  background: linear-gradient(135deg, rgba(0,255,224,0.12), rgba(91,155,255,0.12));
  border: 1px solid rgba(0,255,224,0.4);
  color: #0a8b6f;
  border-radius: 100px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  font-family: inherit;
}
.ai-quick-btn:hover {
  background: linear-gradient(135deg, rgba(0,255,224,0.2), rgba(91,155,255,0.2));
  box-shadow: 0 0 14px rgba(0,255,224,0.35);
  transform: translateY(-1px);
}
.ai-quick-btn i { color: var(--admin-primary); }
.ai-quick-pulse {
  width: 8px; height: 8px;
  background: #00FFE0;
  border-radius: 50%;
  position: relative;
}
.ai-quick-pulse::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%; background: #00FFE0;
  animation: ai-pulse 1.6s ease-out infinite;
}
@keyframes ai-pulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  70%  { transform: scale(3.2); opacity: 0; }
  100% { transform: scale(3.2); opacity: 0; }
}

.ai-progress {
  background: #f9fafb;
  border-radius: 6px;
  padding: 16px;
  margin: 14px 0;
}
.ai-progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}
.ai-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00FFE0, #5B9BFF);
  width: 0;
  transition: width 0.3s ease-out;
}
.ai-progress-text {
  margin-top: 8px;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

.ai-select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.ai-select:focus { outline: none; border-color: var(--admin-primary); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card-admin {
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: all 0.2s;
}
.stat-card-admin:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); transform: translateY(-1px); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-num {
  font-size: 22px; font-weight: 700; line-height: 1.1;
  color: #111827;
}
.stat-label {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* 模态框最大宽度支持 */
.modal.modal-wide { width: 760px; }

/* ====== 栏目管理 ============================ */
.cat-color-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cat-color-dot-wrap { position: relative; cursor: pointer; line-height: 0; }
.cat-color-dot-wrap input[type="radio"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0;
}
.cat-color-dot {
  display: inline-block; width: 28px; height: 28px; border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08); transition: all 0.15s;
}
.cat-color-dot-wrap input[type="radio"]:checked + .cat-color-dot {
  box-shadow: 0 0 0 2px var(--admin-primary), 0 0 8px rgba(196,30,58,0.4);
  transform: scale(1.12);
}
.cat-color-custom { background: conic-gradient(red, orange, yellow, green, cyan, blue, violet, red); }
.cat-color-input { width: 40px; height: 30px; padding: 0; border: 1px solid var(--admin-border); border-radius: 6px; cursor: pointer; }

.cat-banner-thumb { width: 80px; height: 44px; object-fit: cover; border-radius: 4px; }
.cat-banner-preview { width: 240px; height: 100px; object-fit: cover; border-radius: 6px; margin-top: 8px; display: block; }
.cat-no-banner {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  background: #f3f4f6; color: #9ca3af; font-size: 12px;
}
.cat-checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #374151; cursor: pointer; }
.cat-checkbox input { width: 18px; height: 18px; }
.cat-top-wrap { padding-top: 4px; }

/* ====== 会员申请管理 - 详情展开区（浅底深字） ============================ */
.app-detail-row {
  background: #f7f9fc;
  color: #1f2937;
  font-size: 13px;
  padding: 14px 18px;
  border-left: 3px solid var(--admin-primary);
}
.app-detail-row .app-label {
  color: #6b7280;
  margin-right: 6px;
}
.app-detail-row .app-photo {
  /* 固定相框：91×119，原图无论多大都按此尺寸裁剪显示 */
  width: 91px !important;
  height: 119px !important;
  max-width: 91px;
  max-height: 119px;
  object-fit: cover;   /* 原图无论多大都填满相框、只裁剪不变形 */
  object-position: top center;
  border-radius: 6px;
  border: 1px solid var(--admin-border);
  background: #f0f2f5; /* 原图不足时填充底色，避免破框 */
  flex: 0 0 auto;
}
.app-detail-row .app-section-title {
  color: var(--admin-primary);
  font-weight: 600;
}

/* ====== 响应式适配（平板 / 手机） ============================ */
/* 汉堡按钮：桌面隐藏 */
.admin-menu-toggle {
  display: none;
  width: 38px; height: 38px; border: 1px solid var(--admin-border);
  background: #fff; border-radius: 8px; cursor: pointer;
  font-size: 16px; color: #374151; align-items: center; justify-content: center;
}
.admin-sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(2,6,12,.5); backdrop-filter: blur(2px);
}
.admin-sidebar-backdrop.show { display: block; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 1024px) {
  /* 侧边栏改为抽屉式：默认收起，点汉堡展开 */
  .admin-menu-toggle { display: inline-flex; }
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main { margin-left: 0; }

  /* 栅格降级 */
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* 顶栏与内容区内边距收紧 */
  .admin-topbar { padding: 0 16px; }
  .admin-topbar h1 { font-size: 17px; }
  .admin-content { padding: 16px; }
  .card { padding: 16px; }

  /* AI 选项卡允许横向滚动 */
  .ai-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ai-tab { white-space: nowrap; }
}

@media (max-width: 640px) {
  .grid-4, .stats-grid { grid-template-columns: 1fr; }
  .admin-topbar-user > div:last-child { display: none; } /* 只留头像，省空间 */
  .modal { padding: 20px; width: 94%; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .login-card { width: 92%; padding: 36px 24px; }
}
