/* ============================================================
   PAY66 Design System v1.0 — Components
   支付系统组件层

   依赖：pay66-core.css（CSS变量已在其中定义）
   所有组件均使用 pay66-core.css 中定义的变量。
   ============================================================ */


/* --------------------------------------------------------
   0. 响应式统计网格 (Stats Grid)
   PC端横排4列，平板2列，手机1列
   -------------------------------------------------------- */

.ds-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--p66-space-5);
  margin-bottom: var(--p66-space-6);
}

@media (max-width: 1024px) {
  .ds-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--p66-space-3);
  }
}

@media (max-width: 640px) {
  .ds-stats-grid {
    grid-template-columns: 1fr;
  }
}


/* --------------------------------------------------------
   1. 顶部导航栏 (Top Navbar)
   -------------------------------------------------------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--p66-border-light);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--p66-text-lg);
  font-weight: var(--p66-font-bold);
  color: var(--p66-navy);
  letter-spacing: -0.01em;
}

.navbar-brand img {
  height: 32px;
  width: auto;
}

.navbar-brand span {
  color: var(--p66-gold);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: var(--p66-space-3xl);
}

.navbar-link {
  font-size: var(--p66-text-sm);
  font-weight: var(--p66-font-medium);
  color: var(--p66-text-muted);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all var(--p66-transition-fast);
}

.navbar-link:hover {
  color: var(--p66-text);
}

.navbar-link.active {
  color: var(--p66-navy);
  border-bottom-color: var(--p66-gold);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--p66-space-md);
}

/* 移动端汉堡菜单按钮 */
.navbar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--p66-border-light);
  border-radius: var(--p66-radius-md);
  cursor: pointer;
  color: var(--p66-text);
  transition: border-color var(--p66-transition-fast);
}

.navbar-toggle:hover {
  border-color: var(--p66-border);
}

.navbar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
  transition: background var(--p66-transition-fast);
}

.navbar-toggle span::before,
.navbar-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform var(--p66-transition-normal);
}

.navbar-toggle span::before {
  top: -6px;
}

.navbar-toggle span::after {
  top: 6px;
}

@media (max-width: 768px) {
  .navbar-toggle {
    display: flex;
  }

  .navbar-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--p66-bg-surface);
    border-bottom: 1px solid var(--p66-border-light);
    padding: var(--p66-space-md) var(--p66-space-lg) var(--p66-space-xl);
    gap: var(--p66-space-xs);
    box-shadow: var(--p66-shadow-md);
  }

  .navbar-links.open {
    display: flex;
  }

  .navbar-link {
    padding: 10px 0;
    border-bottom: none;
  }
}


/* --------------------------------------------------------
   2. 侧边栏 (Sidebar)
   -------------------------------------------------------- */

.sidebar-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--p66-bg-surface);
  border-right: 1px solid var(--p66-border-light);
  padding: var(--p66-space-xl) var(--p66-space-md);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: var(--p66-space-xl);
}

.sidebar-section-title {
  font-size: var(--p66-text-xs);
  font-weight: var(--p66-font-semibold);
  color: var(--p66-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 var(--p66-space-md);
  margin-bottom: var(--p66-space-sm);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--p66-space-sm);
  padding: 9px var(--p66-space-md);
  font-size: var(--p66-text-sm);
  font-weight: var(--p66-font-medium);
  color: var(--p66-text-secondary);
  border-radius: var(--p66-radius-md);
  transition: all var(--p66-transition-fast);
  cursor: pointer;
}

.sidebar-link:hover {
  background: var(--p66-bg-hover);
  color: var(--p66-text);
}

.sidebar-link.active {
  background: var(--p66-gold-bg);
  color: var(--p66-gold-deep);
}

.sidebar-link .badge {
  margin-left: auto;
}

.sidebar-content {
  flex: 1;
  padding: var(--p66-space-3xl);
  min-width: 0;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: block;
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    z-index: 90;
    box-shadow: var(--p66-shadow-lg);
  }

  .sidebar-content {
    padding: var(--p66-space-xl) var(--p66-space-lg);
  }
}


