/**
 * 全站动画按钮 — 改编自 Uiverse.io by gharsh11032000
 * 尺寸：sm（分页/工具栏）· md（默认）· lg（主操作）
 */

.animated-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  min-height: var(--btn-h-md);
  padding: 0 calc(var(--btn-px-md) + 10px);
  border: var(--btn-border-md) solid transparent !important;
  font-size: var(--btn-font-md);
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  background-color: var(--btn-anim-bg) !important;
  border-radius: 100px !important;
  color: var(--btn-anim-color) !important;
  box-shadow: 0 0 0 var(--btn-border-md) var(--btn-anim-ring) !important;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  white-space: nowrap;
  transition: color 0.6s var(--btn-anim-ease), box-shadow 0.6s var(--btn-anim-ease),
    border-radius 0.6s var(--btn-anim-ease), transform 0.15s ease !important;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.animated-button svg {
  position: absolute;
  top: 50%;
  width: var(--btn-icon-md);
  height: var(--btn-icon-md);
  margin-top: calc(var(--btn-icon-md) / -2);
  fill: var(--btn-anim-color);
  z-index: 2;
  transition: all 0.8s var(--btn-anim-ease);
  pointer-events: none;
}

.animated-button .arr-1 {
  right: 10px;
}

.animated-button .arr-2 {
  left: -25%;
}

.animated-button .circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background-color: var(--btn-anim-fill);
  border-radius: 50%;
  opacity: 0;
  transition: all 0.8s var(--btn-anim-ease);
  z-index: 0;
  pointer-events: none;
}

