/* 灵宠养成 - 管理后台样式 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --success-color: #52c41a;
  --warning-color: #faad14;
  --danger-color: #ff4d4f;
  --bg-dark: #0f0f23;
  --bg-card: #1a1a2e;
  --bg-sidebar: #16213e;
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --border-color: #2d3748;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
}

/* 布局 */
.admin-container {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  text-align: center;
}

.sidebar-header h2 {
  font-size: 1.2rem;
  font-weight: bold;
}

.sidebar-nav {
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s;
  border-left: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(102, 126, 234, 0.1);
  color: var(--text-primary);
  border-left-color: var(--primary-color);
}

.nav-item .icon {
  font-size: 1.2rem;
  margin-right: 10px;
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

/* 顶部栏 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-title h1 {
  font-size: 1.5rem;
  font-weight: bold;
}

.top-bar-actions {
  display: flex;
  gap: 20px;
  align-items: center;
}

.admin-info {
  color: var(--text-secondary);
}

/* 内容区域 */
.content-area {
  padding: 30px;
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: 1.2rem;
  font-weight: bold;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(135deg, var(--bg-card), rgba(102, 126, 234, 0.1));
  border-radius: 12px;
  padding: 24px;
  border: 1px solid var(--border-color);
}

.stat-card .stat-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-card .stat-label {
  color: var(--text-secondary);
  margin-top: 5px;
}

/* 表格 */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: rgba(102, 126, 234, 0.1);
  font-weight: 600;
  color: var(--text-primary);
}

tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

/* 按钮 */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-warning {
  background: var(--warning-color);
  color: #000;
}

/* 表单 */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 标签 */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(82, 196, 26, 0.2);
  color: var(--success-color);
}

.badge-warning {
  background: rgba(250, 173, 20, 0.2);
  color: var(--warning-color);
}

.badge-danger {
  background: rgba(255, 77, 79, 0.2);
  color: var(--danger-color);
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* 加载状态 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 搜索框 */
.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-box input {
  flex: 1;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
}

.pagination button.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

/* 图表区域 */
.chart-container {
  height: 300px;
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  
  .nav-item span:not(.icon) {
    display: none;
  }
  
  .main-content {
    margin-left: 60px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* 进度条 */
.progress-bar {
  height: 8px;
  background: var(--bg-dark);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
  transition: width 0.3s;
}

/* 提示框 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 25px;
  background: var(--bg-card);
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast.error {
  border-left-color: var(--danger-color);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========== 宠物内容管理样式 ========== */

/* 页面头部 */
.page-header {
  margin-bottom: 30px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.page-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Tab切换 */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.9rem;
}

.tab-btn:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--text-primary);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-color: transparent;
}

/* Tab内容区 */
.tab-content {
  min-height: 400px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* 面板头部 */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-header h3 {
  font-size: 1.2rem;
  font-weight: bold;
}

.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* 筛选选择器 */
.filter-select {
  padding: 8px 15px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 稀有度徽章 */
.badge-common {
  background: rgba(128, 128, 128, 0.2);
  color: #888;
}

.badge-rare {
  background: rgba(0, 191, 255, 0.2);
  color: #00bfff;
}

.badge-epic {
  background: rgba(138, 43, 226, 0.2);
  color: #9932cc;
}

.badge-legendary {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 140, 0, 0.3));
  color: #ffd700;
}

/* 动画类型徽章 */
.badge-anim {
  background: rgba(102, 126, 234, 0.2);
  color: var(--primary-color);
}

/* 互动类型徽章 */
.badge-interaction {
  background: rgba(255, 192, 203, 0.2);
  color: #ff69b4;
}

/* 表格中的代码显示 */
td code {
  background: var(--bg-dark);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

/* 空状态 */
.empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px !important;
}

/* 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: 0.3s;
  border-radius: 24px;
}

.switch .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* 模态框扩展 */
.modal-dialog {
  max-width: 700px;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 30px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h3 {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

/* 表单扩展 */
.modal-form {
  max-width: 100%;
}

.modal-form .form-group {
  margin-bottom: 15px;
}

.modal-form .form-group small {
  display: block;
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

.form-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

/* 输入组 */
.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
}

/* 按钮尺寸 */
.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-secondary {
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

/* 详情区块 */
.detail-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.detail-section:last-child {
  border-bottom: none;
}

.detail-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}

.detail-grid div {
  padding: 8px 0;
}

/* 按钮组 */
.btn-group {
  display: flex;
  gap: 10px;
  justify-content: center;
}
