/* 全局主题：让页面看起来更像“后台管理系统”而不是demo */
:root {
  --app-bg: #f4f6fb;
  --app-surface: #ffffff;
  --app-border: rgba(15, 23, 42, 0.08);
  --app-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
  --bs-primary: #335f8f;
  --bs-primary-rgb: 51, 95, 143;
  --bs-btn-hover-bg: #2b527d;
  --bs-btn-hover-border-color: #2b527d;
}

body {
  background:
    radial-gradient(900px circle at 10% 0%, #eef2ff 0%, transparent 45%),
    radial-gradient(900px circle at 100% 20%, #ecfeff 0%, transparent 45%),
    var(--app-bg);
  color: #0f172a;
}

.container {
  max-width: 1200px;
}

.card {
  border: 1px solid var(--app-border);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.04);
}

.page-heading {
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* 面包屑与下方主标题之间留白（略放大，避免挤在一起） */
.app-breadcrumb-nav {
  margin-bottom: 1rem;
}

.muted-box {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 14px;
}

.btn-primary,
.btn-success,
.btn-outline-primary,
.btn-outline-secondary {
  border-radius: 10px;
}

.btn-primary {
  --bs-btn-bg: #335f8f;
  --bs-btn-border-color: #335f8f;
  --bs-btn-hover-bg: #2c537d;
  --bs-btn-hover-border-color: #2c537d;
  --bs-btn-active-bg: #274a70;
  --bs-btn-active-border-color: #274a70;
}

.btn-success {
  --bs-btn-bg: #2f6b57;
  --bs-btn-border-color: #2f6b57;
  --bs-btn-hover-bg: #295d4c;
  --bs-btn-hover-border-color: #295d4c;
  --bs-btn-active-bg: #244f40;
  --bs-btn-active-border-color: #244f40;
}

.btn-outline-primary {
  --bs-btn-color: #335f8f;
  --bs-btn-border-color: #335f8f;
  --bs-btn-hover-bg: #335f8f;
  --bs-btn-hover-border-color: #335f8f;
}

.btn-outline-secondary {
  --bs-btn-color: #556579;
  --bs-btn-border-color: #8a97a8;
  --bs-btn-hover-bg: #556579;
  --bs-btn-hover-border-color: #556579;
}

.publish-app-btn {
  font-weight: 800;
  min-width: 118px;
  height: 40px;
  justify-content: center;
  border: 1px solid #264b72;
  color: #fff !important;
  background: linear-gradient(135deg, #3b6a9d, #2a4f76);
  box-shadow: 0 8px 18px rgba(29, 58, 88, 0.28);
}

.publish-app-btn:hover {
  border-color: #1f4062;
  background: linear-gradient(135deg, #3b6a9d, #1f4062);
  box-shadow: 0 10px 20px rgba(29, 58, 88, 0.34);
}

.navbar .nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.app-navbar {
  background: linear-gradient(90deg, #284d74, #315b88);
}

.app-user-dropdown {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.14);
  padding: 6px;
}

.app-user-dropdown .dropdown-item {
  border-radius: 8px;
  font-size: 14px;
  padding: 6px 10px;
}

.app-user-dropdown .dropdown-item:hover {
  background: rgba(51, 95, 143, 0.1);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: #fff;
}

.navbar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.app-breadcrumb {
  padding: 10px 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.5;
}

.app-breadcrumb .breadcrumb-item {
  font-size: inherit;
  color: #64748b;
}

.app-breadcrumb .breadcrumb-item.active {
  color: #0f172a;
  font-weight: 600;
}

/* 列表卡片：统一高度和间距 */
.app-card {
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow);
}

.app-card .app-card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 0.5rem;
  row-gap: 0.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  min-width: 0;
}

.app-card .app-card-title > a {
  line-height: 1.35;
  display: inline-flex;
  align-items: center;
}

/* 「已下架」等状态徽标：文字在色块内水平垂直居中，并与同行 flex 项对齐 */
.badge.app-shelf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1;
  padding: 0.35rem 0.65rem;
  font-weight: 600;
  flex-shrink: 0;
  align-self: center;
  text-align: center;
  white-space: nowrap;
}

.app-card .app-card-title .app-shelf-badge {
  font-size: 0.75rem;
}

/* 应用详情：元信息一行（徽标与点赞/时间）垂直居中对齐 */
.app-detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.35rem;
}

