/* ================================================================
   宁夏社科一体化平台 - 交互增强样式
   ================================================================ */

/* ========== 1. Toast 通知 ========== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.3s ease, toastOut 0.3s ease forwards;
  animation-duration: 0.3s, 0.3s;
  animation-fill-mode: forwards, forwards;
  max-width: 380px;
  transform: translateX(120%);
  cursor: default;
}
.toast.success { background: linear-gradient(135deg, #43A047, #2E7D32); }
.toast.error { background: linear-gradient(135deg, #E53935, #C62828); }
.toast.warning { background: linear-gradient(135deg, #FB8C00, #EF6C00); }
.toast.info { background: linear-gradient(135deg, #1E88D6, #0D47A1); }
.toast .icon { font-size: 18px; flex-shrink: 0; }
.toast .msg { flex: 1; }
.toast .close-btn {
  font-size: 16px;
  opacity: 0.7;
  cursor: pointer;
  flex-shrink: 0;
  background: none;
  border: none;
  color: #fff;
  padding: 0 4px;
}
.toast .close-btn:hover { opacity: 1; }
@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

/* ========== 2. Modal 弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99998;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  padding: 28px 32px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalSlideIn 0.25s ease;
}
.modal-box .modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-box .modal-body { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.modal-box .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========== 3. 加载动画 ========== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loading-spinner.lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ========== 4. 回到顶部按钮 ========== */
.back-to-top {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #fff;
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,45,85,0.25);
  z-index: 999;
  border: none;
  transition: all var(--nx-fast) var(--nx-ease);
}
.back-to-top:hover {
  background: var(--primary-blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,45,85,0.35);
}
.back-to-top.show { display: flex; }

/* ========== 5. 滚动触发的动画 ========== */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== 6. 卡片悬浮增强 ========== */
.card, .stat-card, .info-card, .topic-card, .digital-card,
.featured-item, .friend-link-item, .manage-entry, .expert-card,
.activity-card, .module-card {
  will-change: transform;
}
.card:hover, .stat-card:hover { transform: translateY(-1px); }
.info-card:hover, .manage-entry:hover, .module-card:hover { transform: translateY(-2px); }

/* ========== 7. 按钮波纹效果 ========== */
.btn {
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: translate(-50%, -50%);
  transition: width 0.5s, height 0.5s;
}
.btn:active::after {
  width: 200%;
  padding-bottom: 200%;
}

/* ========== 8. 表格行增强 ========== */
tr {
  transition: background var(--nx-fast) var(--nx-ease);
}
tr.clickable {
  cursor: pointer;
}
tr.clickable:hover td {
  background: #eef4fa;
}

/* ========== 9. 输入框增强 ========== */
input, select, textarea {
  transition: border-color var(--nx-fast) var(--nx-ease), box-shadow var(--nx-fast) var(--nx-ease);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary-blue) !important;
  box-shadow: 0 0 0 3px rgba(0,104,183,0.1);
}

/* ========== 10. 导航高亮动画 ========== */
.nav-item {
  position: relative;
}
.nav-item::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 0;
  height: 2px;
  background: #fff;
  transition: all var(--nx-mid) var(--nx-ease);
  transform: translateX(-50%);
  opacity: 0;
}
.nav-item:hover::after {
  width: 60%;
  opacity: 0.4;
}
.nav-item.active::after {
  width: 60%;
  opacity: 1;
}

/* ========== 11. 标签Tag增强 ========== */
.tag {
  transition: all var(--nx-fast) var(--nx-ease);
}
.tag:hover {
  transform: scale(1.05);
}

/* ========== 12. 进度条动画 ========== */
.bar-fill {
  transition: width 0.8s var(--nx-ease);
}

/* ========== 13. 角色切换指示器 ========== */
.role-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.role-indicator.admin { background: #E3F2FD; color: #0D47A1; }
.role-indicator.expert { background: #F3E5F5; color: #6A1B9A; }
.role-indicator.org { background: #E8F5E9; color: #1B5E20; }
.role-indicator.user { background: #FFF3E0; color: #E65100; }

/* ========== 14. 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .text { font-size: 14px; }

/* ========== 15. 分割线标题 ========== */
.divider-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}
.divider-title::before,
.divider-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
.divider-title span {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ========== 16. 统计数字动画 ========== */
.stat-number, .num {
  transition: color var(--nx-mid) var(--nx-ease);
}

/* ========== 17. 后台角色面板标识 ========== */
.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

/* ========== 18. 后台数据范围提示 ========== */
.data-scope-hint {
  font-size: 12px;
  color: var(--text-muted);
  background: #f8f9fb;
  border: 1px dashed var(--border-light);
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== 19. 响应式增强 ========== */
@media (max-width: 768px) {
  .toast { max-width: calc(100vw - 40px); }
  .back-to-top { bottom: 20px; right: 20px; width: 40px; height: 40px; }
  .modal-box { padding: 20px; }
  .data-scope-hint { font-size: 11px; padding: 6px 10px; }
}
