@import url('site.min.css');

/* DS搜索 - 基于 diaosiso.com 参考样式，适配 Bootstrap 5 */

/* Bootstrap 5 兼容：固定顶栏 */
body {
  padding-top: 40px;
  background: #fff;
  box-sizing: border-box;
}

body.ds-sticky-footer {
  --ds-navbar-offset: 40px;
}

body.ds-sticky-footer.ip-page {
  --ds-navbar-offset: 56px;
  padding-top: 56px;
}

.navbar-fixed-top,
.ds-navbar.fixed-top {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1030;
}

.ds-navbar {
  min-height: 40px;
  height: 40px;
  padding-top: 0;
  padding-bottom: 0;
  background-color: #222 !important;
  border-color: #080808;
}

.ds-navbar .container {
  height: 40px;
}

.ds-navbar .navbar-brand {
  padding-top: 0;
  padding-bottom: 0;
  line-height: 40px;
  height: 40px;
  font-size: 18px;
}

.ds-navbar .nav-link {
  font-size: 14px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 40px;
  color: rgba(255, 255, 255, 0.75) !important;
}

.ds-navbar .nav-link:hover {
  color: #fff !important;
}

.ds-navbar .navbar-toggler {
  padding: 4px 8px;
  margin-top: 4px;
  margin-bottom: 4px;
}

.ds-navbar .navbar-right .btn {
  margin-top: 4px;
  margin-bottom: 4px;
}

/* 顶部导航操作按钮：默认无边框无背景（退出编辑模式除外） */
.ds-navbar .navbar-right .btn-nav:not(.btn-nav-edit-active) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.ds-navbar .navbar-right .btn-nav {
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1.5;
  transition: background-color 0.15s ease, color 0.15s ease;
  border: none !important;
  box-shadow: none !important;
}

/* 登录 / 注册 */
.ds-navbar .btn-nav-login {
  color: rgba(255, 255, 255, 0.85);
}

.ds-navbar .btn-nav-login:hover,
.ds-navbar .btn-nav-login:focus {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
}

/* 编辑 / 退出 / 后台：字体色为原边框色 */
.ds-navbar .btn-nav-edit {
  color: #f8f9fa;
}

.ds-navbar .btn-nav-edit:hover,
.ds-navbar .btn-nav-edit:focus {
  background-color: rgba(248, 249, 250, 0.22) !important;
  color: #fff !important;
}

.ds-navbar .btn-nav-logout {
  color: #dc3545;
}

.ds-navbar .btn-nav-logout:hover,
.ds-navbar .btn-nav-logout:focus {
  background-color: #dc3545 !important;
  color: #fff !important;
}

.ds-navbar .btn-nav-admin {
  color: #ffc107;
  text-decoration: none;
}

.ds-navbar .btn-nav-admin:hover,
.ds-navbar .btn-nav-admin:focus {
  background-color: #ffc107 !important;
  color: #fff !important;
}

/* 退出编辑模式：保持警告色背景，失焦后也不消失 */
.ds-navbar .navbar-right .btn-nav.btn-nav-edit-active,
.ds-navbar .navbar-right .btn-nav.btn-nav-edit-active:hover,
.ds-navbar .navbar-right .btn-nav.btn-nav-edit-active:focus,
.ds-navbar .navbar-right .btn-nav.btn-nav-edit-active:focus-visible,
.ds-navbar .navbar-right .btn-nav.btn-nav-edit-active:active {
  background-color: #ffc107 !important;
  color: #000 !important;
  box-shadow: none !important;
  outline: none !important;
}

/* 搜索区 jumbotron / masthead */
.jumbotron.masthead {
  margin-bottom: 0;
  border-radius: 0;
}

.search-input-row {
  margin-bottom: 20px;
}

.search-input-wrap {
  width: 45%;
  margin-left: auto;
  margin-right: auto;
}

.jumbotron.masthead #searchKeyword,
.jumbotron.masthead .form-control.input-lg {
  height: 46px;
  line-height: 46px;
  padding-top: 0;
  padding-bottom: 0;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.jumbotron.masthead #searchKeyword:focus,
.jumbotron.masthead .form-control.input-lg:focus {
  box-shadow: none;
  outline: none;
  border-color: #ccc;
}

/* 占位符灰度降低 1/4（#999 → #b3b3b3） */
.jumbotron.masthead #searchKeyword::placeholder {
  color: #b3b3b3;
  opacity: 1;
}

.jumbotron.masthead #searchKeyword::-webkit-input-placeholder {
  color: #b3b3b3;
}

.jumbotron.masthead #searchKeyword::-moz-placeholder {
  color: #b3b3b3;
  opacity: 1;
}

.search-engines-toolbar {
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 0;
}