.app-detail-meta-row .app-shelf-badge {
  font-size: inherit;
}

.app-detail-meta-row > span:not(.badge) {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  line-height: 1.35;
}

.app-badge {
  border: 1px solid var(--app-border);
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 10px;
  border-radius: 999px;
}

/* 列表卡片：应用介绍预览，单行，超出省略（换行已压成空格） */
.app-card-desc {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #64748b;
  min-height: 1.45em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.app-card-desc-empty {
  color: #94a3b8;
  font-style: italic;
}

/* 表格更紧凑一些 */
.table th {
  font-weight: 600;
}

/* 搜索框视觉优化 */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 320px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
  transition: all 140ms ease;
}

.search-wrap i {
  color: #64748b;
}

.search-wrap:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

.search-wrap .form-control {
  border: 0;
  box-shadow: none !important;
  background: transparent;
  height: 100%;
  padding: 0 2px;
  line-height: 1.2;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.table-toolbar .search-wrap {
  min-width: 260px;
}

.toolbar-select {
  min-width: 130px;
  height: 38px;
  border-radius: 10px;
}

.table-toolbar .btn {
  height: 38px;
  padding-top: 0;
  padding-bottom: 0;
  display: inline-flex;
  align-items: center;
}

/* 所有应用页：筛选项桌面端保持一行，更整洁 */
.index-filter-row {
  flex-wrap: nowrap;
  gap: 8px;
}

.index-filter-row .search-wrap {
  min-width: 0;
  width: 100%;
}

.index-filter-row .search-wrap:first-of-type {
  flex: 1.5;
}

.index-filter-row .search-wrap:nth-of-type(2) {
  flex: 1.1;
}

.name-picker {
  position: relative;
  flex: 1.1;
  min-width: 0;
}

.name-picker .name-picker-input-wrap {
  min-width: 0;
  width: 100%;
}

.name-picker-toggle {
  color: #64748b !important;
  text-decoration: none;
  width: 20px;
  flex: 0 0 20px;
}

.name-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  z-index: 50;
  padding: 6px;
}

.name-picker-option {
  width: 100%;
  height: 34px;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 0 10px;
  color: #0f172a;
  font-size: 14px;
}

.name-picker-option:hover {
  background: rgba(51, 95, 143, 0.1);
}

.name-picker-menu.is-empty::before {
  content: "没有匹配姓名";
  display: block;
  color: #64748b;
  font-size: 13px;
  padding: 8px 10px;
}

.index-filter-row .toolbar-select {
  flex: 0 0 150px;
  min-width: 150px;
}

.index-filter-row .btn {
  flex: 0 0 auto;
}

@media (max-width: 992px) {
  .index-filter-row {
    flex-wrap: wrap;
  }
}

/* 账号管理/审计日志：简洁单行筛选布局 */
.compact-filter-row {
  flex-wrap: nowrap;
  gap: 8px;
}

.compact-filter-row .search-wrap {
  min-width: 0;
  flex: 1.6;
}

.compact-filter-row .toolbar-select {
  flex: 0 0 150px;
  min-width: 150px;
}

.compact-filter-row .btn {
  flex: 0 0 auto;
}

@media (max-width: 992px) {
  .compact-filter-row {
    flex-wrap: wrap;
  }
}

.pager-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pager-row .pagination .page-link {
  height: 38px;
  min-width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.pager-row .pagination .page-item.active .page-link {
  background-color: #556579;
  border-color: #556579;
  color: #fff;
}

.pager-row .form-control {
  height: 38px;
}

.pager-row .btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

.empty-state {
  border: 1px dashed rgba(15, 23, 42, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  padding: 28px 20px;
  text-align: center;
}

.empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  background: rgba(148, 163, 184, 0.18);
  font-size: 22px;
}

.empty-title {
  font-weight: 700;
  color: #0f172a;
}

.empty-desc {
  margin-top: 6px;
  color: #64748b;
  font-size: 14px;
}

.app-toast-container {
  z-index: 1080;
  top: auto !important;
  bottom: 0 !important;
  pointer-events: none;
}

.app-toast {
  min-width: 280px;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2);
  pointer-events: auto;
}