/* --------------------------------------------------------
   3. 面包屑 (Breadcrumb)
   -------------------------------------------------------- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--p66-space-sm);
  font-size: var(--p66-text-sm);
  color: var(--p66-text-muted);
  margin-bottom: var(--p66-space-2xl);
}

.breadcrumb a {
  color: var(--p66-text-muted);
  transition: color var(--p66-transition-fast);
}

.breadcrumb a:hover {
  color: var(--p66-text);
}

.breadcrumb .separator {
  color: var(--p66-text-disabled);
  user-select: none;
}

.breadcrumb .current {
  color: var(--p66-text);
  font-weight: var(--p66-font-medium);
}


/* --------------------------------------------------------
   4. 分页 (Pagination)
   -------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--p66-space-xs);
  margin-top: var(--p66-space-2xl);
}

.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--p66-space-sm);
  font-size: var(--p66-text-sm);
  font-weight: var(--p66-font-medium);
  color: var(--p66-text-secondary);
  background: var(--p66-bg-surface);
  border: 1px solid var(--p66-border-light);
  border-radius: var(--p66-radius-md);
  cursor: pointer;
  transition: all var(--p66-transition-fast);
}

.pagination-item:hover {
  border-color: var(--p66-border);
  color: var(--p66-text);
}

.pagination-item.active {
  background: var(--p66-navy);
  border-color: var(--p66-navy);
  color: #fff;
}

.pagination-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.pagination-info {
  font-size: var(--p66-text-sm);
  color: var(--p66-text-muted);
  margin-left: var(--p66-space-lg);
}


/* --------------------------------------------------------
   5. 模态框 (Modal)
   -------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--p66-space-xl);
  animation: modalFadeIn 150ms ease;
}

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

.modal {
  background: var(--p66-bg-surface);
  border-radius: var(--p66-radius-lg);
  box-shadow: var(--p66-shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 200ms ease;
}

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

.modal-sm {
  max-width: 400px;
}

.modal-lg {
  max-width: 720px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--p66-space-xl) var(--p66-space-2xl);
  border-bottom: 1px solid var(--p66-border-light);
}

.modal-title {
  font-size: var(--p66-text-lg);
  font-weight: var(--p66-font-semibold);
  color: var(--p66-navy);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--p66-radius-sm);
  color: var(--p66-text-muted);
  cursor: pointer;
  font-size: 18px;
  transition: all var(--p66-transition-fast);
}

.modal-close:hover {
  background: var(--p66-bg-hover);
  color: var(--p66-text);
}

.modal-body {
  padding: var(--p66-space-2xl);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--p66-space-md);
  padding: var(--p66-space-lg) var(--p66-space-2xl);
  border-top: 1px solid var(--p66-border-light);
}


/* --------------------------------------------------------
   6. 标签页 (Tabs)
   -------------------------------------------------------- */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--p66-border-light);
  margin-bottom: var(--p66-space-2xl);
}

.tab {
  padding: 10px var(--p66-space-lg);
  font-size: var(--p66-text-sm);
  font-weight: var(--p66-font-medium);
  color: var(--p66-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--p66-transition-fast);
}

.tab:hover {
  color: var(--p66-text);
}

.tab.active {
  color: var(--p66-navy);
  border-bottom-color: var(--p66-gold);
  font-weight: var(--p66-font-semibold);
}

/* 胶囊式标签页 */
.tabs-pill {
  display: flex;
  gap: var(--p66-space-xs);
  padding: 3px;
  background: var(--p66-bg);
  border-radius: var(--p66-radius-md);
  border-bottom: none;
  margin-bottom: var(--p66-space-2xl);
}

.tabs-pill .tab {
  padding: 7px 16px;
  border-radius: var(--p66-radius-sm);
  border-bottom: none;
  margin-bottom: 0;
}

.tabs-pill .tab.active {
  background: var(--p66-bg-surface);
  box-shadow: var(--p66-shadow-sm);
  color: var(--p66-navy);
}


/* --------------------------------------------------------
   7. 下拉菜单 (Dropdown)
   -------------------------------------------------------- */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--p66-bg-surface);
  border: 1px solid var(--p66-border);
  border-radius: var(--p66-radius-md);
  box-shadow: var(--p66-shadow-md);
  padding: var(--p66-space-xs);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all var(--p66-transition-fast);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--p66-space-sm);
  padding: 8px var(--p66-space-md);
  font-size: var(--p66-text-sm);
  color: var(--p66-text-secondary);
  border-radius: var(--p66-radius-sm);
  cursor: pointer;
  transition: all var(--p66-transition-fast);
}

.dropdown-item:hover {
  background: var(--p66-bg-hover);
  color: var(--p66-text);
}

.dropdown-item.danger {
  color: var(--p66-red);
}