.search-engine-group .btn-primary {
  background-color: #337ab7;
  border-color: #2e6da4;
  color: #fff;
}

.search-engine-group .btn-primary:hover,
.search-engine-group .btn-primary:focus,
.search-engine-group .btn-primary:active {
  background-color: #286090;
  border-color: #204d74;
  color: #fff;
}

.search-engine-group {
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
}

.search-engine-group .btn-engine-label {
  position: relative;
  padding-left: calc(0.75rem + 7px);
  padding-right: calc(0.75rem + 7px);
  border-right: none !important;
}

/* 文字区与图标区之间的 1px 竖线（避免 btn-group 边框合并导致不显示） */
.search-engine-group .btn-engine-label::after {
  content: '';
  position: absolute;
  right: 0;
  top: 5px;
  bottom: 5px;
  width: 1px;
  background-color: #286090;
  pointer-events: none;
}

.search-engine-group .btn-engine-exact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-left: none !important;
  margin-left: 0 !important;
}

.search-engine-group .btn-engine-exact .bi-search {
  font-size: 14px;
  line-height: 1;
}

.jumbotron.masthead .btn-group {
  margin: 0;
}

.jumbotron.masthead .btn-primary {
  background-color: #337ab7;
  border-color: #2e6da4;
}

.jumbotron.masthead .btn-primary:hover {
  background-color: #286090;
  border-color: #204d74;
}

.masthead-links {
  margin-top: 20px;
}

/* 导航分类标题（私有 / 公共共用） */
.nav-category-block {
  margin-bottom: 2rem;
}

.nav-category-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.nav-category-icon {
  color: #563d7c;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.nav-category-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: #563d7c;
  flex: 1;
}

/* 私有导航 favorites-grid */
.private-nav-section {
  margin-top: 40px;
}

.favorites-grid {
  --bs-border-radius: 0.375rem;
  --bs-secondary-bg-rgb: 245, 245, 245;
  --bs-heading-color: inherit;
  --bs-link-hover-color: #0a58ca;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}

.fav-card-wrap {
  position: relative;
}

.fav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px 16px;
  background-color: rgb(var(--bs-secondary-bg-rgb));
  border-radius: var(--bs-border-radius);
  text-decoration: none;
  color: #6c757d;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  height: 100%;
  transition: color 0.15s ease;
}

.fav-card:hover {
  color: var(--bs-link-hover-color);
  text-decoration: none;
}

.fav-card:hover .fav-card-bi {
  color: var(--bs-link-hover-color) !important;
}

.fav-card-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 4px;
}

.fav-card-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.fav-card-name {
  line-height: 1.3;
  word-break: break-all;
}

.fav-card-wrap .fav-card-actions {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  gap: 2px;
}

.fav-card-wrap .fav-drag-handle {
  display: none;
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12px;
  cursor: grab;
}

.edit-mode .fav-card-wrap .fav-card-actions,
.edit-mode .fav-card-wrap .fav-drag-handle {
  display: inline-flex;
}

.edit-mode .fav-card-wrap .fav-drag-handle {
  display: block;
}

/* 公共导航 - Bootstrap Card 样式（参考 theme.css rounded-home-item） */
.container.projects {
  margin-top: 20px;
}

.rounded-home-item {
  border-radius: 0.5rem !important;
}

.rounded-home-item-img {
  border-top-left-radius: 0.5rem !important;
  border-top-right-radius: 0.5rem !important;
  object-fit: cover;
  height: 100px;
}

.public-cards-row {
  margin-bottom: 0.5rem;
  --bs-link-hover-color: #0a58ca;
}

.public-card-wrapper.card {
  border: none;
  box-shadow: 0 0.333rem 0.667rem rgba(0, 0, 0, 0.1) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.public-card-wrapper.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.333rem 0.667rem rgba(0, 0, 0, 0.08) !important;
}

.public-card-wrapper .card-header {
  background-color: transparent;
  border-bottom: none;
}

.public-card-wrapper .card-body {
  padding: 0.75rem 1rem 1rem;
}

.public-card-wrapper .h5 {
  text-align: center;
}

.public-card-wrapper .h5 a.link-dark {
  color: #212529 !important;
  text-decoration: none;
  transition: color 0.15s ease;
}

.public-card-wrapper.card:hover .h5 a.link-dark,
.public-card-wrapper.card:hover .h5 a.link-dark:hover,
.public-card-wrapper.card:hover .h5 a.link-dark:focus {
  color: var(--bs-link-hover-color) !important;
}

.public-card-desc {
  height: 5rem;
  overflow: hidden;
  font-size: 0.875rem;
  color: #6c757d;
  line-height: 1.5;
}

.projects-header {
  width: 60%;
  text-align: center;
  margin: 40px auto 30px;
  font-weight: 200;
  display: none;
}