#globalConfirmModal .modal-content {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
}

.btn-danger-action,
.btn-warning-action,
.btn-success-action {
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-danger-action {
  color: #8f2f2f;
  border: 1px solid rgba(143, 47, 47, 0.34);
  background: rgba(250, 242, 242, 0.9);
}

.btn-danger-action:hover {
  color: #fff;
  border-color: #8f2f2f;
  background: #8f2f2f;
}

.btn-warning-action {
  color: #7a5a1f;
  border: 1px solid rgba(122, 90, 31, 0.34);
  background: rgba(252, 249, 242, 0.92);
}

.btn-warning-action:hover {
  color: #fff;
  border-color: #7a5a1f;
  background: #7a5a1f;
}

.btn-success-action {
  color: #2d5f4d;
  border: 1px solid rgba(45, 95, 77, 0.34);
  background: rgba(242, 249, 246, 0.92);
}

.btn-success-action:hover {
  color: #fff;
  border-color: #2d5f4d;
  background: #2d5f4d;
}

/* 登录页背景与卡片质感 */
.login-page {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f0f4ff 0%, #ecfeff 45%, #f8fafc 100%);
}

.login-bg-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.8;
  pointer-events: none;
}

.login-bg-shape-1 {
  width: 420px;
  height: 420px;
  left: -120px;
  top: -80px;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.35),
    rgba(59, 130, 246, 0)
  );
  animation: floatBlue 9s ease-in-out infinite;
}

.login-bg-shape-2 {
  width: 460px;
  height: 460px;
  right: -140px;
  bottom: -150px;
  background: radial-gradient(
    circle,
    rgba(16, 185, 129, 0.3),
    rgba(16, 185, 129, 0)
  );
  animation: floatGreen 11s ease-in-out infinite;
}

.login-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
  animation: gridBreath 8s ease-in-out infinite;
}

.login-page .container {
  position: relative;
  z-index: 2;
}

.login-card {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  animation: cardIn 560ms cubic-bezier(0.16, 1, 0.3, 1) 1;
}

.login-header {
  animation: headerIn 520ms ease-out 1;
}

.login-version-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #1e40af;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 999px;
}

.login-slogan {
  display: inline-block;
  font-size: 12px;
  color: #475569;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  padding: 3px 10px;
}

.login-card .form-control {
  border-radius: 10px;
  border-color: rgba(15, 23, 42, 0.16);
}

.login-card .form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.14);
}

.login-submit-btn {
  position: relative;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.24);
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease;
}

.login-submit-btn i {
  display: inline-block;
  transition: transform 120ms ease;
}

.login-submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
}

.login-submit-btn:hover i {
  transform: translateX(2px);
}

.login-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.22);
}

.login-submit-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 0.22rem rgba(59, 130, 246, 0.25),
    0 12px 24px rgba(37, 99, 235, 0.22);
}

@keyframes floatBlue {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(24px, 12px) scale(1.05);
  }
}

@keyframes floatGreen {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-20px, -16px) scale(1.06);
  }
}

@keyframes gridBreath {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.65;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .login-bg-shape-1,
  .login-bg-shape-2,
  .login-grid-overlay,
  .login-card,
  .login-header,
  .login-submit-btn,
  .login-submit-btn i {
    animation: none !important;
    transition: none !important;
  }

  .publish-app-btn {
    transition: none !important;
  }
}

/* 应用介绍等多行文本：保留换行与行首空格缩进 */
.preformatted-user-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 详情页只读「应用介绍」：高度随正文增高，无内部滚动条 */
.app-intro-readonly[readonly] {
  resize: none;
  overflow: hidden;
  min-height: calc(1.5em + 1.5rem);
  cursor: default;
  background-color: #fff !important;
  opacity: 1;
}
