/* ===== 全局用户体验优化 ===== */

/* ===== 1. 平滑滚动 ===== */
html {
  scroll-behavior: smooth;
}

/* ===== 2. 页面加载动画 ===== */
body {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== 3. 按钮优化 ===== */
.btn,
button,
input[type="submit"],
input[type="button"] {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
}

.btn:active,
button:active,
input[type="submit"]:active {
  transform: scale(0.98);
}

/* 按钮点击效果 */
.btn::after,
button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after,
button:active::after {
  width: 300px;
  height: 300px;
}

/* ===== 4. 表单优化 ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
  transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10, 74, 122, 0.15);
}

/* 表单输入框图标提示 */
.form-control::placeholder {
  color: rgba(10, 74, 122, 0.5);
  transition: all 0.3s ease;
}

.form-control:focus::placeholder {
  opacity: 0.7;
  transform: translateX(5px);
}

/* ===== 5. 表格优化 ===== */
.table-responsive table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.table-responsive table thead th {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 13px;
  padding: 16px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table-responsive table tbody tr {
  transition: all 0.3s ease;
  cursor: pointer;
}

.table-responsive table tbody tr:hover {
  background: rgba(26, 109, 179, 0.08);
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.table-responsive table tbody td {
  padding: 14px;
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(10, 74, 122, 0.08);
}

.table-responsive table tbody tr:last-child td {
  border-bottom: none;
}

/* 表格内链接优化 */
.table-responsive table tbody a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
}

.table-responsive table tbody a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s ease;
}

.table-responsive table tbody a:hover {
  color: var(--secondary);
}

.table-responsive table tbody a:hover::after {
  width: 100%;
}

/* ===== 6. 卡片组件优化 ===== */
.content-card {
  transition: all 0.3s ease;
}

.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-header {
  transition: all 0.3s ease;
}

.content-card:hover .card-header {
  background: linear-gradient(135deg, rgba(10, 74, 122, 0.05) 0%, rgba(26, 109, 179, 0.05) 100%);
}

/* ===== 7. 加载状态优化 ===== */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid rgba(10, 74, 122, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 按钮加载状态 */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ===== 8. 空状态提示 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 10px;
}

.empty-state-description {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 20px;
}

.empty-state-action {
  display: inline-block;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.empty-state-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(10, 74, 122, 0.3);
}

/* ===== 9. 徽章和状态标签优化 ===== */
.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.3s ease;
}

.badge:hover,
.status-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 成功状态 */
.badge-success,
.status-badge.success {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(40, 167, 69, 0.05) 100%);
  color: #28a745;
}

/* 失败状态 */
.badge-failure,
.status-badge.failure {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(220, 53, 69, 0.05) 100%);
  color: #dc3545;
}

/* 待处理状态 */
.badge-pending,
.status-badge.pending {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.05) 100%);
  color: #ffc107;
}

/* ===== 10. 面包屑导航优化 ===== */
.page-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: slideInDown 0.5s ease;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-breadcrumb a {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.3s ease;
  position: relative;
}

.page-breadcrumb a:hover {
  color: var(--primary);
}

.page-breadcrumb a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.page-breadcrumb a:hover::after {
  width: 100%;
}

.page-breadcrumb span:not(.breadcrumb-sep) {
  color: var(--gray);
  font-size: 14px;
}

.breadcrumb-sep {
  color: var(--gray);
  font-size: 10px;
  opacity: 0.6;
}

/* ===== 11. 侧边栏导航优化 ===== */
.sidebar-card {
  transition: all 0.3s ease;
  animation: slideInLeft 0.5s ease;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar-body {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}

.sidebar-body::-webkit-scrollbar {
  width: 6px;
}

.sidebar-body::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(10, 74, 122, 0.2);
  border-radius: 3px;
}

.sidebar-body::-webkit-scrollbar-thumb:hover {
  background: rgba(10, 74, 122, 0.4);
}

/* 侧边栏菜单项优化 */
.match-category-item {
  position: relative;
  overflow: hidden;
}

.match-category-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.match-category-item:hover::before,
.match-category-item.active::before {
  transform: scaleY(1);
}

/* ===== 12. 图片懒加载占位符 ===== */
img {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

img[src] {
  background: transparent;
  animation: none;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===== 13. 数字和统计优化 ===== */
.stat-number {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== 14. 工具提示优化 ===== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  padding: 8px 12px;
  background: var(--dark);
  color: white;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

/* ===== 15. 滚动到顶部按钮 ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(10, 74, 122, 0.3);
  transition: all 0.3s ease;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(10, 74, 122, 0.4);
}

.back-to-top i {
  font-size: 20px;
}

/* ===== 16. 搜索框优化 ===== */
.search-box {
  position: relative;
}

.search-box input {
  padding-left: 45px;
  transition: all 0.3s ease;
}

.search-box .search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  transition: all 0.3s ease;
}

.search-box input:focus ~ .search-icon {
  color: var(--primary);
}

/* ===== 17. 分页优化 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: var(--card-bg);
  border: 2px solid rgba(10, 74, 122, 0.1);
  border-radius: 8px;
  color: var(--dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.pagination a:hover {
  background: rgba(26, 109, 179, 0.1);
  border-color: var(--secondary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pagination .active span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(10, 74, 122, 0.3);
}

/* ===== 18. 响应式优化 ===== */
@media (max-width: 768px) {
  .page-breadcrumb {
    padding: 12px 15px;
    font-size: 13px;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }

  .table-responsive table {
    font-size: 13px;
  }

  .table-responsive table thead th {
    padding: 12px 8px;
    font-size: 12px;
  }

  .table-responsive table tbody td {
    padding: 10px 8px;
  }

  .content-card {
    border-radius: 12px;
  }

  .content-card:hover {
    transform: none;
  }
}

/* ===== 19. 打印样式优化 ===== */
@media print {
  .back-to-top,
  .page-breadcrumb,
  .user-sidebar {
    display: none;
  }

  .content-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ===== 20. 可访问性优化 ===== */
/* 焦点可见样式 */
*:focus-visible {
  outline: 3px solid rgba(26, 109, 179, 0.5);
  outline-offset: 2px;
}

/* 跳过导航链接 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