.dropdown-item.danger:hover {
  background: var(--p66-red-bg);
}

.dropdown-divider {
  height: 1px;
  background: var(--p66-border-light);
  margin: var(--p66-space-xs) 0;
}


/* --------------------------------------------------------
   8. 工具提示 (Tooltip)
   -------------------------------------------------------- */

.tooltip {
  position: relative;
  display: inline-flex;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  font-size: var(--p66-text-xs);
  font-weight: var(--p66-font-medium);
  color: #fff;
  background: var(--p66-navy);
  border-radius: var(--p66-radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--p66-transition-fast);
  z-index: 300;
}

.tooltip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--p66-navy);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--p66-transition-fast);
}

.tooltip:hover::after,
.tooltip:hover::before {
  opacity: 1;
}


/* --------------------------------------------------------
   9. 统计卡片 (Stat Card)
   -------------------------------------------------------- */

.stat-card {
  background: var(--p66-bg-surface);
  border: 1px solid var(--p66-border-light);
  border-radius: var(--p66-radius-lg);
  padding: var(--p66-space-xl);
  transition: border-color var(--p66-transition-normal),
              box-shadow var(--p66-transition-normal);
}

.stat-card:hover {
  border-color: var(--p66-border);
  box-shadow: var(--p66-shadow-sm);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--p66-space-md);
}

.stat-card-label {
  font-size: var(--p66-text-sm);
  color: var(--p66-text-muted);
  font-weight: var(--p66-font-medium);
}

.stat-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--p66-radius-md);
  font-size: 18px;
}

.stat-card-icon.icon-green {
  background: var(--p66-green-bg);
  color: var(--p66-green);
}

.stat-card-icon.icon-gold {
  background: var(--p66-gold-bg);
  color: var(--p66-gold);
}

.stat-card-icon.icon-blue {
  background: var(--p66-blue-bg);
  color: var(--p66-blue);
}

.stat-card-icon.icon-red {
  background: var(--p66-red-bg);
  color: var(--p66-red);
}

.stat-card-value {
  font-size: var(--p66-text-3xl);
  font-weight: var(--p66-font-bold);
  color: var(--p66-navy);
  line-height: 1;
  margin-bottom: var(--p66-space-xs);
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--p66-text-xs);
  font-weight: var(--p66-font-medium);
}

.stat-card-change.up {
  color: var(--p66-green);
}

.stat-card-change.down {
  color: var(--p66-red);
}


/* --------------------------------------------------------
   10. 时间线 (Timeline)
   -------------------------------------------------------- */

.timeline {
  position: relative;
  padding-left: var(--p66-space-2xl);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--p66-border-light);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--p66-space-xl);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--p66-space-2xl) + 4px);
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--p66-border);
  border: 2px solid var(--p66-bg-surface);
}

.timeline-dot.active {
  background: var(--p66-gold);
  box-shadow: 0 0 0 3px var(--p66-gold-bg);
}

.timeline-dot.success {
  background: var(--p66-green);
  box-shadow: 0 0 0 3px var(--p66-green-bg);
}

.timeline-content {
  font-size: var(--p66-text-sm);
}

.timeline-content .time {
  font-size: var(--p66-text-xs);
  color: var(--p66-text-muted);
  margin-bottom: 2px;
}

.timeline-content .desc {
  color: var(--p66-text-secondary);
}


/* --------------------------------------------------------
   11. 步骤条 (Steps)
   -------------------------------------------------------- */

.steps {
  display: flex;
  align-items: flex-start;
  margin-bottom: var(--p66-space-3xl);
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--p66-space-sm);
  position: relative;
}

.step::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--p66-border-light);
  margin: 0 var(--p66-space-md);
}

.step:last-child::after {
  display: none;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: var(--p66-text-xs);
  font-weight: var(--p66-font-semibold);
  color: var(--p66-text-muted);
  background: var(--p66-bg);
  border: 2px solid var(--p66-border-light);
  flex-shrink: 0;
  transition: all var(--p66-transition-fast);
}

.step.active .step-number {
  background: var(--p66-gold);
  border-color: var(--p66-gold);
  color: #fff;
}

.step.done .step-number {
  background: var(--p66-green);
  border-color: var(--p66-green);
  color: #fff;
}

.step.done::after {
  background: var(--p66-green);
}

.step-label {
  font-size: var(--p66-text-sm);
  color: var(--p66-text-muted);
  white-space: nowrap;
}