.projects-header h2 {
  font-size: 20px;
  letter-spacing: -1px;
  margin: 0;
}

@media screen and (min-width: 768px) {
  .projects-header h2 {
    font-size: 32px;
  }
}

@media (min-width: 992px) {
  .public-cards-row.row-cols-lg-5 > * {
    flex: 0 0 auto;
    width: 18%;
  }
}

@media (max-width: 575px) {
  .rounded-home-item-img {
    height: 120px;
  }

  .public-card-desc {
    height: 4.5rem;
    font-size: 0.8125rem;
  }
}

/* 页脚贴底：无滚动条时 footer 贴浏览器底部，内容超出时正常随文档滚动 */
html {
  height: 100%;
}

body.ds-sticky-footer {
  min-height: 100%;
  min-height: 100vh;
  margin: 0;
}

.ds-site-root {
  min-height: calc(100vh - var(--ds-navbar-offset, 40px));
  min-height: calc(100dvh - var(--ds-navbar-offset, 40px));
  display: flex;
  flex-direction: column;
  width: 100%;
}

.ds-page-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.ds-page-wrap > main,
main.ds-page-wrap {
  flex: 1 1 auto;
}

body.ds-sticky-footer .footer,
body.ds-sticky-footer .footer-ds {
  flex: 0 0 auto;
  margin-top: 0 !important;
}

/* 覆盖 site.min.css 中 .footer { margin-top: 70px } */
body.ds-sticky-footer footer.footer,
body.ds-sticky-footer footer.footer-ds {
  margin-top: 0 !important;
}

/* 页脚 */
.footer {
  color: #777;
  padding: 30px 0;
  border-top: 1px solid #e5e5e5;
  margin-top: 0;
}

.footer a {
  color: #777;
  text-decoration: none;
}

.footer a:hover {
  color: #333;
}

.footer-bottom {
  font-size: 13px;
}

.footer-bottom ul > li + li::before {
  padding: 0 10px;
  color: #ccc;
  content: "|";
}

/* 编辑模式 */
.edit-actions {
  display: none;
  gap: 2px;
}

.edit-mode .edit-actions {
  display: inline-flex;
}

.drag-handle {
  cursor: grab;
  color: #94a3b8;
  user-select: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.drag-handle .bi {
  font-size: 1rem;
  pointer-events: none;
}

.edit-mode .drag-handle {
  display: inline-flex !important;
}

.btn-icon .bi {
  font-size: 0.875rem;
  line-height: 1;
}

/* 图标选择器 */
.icon-preview-box {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 0.375rem;
  border: 1px solid #dee2e6;
}

.icon-picker-layout {
  display: flex;
  min-height: 400px;
  max-height: 480px;
}

.icon-picker-categories {
  flex: 0 0 108px;
  width: 108px;
  margin: 0;
  padding: 0.5rem 0;
  list-style: none;
  border-right: 1px solid #dee2e6;
  overflow-y: auto;
  overflow-x: hidden;
  background: #f8f9fa;
}

.icon-picker-categories li {
  margin: 0;
  padding: 0;
}

.icon-picker-cat-btn {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  color: #495057;
  font-size: 0.8125rem;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.icon-picker-cat-btn:hover {
  background: #e9ecef;
  color: #212529;
}

.icon-picker-cat-btn.active {
  background: #fff;
  color: #0d6efd;
  font-weight: 600;
  border-left-color: #0d6efd;
}

.icon-picker-body {
  flex: 1;
  min-width: 0;
  padding: 1rem;
  overflow-y: auto;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
}

.icon-picker-item {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  background: #fff;
  color: #495057;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.icon-picker-item .bi {
  font-size: 1.35rem;
  pointer-events: none;
}

.icon-picker-item:hover {
  background: #f8f9fa;
  border-color: #0d6efd;
  color: #0d6efd;
}

.icon-picker-item.selected {
  background: #e7f1ff;
  border-color: #0d6efd;
  color: #0d6efd;
}

.btn-icon {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.visibility-toggle {
  display: none;
}

.edit-mode .visibility-toggle {
  display: inline-flex;
}

.category-hidden .public-cards-row {
  display: none !important;
}

.category-hidden {
  opacity: 0.55;
}

.edit-mode .fav-card-wrap .fav-card {
  pointer-events: none;
}

.edit-mode .public-card-wrapper .stretched-link::after {
  pointer-events: none;
}

.dragging {
  opacity: 0.5;
}

.drag-over {
  outline: 2px dashed #337ab7;
  outline-offset: 2px;
}

.edit-mode .fav-card-wrap .link-actions {
  display: inline-flex;
}

.btn-xs {
  padding: 1px 5px;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 3px;
}

.top-link-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  height: 40px;
}

.top-link-item .nav-link {
  padding-right: 0.25rem;
}

.public-card-wrapper .card-actions {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  gap: 2px;
}

.edit-mode .public-card-wrapper .card-actions {
  display: flex;
}

.public-card-wrapper .drag-handle-pos {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.92);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 14px;
  cursor: grab;
}

.edit-mode .public-card-wrapper .drag-handle-pos {
  display: inline-flex;
}

/* 模态框 - AJ-Captcha 滑块拼图 */
.ajcaptcha-box {
  width: 100%;
  max-width: 310px;
  margin: 0 auto 1rem;
  user-select: none;
}

.ajcaptcha-panel {
  position: relative;
  width: 100%;
  height: 155px;
  border-radius: 4px;
  overflow: hidden;
  background: #e2e8f0;
}

.ajcaptcha-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ajcaptcha-piece {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: auto;
  pointer-events: none;
  will-change: transform;
}

.ajcaptcha-refresh {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.ajcaptcha-refresh:hover {
  background: rgba(0, 0, 0, 0.6);
}

.ajcaptcha-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 8px;
  font-size: 0.8125rem;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}

.ajcaptcha-tip-error {
  background: rgba(220, 53, 69, 0.85);
}

.ajcaptcha-tip-ok {
  background: rgba(25, 135, 84, 0.85);
}

.ajcaptcha-bar-wrap {
  margin-top: 0.75rem;
}

.ajcaptcha-bar {
  position: relative;
  height: 40px;
  background: #e2e8f0;
  border-radius: 20px;
  overflow: hidden;
}

.ajcaptcha-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: #337ab7;
  border-radius: 20px;
  width: 0;
}

