/* ============================================
   测星人管理后台 - 样式表
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: #333;
  background: #f5f7fa;
}

.hidden {
  display: none !important;
}

/* ============================================
   登录页面
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header .logo {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
}

.login-header .subtitle {
  font-size: 13px;
  color: #95a5a6;
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #7f8c8d;
  font-weight: 500;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.login-form input:focus {
  outline: none;
  border-color: #667eea;
}

.captcha-group {
  display: flex;
  gap: 12px;
}

.captcha-group input {
  flex: 1;
}

.captcha {
  width: 100px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  color: #667eea;
  letter-spacing: 4px;
  cursor: pointer;
  user-select: none;
}

.btn-login {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-login:hover {
  transform: translateY(-2px);
}

.login-error {
  margin-top: 16px;
  text-align: center;
  color: #e74c3c;
  font-size: 13px;
  min-height: 20px;
}

/* ============================================
   管理后台布局
   ============================================ */
.admin-panel {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: #2c3e50;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #34495e;
}

.sidebar-header .logo {
  font-size: 32px;
}

.sidebar-header .logo-text {
  font-size: 16px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  padding: 16px 12px 8px;
  font-size: 11px;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #bdc3c7;
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.nav-item:hover {
  background: #34495e;
  color: #fff;
}

.nav-item.active {
  background: #667eea;
  color: #fff;
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.nav-text {
  font-size: 14px;
}

/* 主内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f5f7fa;
}

/* 顶部导航 */
.top-bar {
  height: 64px;
  background: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.top-bar-left h2 {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
}

.breadcrumb {
  font-size: 12px;
  color: #95a5a6;
  margin-top: 2px;
}

.breadcrumb .separator {
  margin: 0 8px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: #2c3e50;
}

.user-role {
  font-size: 12px;
  color: #95a5a6;
}

.btn-logout {
  padding: 8px 16px;
  background: #f5f5f5;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  color: #7f8c8d;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: #e8e8e8;
  color: #333;
}

/* 页面内容 */
.page-content {
  flex: 1;
  padding: 24px;
}

.page {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 统计卡片 */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.stat-icon.blue { background: #e8f4fd; }
.stat-icon.green { background: #e8f8f0; }
.stat-icon.orange { background: #fef3e7; }
.stat-icon.purple { background: #f0ecf8; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
}

.stat-label {
  font-size: 13px;
  color: #95a5a6;
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
}

.card-body {
  padding: 24px;
}

.more-link {
  color: #667eea;
  font-size: 13px;
  text-decoration: none;
}

.more-link:hover {
  text-decoration: underline;
}

/* 仪表盘网格 */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* 数据表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.data-table th {
  font-size: 12px;
  color: #95a5a6;
  font-weight: 500;
  background: #fafafa;
}

.data-table td {
  font-size: 13px;
  color: #333;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table.full {
  font-size: 13px;
}

/* 热度排行 */
.rank-list {
  list-style: none;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
}

.rank-item:last-child {
  border-bottom: none;
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #666;
}

.rank-item:nth-child(1) .rank-badge { background: #ff6b6b; color: #fff; }
.rank-item:nth-child(2) .rank-badge { background: #feca57; color: #fff; }
.rank-item:nth-child(3) .rank-badge { background: #48dbfb; color: #fff; }

.rank-title {
  flex: 1;
  font-size: 14px;
  color: #2c3e50;
}

.rank-hot {
  font-size: 13px;
  color: #ff6b6b;
  font-weight: 500;
}

/* 页面头部 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.search-box input,
.filter-group select {
  height: 38px;
  padding: 0 16px;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.search-box input {
  width: 240px;
}

.btn-group {
  display: flex;
  gap: 12px;
}

/* 按钮 */
.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  padding: 10px 20px;
  background: #fff;
  color: #7f8c8d;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #f5f5f5;
  color: #333;
}

.btn-save {
  margin-top: 16px;
}

/* 操作按钮 */
.btn-action {
  padding: 4px 10px;
  margin-right: 6px;
  background: transparent;
  border: none;
  color: #667eea;
  font-size: 13px;
  cursor: pointer;
}

.btn-action:hover {
  text-decoration: underline;
}

.btn-action.danger {
  color: #e74c3c;
}

/* 状态标签 */
.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.status-tag.active {
  background: #e8f8f0;
  color: #27ae60;
}

.status-tag.inactive {
  background: #f5f5f5;
  color: #95a5a6;
}

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #7f8c8d;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

.form-group input[type="color"] {
  width: 60px;
  height: 40px;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
  cursor: pointer;
}

.radio-group {
  display: flex;
  gap: 24px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: 0.3s;
}

.slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.switch input:checked + .slider {
  background: #667eea;
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* 弹窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  width: 480px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content.large {
  width: 600px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #95a5a6;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: #2c3e50;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  animation: slideDown 0.3s ease;
}

.toast.success {
  background: #27ae60;
}

.toast.error {
  background: #e74c3c;
}

@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 结果分布图 */
.result-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.result-item {
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.result-count {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
}

.result-name {
  font-size: 13px;
  color: #7f8c8d;
  margin-top: 4px;
}

/* 响应式 */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 64px;
  }
  
  .sidebar-header .logo-text,
  .nav-text,
  .nav-section {
    display: none;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box input {
    width: 100%;
  }
}