.step.active .step-label {
  color: var(--p66-navy);
  font-weight: var(--p66-font-semibold);
}

.step.done .step-label {
  color: var(--p66-text-secondary);
}


/* --------------------------------------------------------
   12. 空状态 (Empty State)
   -------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--p66-space-6xl) var(--p66-space-xl);
  text-align: center;
}

.empty-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--p66-bg);
  margin-bottom: var(--p66-space-xl);
  color: var(--p66-text-disabled);
  font-size: 28px;
}

.empty-state-title {
  font-size: var(--p66-text-lg);
  font-weight: var(--p66-font-semibold);
  color: var(--p66-text);
  margin-bottom: var(--p66-space-sm);
}

.empty-state-desc {
  font-size: var(--p66-text-sm);
  color: var(--p66-text-muted);
  max-width: 320px;
  margin-bottom: var(--p66-space-xl);
  line-height: var(--p66-leading-normal);
}


/* --------------------------------------------------------
   13. 加载状态 (Loading State)
   -------------------------------------------------------- */

/* 骨架屏 */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--p66-bg) 25%,
    var(--p66-bg-hover) 50%,
    var(--p66-bg) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease infinite;
  border-radius: var(--p66-radius-sm);
}

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

.skeleton-text {
  height: 14px;
  margin-bottom: var(--p66-space-sm);
  width: 100%;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 20px;
  width: 40%;
  margin-bottom: var(--p66-space-md);
}

.skeleton-card {
  height: 120px;
}

/* 旋转加载指示器 */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--p66-border);
  border-top-color: var(--p66-gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* 页面级加载 */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: var(--p66-space-lg);
  color: var(--p66-text-muted);
  font-size: var(--p66-text-sm);
}


/* --------------------------------------------------------
   14. 数据列表项 (List Item)
   -------------------------------------------------------- */

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--p66-space-md) var(--p66-space-lg);
  border-bottom: 1px solid var(--p66-border-light);
  transition: background var(--p66-transition-fast);
}

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

.list-item:hover {
  background: var(--p66-bg-hover);
}

.list-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-item-title {
  font-size: var(--p66-text-sm);
  font-weight: var(--p66-font-medium);
  color: var(--p66-text);
}

.list-item-desc {
  font-size: var(--p66-text-xs);
  color: var(--p66-text-muted);
}

.list-item-meta {
  font-size: var(--p66-text-sm);
  color: var(--p66-text-muted);
  text-align: right;
}


/* --------------------------------------------------------
   15. 进度条 (Progress Bar)
   -------------------------------------------------------- */

.progress {
  width: 100%;
  height: 6px;
  background: var(--p66-bg);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--p66-gold);
  transition: width var(--p66-transition-slow);
}

.progress-bar.success {
  background: var(--p66-green);
}

.progress-bar.warning {
  background: var(--p66-orange);
}

.progress-bar.danger {
  background: var(--p66-red);
}

.progress-bar.info {
  background: var(--p66-blue);
}


/* --------------------------------------------------------
   16. 搜索栏 (Search Bar)
   -------------------------------------------------------- */

.search-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-bar .form-input {
  padding-left: 36px;
}

.search-bar-icon {
  position: absolute;
  left: 12px;
  color: var(--p66-text-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-bar .form-input:focus ~ .search-bar-icon {
  color: var(--p66-gold);
}


/* --------------------------------------------------------
   17. 页面头部 (Page Header)
   -------------------------------------------------------- */

.page-header {
  margin-bottom: var(--p66-space-3xl);
}

.page-title {
  font-size: var(--p66-text-2xl);
  font-weight: var(--p66-font-bold);
  color: var(--p66-navy);
  letter-spacing: -0.01em;
  margin-bottom: var(--p66-space-xs);
}

.page-subtitle {
  font-size: var(--p66-text-sm);
  color: var(--p66-text-muted);
}


/* --------------------------------------------------------
   18. 响应式调整
   -------------------------------------------------------- */

@media (max-width: 768px) {
  .modal {
    max-width: 100%;
    margin: var(--p66-space-lg);
    max-height: calc(100vh - 40px);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: var(--p66-space-lg);
    padding-right: var(--p66-space-lg);
  }

  .steps {
    flex-direction: column;
    gap: var(--p66-space-lg);
  }

  .step::after {
    display: none;
  }

  .stat-card {
    padding: var(--p66-space-lg);
  }

  .stat-card-value {
    font-size: var(--p66-text-2xl);
  }
}