.ajcaptcha-bar-text {
  position: absolute;
  width: 100%;
  text-align: center;
  line-height: 40px;
  color: #64748b;
  font-size: 0.85rem;
  pointer-events: none;
}

.ajcaptcha-slider {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  will-change: transform;
  touch-action: none;
}

.private-nav-login-hint a {
  color: #337ab7;
  text-decoration: none;
}

.private-nav-login-hint a:hover {
  text-decoration: underline;
}

/* 顶部导航编辑按钮（无边框） */
.btn-toplink-action {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.75);
}

.btn-toplink-action:hover,
.btn-toplink-action:focus {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff;
}

.btn-del-toplink.btn-toplink-action:hover {
  color: #ff6b6b;
}

.register-credentials {
  background: #f5f5f5;
  border-radius: 4px;
  padding: 1rem;
  margin: 1rem 0;
  font-family: monospace;
  word-break: break-all;
}

/* 后台管理 */
.admin-page {
  background: #f5f5f5;
  padding-top: 20px;
}

.admin-header {
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #d9edf7;
  color: #31708f;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.clickable {
  cursor: pointer;
  color: #337ab7;
}

.clickable:hover {
  text-decoration: underline;
}

.footer-ds {
  padding: 1.5rem 0 2rem;
  color: #777;
  font-size: 0.875rem;
}

.footer-ds a {
  color: #777;
  text-decoration: none;
}

.footer-ds a:hover {
  text-decoration: underline;
}

@media (max-width: 767px) {
  .jumbotron.masthead h1 {
    font-size: 40px;
  }

  .projects-header {
    width: 90%;
  }

  .search-input-wrap {
    width: 75%;
    min-width: 220px;
  }
}

/* IP 查询页 */
body.ip-page.ds-sticky-footer {
  padding-top: 56px;
}

.ip-query-page {
  padding-top: 130px;
  padding-bottom: 60px;
}

.ip-page-title {
  font-size: 2rem;
  font-weight: 600;
  color: #563d7c;
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}

@media (min-width: 768px) {
  .ip-page-title {
    font-size: 2.25rem;
  }
}

.ip-visitor-banner {
  margin-bottom: 32px;
  padding: 24px 16px;
  background: #f8f9fa;
  border-radius: 0.5rem;
}

.ip-visitor-text {
  font-size: 1.05rem;
  color: #495057;
}

.ip-visitor-text strong {
  color: #563d7c;
}

.ip-search-box {
  margin-bottom: 36px;
}

.ip-search-box .form-control:focus {
  border-color: #0d6efd;
  box-shadow: none;
  outline: none;
}

.ip-search-box .input-group:focus-within .form-control {
  border-color: #0d6efd;
  box-shadow: none;
}

.ip-search-box .input-group:focus-within .btn {
  border-color: #0d6efd;
}

.ip-result-card {
  border: none;
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.08);
}

.ip-info-dl dt {
  color: #6c757d;
  font-weight: 500;
}

.ip-icp-item:last-child {
  margin-bottom: 0 !important;
}

.ip-extra-loading,
.ip-ssl-not-found {
  padding: 12px 0;
}