.animated-button .text,
.animated-button .btn-anim-text {
  position: relative;
  z-index: 1;
  transform: translateX(-8px);
  transition: transform 0.8s var(--btn-anim-ease);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.animated-button:hover:not(:disabled) {
  box-shadow: 0 0 0 calc(var(--btn-border-md) * 6) transparent !important;
  color: var(--btn-anim-hover-text) !important;
  border-radius: 10px !important;
}

.animated-button:hover:not(:disabled) .arr-1 {
  right: -25%;
}

.animated-button:hover:not(:disabled) .arr-2 {
  left: 10px;
}

.animated-button:hover:not(:disabled) .text,
.animated-button:hover:not(:disabled) .btn-anim-text {
  transform: translateX(8px);
}

.animated-button:hover:not(:disabled) svg {
  fill: var(--btn-anim-hover-text);
}

.animated-button:active:not(:disabled) {
  transform: scale(0.96);
  box-shadow: 0 0 0 var(--btn-border-md) var(--btn-anim-ring) !important;
}

.animated-button:hover:not(:disabled) .circle {
  width: 160px;
  height: 160px;
  opacity: 1;
}

.animated-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* sm：分页、筛选、后台表格 */
.animated-button--compact,
.animated-button--sm {
  min-height: var(--btn-h-sm);
  padding: 0 calc(var(--btn-px-sm) + 8px) !important;
  font-size: var(--btn-font-sm) !important;
  border-width: var(--btn-border-sm) !important;
  box-shadow: 0 0 0 var(--btn-border-sm) var(--btn-anim-ring) !important;
}

.animated-button--compact svg,
.animated-button--sm svg {
  width: var(--btn-icon-sm);
  height: var(--btn-icon-sm);
  margin-top: calc(var(--btn-icon-sm) / -2);
}

.animated-button--compact .arr-1,
.animated-button--sm .arr-1 {
  right: 7px;
}

.animated-button--compact:hover:not(:disabled) .arr-2,
.animated-button--sm:hover:not(:disabled) .arr-2 {
  left: 7px;
}

.animated-button--compact .text,
.animated-button--compact .btn-anim-text,
.animated-button--sm .text,
.animated-button--sm .btn-anim-text {
  transform: translateX(-6px);
}

.animated-button--compact:hover:not(:disabled) .text,
.animated-button--compact:hover:not(:disabled) .btn-anim-text,
.animated-button--sm:hover:not(:disabled) .text,
.animated-button--sm:hover:not(:disabled) .btn-anim-text {
  transform: translateX(6px);
}

.animated-button--compact:hover:not(:disabled) .circle,
.animated-button--sm:hover:not(:disabled) .circle {
  width: 110px;
  height: 110px;
}

/* lg：首页搜索等主操作 */
.animated-button--lg {
  min-height: var(--btn-h-lg);
  padding: 0 calc(var(--btn-px-lg) + 12px) !important;
  font-size: var(--btn-font-lg) !important;
  border-width: var(--btn-border-lg) !important;
  box-shadow: 0 0 0 var(--btn-border-lg) var(--btn-anim-ring) !important;
}

.animated-button--lg svg {
  width: var(--btn-icon-lg);
  height: var(--btn-icon-lg);
  margin-top: calc(var(--btn-icon-lg) / -2);
}

.animated-button--lg .arr-1 {
  right: 12px;
}

.animated-button--lg:hover:not(:disabled) .arr-2 {
  left: 12px;
}

.animated-button--lg:hover:not(:disabled) .circle {
  width: 180px;
  height: 180px;
}

/* 场景自动尺寸 */
.pagination .animated-button,
.mini-pagination .animated-button,
.filter-actions .animated-button,
.section-head-row .animated-button,
.advice-form-actions .animated-button,
.evaluation-actions .animated-button,
.transit-hero-search .animated-button {
  min-height: var(--btn-h-sm);
  padding: 0 calc(var(--btn-px-sm) + 8px) !important;
  font-size: var(--btn-font-sm) !important;
  border-width: var(--btn-border-sm) !important;
  box-shadow: 0 0 0 var(--btn-border-sm) var(--btn-anim-ring) !important;
}

.pagination .animated-button svg,
.mini-pagination .animated-button svg,
.filter-actions .animated-button svg,
.section-head-row .animated-button svg,
.advice-form-actions .animated-button svg,
.evaluation-actions .animated-button svg,
.transit-hero-search .animated-button svg {
  width: var(--btn-icon-sm);
  height: var(--btn-icon-sm);
  margin-top: calc(var(--btn-icon-sm) / -2);
}

.search-row .animated-button {
  min-height: var(--btn-h-lg);
  padding: 0 calc(var(--btn-px-lg) + 12px) !important;
  font-size: var(--btn-font-lg) !important;
}

.search-box .animated-button,
.search-container .animated-button,
.filter-actions .animated-button,
.card-footer .animated-button {
  background-color: var(--btn-anim-bg) !important;
  color: var(--btn-anim-color) !important;
}

.search-box .animated-button:hover:not(:disabled),
.search-container .animated-button:hover:not(:disabled),
.filter-actions .animated-button:hover:not(:disabled),
.btn-search.animated-button:hover:not(:disabled),
.pagination .animated-button:hover:not(:disabled) {
  background-color: transparent !important;
}

.pagination .animated-button.active {
  color: var(--btn-anim-hover-text) !important;
}

.pagination .animated-button.active .circle {
  width: 100px;
  height: 100px;
  opacity: 1;
}

/* 按钮组间距 */
.filter-actions,
.pagination,
.mini-pagination,
.evaluation-actions,
.advice-form-actions,
.section-head-row,
.transit-hero-search,
.transit-map-toolbar,
.import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--btn-gap);
}

.filter-actions .animated-button {
  flex: 1 1 calc(50% - var(--btn-gap) / 2);
  max-width: 160px;
}

/* JS 未执行时的兜底（无 SVG） */
button:not(.animated-button):not(.theme-toggle):not(.team-intro-btn):not(.feedback-nav-btn):not(.transit-sheet-close):not(.mobile-filter-btn):not(.no-btn-anim):not(.campus-tab),
a.btn-transit-lines:not(.animated-button) {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-h-md);
  padding: 0 var(--btn-px-md);
  border: var(--btn-border-md) solid transparent;
  border-radius: 100px;
  font-size: var(--btn-font-md);
  font-weight: 600;
  color: var(--btn-anim-color);
  box-shadow: 0 0 0 var(--btn-border-md) var(--btn-anim-ring);
  background: var(--btn-anim-bg);
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
}

/* 校区切换按钮 */
.campus-tabs .campus-tab.is-active,
.campus-tabs .campus-tab.active {
  background: var(--color-primary) !important;
  color: var(--text-on-primary) !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22) !important;
}

.campus-tabs .campus-tab:not(.is-active):not(.active) {
  background: transparent !important;
  color: var(--text-secondary) !important;
  box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .animated-button,
  .animated-button svg,
  .animated-button .circle,
  .animated-button .text {
    transition-duration: 0.01ms !important;
  }
}
