/* 基础样式 - 整体结构 */
html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 100vh;
  background-color: #ffffff;
}

.container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.web {
  width: 1280px;
  margin: 20px auto 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 左侧容器：logo、两行小字 */
.header-left {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.logo img {
  width: 150px;
  height: auto;
  margin-bottom: 5px;
}

.website-links-container {
  width: auto;
  margin-bottom: 15px;
  text-align: left;
}

.website-links-container .website-row a {
  font-size: 14px;
  color: #888;
  text-decoration: none;
  cursor: pointer;
}

.website-links-container .website-row a:hover {
  color: #000;
}

/* 移动端导航切换按钮 */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  right: 5%;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 1010;
}

.mobile-nav-toggle.expanded {
  transform: rotate(90deg);
  color: #ceef00;
}

/* 右侧容器：搜索引擎选项、搜索框+搜索按钮 */
.header-right {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.search-center-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.search-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
}

/* 搜索引擎选择器 */
.engine-selector {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #ffff00 #f0f0f0;
  padding-bottom: 6px;
  width: 100%;
  align-items: center;
  position: relative;
}

.engine-selector::-webkit-scrollbar {
  height: 4px;
}

.engine-selector::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 5px;
}

.engine-selector::-webkit-scrollbar-thumb {
  background: #ffff00;
  border-radius: 5px;
}

.engine-selector::-webkit-scrollbar-thumb:hover {
  background: #ceef00;
}

.engine-option {
  padding: 8px 12px;
  font-size: 15px;
  border-radius: 5px;
  cursor: pointer;
  color: #555;
  flex-shrink: 0;
  white-space: nowrap;
  margin-bottom: 2px;
  position: relative;
  user-select: none;
}

.engine-option[data-value*="baidu.com"] { color: #2932e1; }
.engine-option[data-value*="sogou.com"] { color: #f60; }
.engine-option[data-value*="so.com"] { color: #19b955; }
.engine-option[data-value*="bing.com"] { color: #00809d; }
.engine-option[data-value*="google.com"] { color: #4285f4; }
.engine-option[data-value*="douyin.com"] { color: #222222; }
.engine-option[data-value*="weibo.com"] { color: #ff8200; }
.engine-option[data-value*="bilibili.com"] { color: #00A1D6; }
.engine-option[data-value*="xiaohongshu.com"] { color: #ff0000; }
.engine-option[data-value*="zhihu.com"] { color: #0084ff; }

.engine-option.active {
  background: linear-gradient(135deg, #ffff00, #ceef00);
  color: #000;
}

.engine-option:hover {
  color: #000;
}

/* 搜索框和按钮 */
.search-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0;
  margin-top: 2px;
  position: relative;
  top: -8px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

#search-input {
  height: 45px;
  padding: 0 60px 0 10px;
  font-size: 16px;
  border: 2px solid #ceef00;
  border-radius: 5px 0 0 5px;
  width: 100%;
  outline: none;
  box-sizing: border-box;
  color: #000;
}

#search-input:focus {
  border-color: #ceef00;
  box-shadow: inset 0 0 0 2px rgba(219, 255, 0, 0.2);
}

#search-input::placeholder {
  color: #999;
}

#search-button {
  height: 45px;
  padding: 0 20px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 0 5px 5px 0;
  background: linear-gradient(90deg, #ceef00, #ffff00);
  color: #000;
  cursor: pointer;
  white-space: nowrap;
  margin-left: -1px;
}

#search-button:hover {
  background: linear-gradient(120deg, #ceef00, #ffff00);
}

/* 搜索联想词开关 */
.toggle-container {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.toggle-label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

.toggle-label.active {
  color: #bddb00;
}

.toggle-button {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 16px;
}

.toggle-button input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 16px;
}

.slider::before {
  position: absolute;
  content: '';
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
}

input:checked + .slider {
  background: #bddb00;
}

input:checked + .slider::before {
  transform: translateX(24px);
}

/* 搜索联想词下拉框 */
.suggestions {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 5px;
  color: #555;
  background-color: #fff;
  display: none;
  z-index: 10;
  overflow-y: hidden;
  max-height: none;
}

.suggestions div {
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  white-space: normal;
  text-align: left;
  word-break: break-word;
}

.suggestions div:hover {
  color: #000;
  background-color: #f9ffd0;
}

.suggestions div::before {
  content: attr(data-index);
  display: inline-block;
  width: 20px;
  text-align: center;
  margin-right: 10px;
  font-weight: bold;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.suggestions div[data-index="1"]::before { color: #d81500; }
.suggestions div[data-index="2"]::before { color: #ff5151; }
.suggestions div[data-index="3"]::before { color: #ff5f00; }
.suggestions div[data-index="4"]::before { color: #ff8800; }
.suggestions div[data-index="5"]::before { color: #ffa500; }
.suggestions div[data-index="6"]::before { color: #ffd200; }
.suggestions div[data-index="7"]::before { color: #0075ff; }
.suggestions div[data-index="8"]::before { color: #2faaff; }
.suggestions div[data-index="9"]::before { color: #60b5ff; }
.suggestions div[data-index="10"]::before { color: #999999; }

/* 模块容器 */
.modules-container {
  width: 100%;
  margin: 10px auto;
  background-color: #f5fbff;
  border-radius: 5px;
  position: relative;
}

.search-modules {
  display: flex;
  justify-content: flex-start;
  padding: 6px;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

.user-modules {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 20px;
}

.user-modules .module {
  border: 1px solid #ddd;
}

.module {
  padding: 6px 8px;
  background-color: #ffffff;
  color: #607D8B;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  height: 30px;
  box-sizing: border-box;
}

.module:hover {
  border: 1px solid #ceef00;
  background: linear-gradient(135deg, #f5ffbb, #ffffaa);
}

.module a {
  color: inherit;
  text-decoration: none;
}

/* 网站卡片的删除按钮样式 */
.module .delete-btn {
  position: absolute;
  right: -2px;
  top: -6px;
  font-size: 16px;
  color: #ff4757;
  cursor: pointer;
  background-color: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
}

.module:hover .delete-btn {
  opacity: 1;
  visibility: visible;
}

.module .delete-btn:hover {
  color: #ff6b81;
}

.add-website-btn {
  background: linear-gradient(135deg, #ceef00, #ffff00);
  color: #000;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
}

.add-website-btn:hover {
  background: linear-gradient(135deg, #ffff00, #ceef00);
}

.website-icon {
  width: 16px;
  height: 16px;
  margin-right: 2px;
  vertical-align: middle;
}

/* 角标样式 */
.corner-tag {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 30px;
  background-color: #ff4757;
  color: #fff;
  font-size: 12px;
  text-align: center;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  border-top-right-radius: 5px;
}

.corner-tag::before {
  content: attr(data-text);
  display: block;
  transform: translate(20%, 20%) rotate(35deg);
  transform-origin: center center;
  white-space: nowrap;
}

.tag {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 30px;
  background-color: #b0cc00;
  color: #fff;
  font-size: 12px;
  text-align: center;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  border-top-right-radius: 5px;
}

.tag::before {
  content: attr(data-text);
  display: block;
  transform: translate(20%, 20%) rotate(35deg);
  transform-origin: center center;
  white-space: nowrap;
}

/* 主内容区域 */
.main-content {
  display: flex;
  width: 100%;
  gap: 20px;
  min-height: 100vh;
  overflow: visible;
}

/* 左侧导航栏PC端样式 */
.left-nav {
  width: 90px;
  position: sticky;
  top: 10px;
  align-self: flex-start;
  overflow-y: auto;
  background-color: #f5fbff;
  border-radius: 5px;
  z-index: 100;
}

/* 左侧网站分类标题 */
.nav-category .floor-title {
  font-size: 16px;
  color: #555;
  padding: 8px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  width: 100%;
  box-sizing: border-box;
  background-color: transparent;
  transition: all 0.3s ease;
}

.nav-category .floor-title:hover {
  color: #111;
  font-weight: bold;
}

.nav-category .floor-title.active {
  background: linear-gradient(135deg, #ceef00, #ffff00);
  color: #000;
  border-radius: 5px;
  font-weight: bold;
}

/* 右侧楼层 */
.right-floors {
  flex: 1;
  width: 100%;
  max-width: 1280px;
}

/* 广告轮播 */
.ad {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 5px;
  margin-bottom: 20px;
}

.carousel-slides {
  position: relative;
  width: 100%;
  height: auto;
}

.carousel-slide {
  position: absolute;
  width: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
  z-index: 1;
}

.carousel-slide.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

.carousel-slide img {
  width: 100%;
  height: auto;
  border-radius: 5px;
  display: block;
  transition: transform 0.5s ease;
}

.carousel-slide:hover img {
  transform: scale(1.05);
}

.carousel-indicators {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 6px;
}

.indicator-dot {
  width: 6px;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator-dot.active {
  width: 18px;
  height: 6px;
  background-color: white;
  border-radius: 3px;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background-color: rgba(0, 0, 0, 0.3);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 3;
  line-height: 1;
  text-align: center;
  padding: 0;
}

.ad:hover .carousel-btn {
  opacity: 1;
  visibility: visible;
}

.prev-btn {
  left: 10px;
}

.next-btn {
  right: 10px;
}

.carousel-btn:hover {
  background-color: rgba(0, 0, 0, 0.5);
}

/* 楼层内容 */
.floor {
  margin-bottom: 20px;
  display: inline-block;
  background-color: #f5fbff;
  width: 100%;
  padding: 10px;
  margin-top: 0;
  border-radius: 5px;
  box-sizing: border-box;
  transition: transform 0.3s ease;
}

.floor-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.floor-header .floor-title {
  margin: 0;
  font-size: 16px;
  color: #555;
  padding: 8px;
  white-space: nowrap;
}

.sub-categories {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sub-category {
  padding: 4px 6px;
  font-size: 14px;
  color: #888;
  background: #fff;
  cursor: pointer;
  border-radius: 5px;
}

.sub-category.active {
  color: #000;
  background: #ceef00;
}

.sub-category:hover {
  color: #000;
}

/* 网站卡片 */
.floor-cards {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  gap: 10px;
  padding: 10px 0;
  position: relative;
  z-index: 2;
}

.sub-category-cards {
  display: none;
  width: 100%;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  overflow: visible;
  z-index: 2;
}

.sub-category-cards.active,
.sub-category-cards.active-init {
  display: flex;
}

.webcard {
  position: relative;
  flex: 1 1 calc((100% - 40px) / 5);
  min-width: calc((100% - 40px) / 5);
  max-width: calc((100% - 40px) / 5);
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-radius: 5px;
  text-decoration: none;
  color: #555;
  box-sizing: border-box;
  height: 60px;
  cursor: pointer;
  transition: background 0.3s ease;
  z-index: 2;
}

.floor-cards .webcard:hover {
  border: 1px solid #ceef00;
  background: linear-gradient(135deg, #f5ffbb, #ffffaa);
  transform: scale(1.02);
  transition: transform 1s ease, border-color 1s ease, background 1s ease;
}

.card-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 10px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.card-icon-name {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.card-icon {
  width: 16px;
  height: 16px;
}

.card-name {
  font-size: 16px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #555;
  line-height: 1.1;
}

.card-description {
  font-size: 12px;
  color: #888;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: left;
  word-break: break-all;
  margin-top: 2px;
}

/* 浮窗样式 */
.tooltip {
  position: absolute;
  bottom: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px;
  border-radius: 5px;
  display: none;
  z-index: 9999;
  white-space: normal;
  word-break: break-word;
  width: 200px;
  height: auto;
  margin-bottom: 15px;
  font-size: 12px;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid rgba(0, 0, 0, 0.8);
}

.webcard:hover .tooltip {
  display: block;
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #fff;
  padding: 20px;
  border-radius: 5px;
  width: 300px;
  text-align: center;
}

.modal-content .modal-title {
  margin-top: 0;
  margin-bottom: 5px;
  font-size: 18px;
  color: #555;
}

.modal-content .tip {
  font-size: 12px;
  color: #666;
  margin-bottom: 15px;
  text-align: left;
}

.modal-content label {
  display: block;
  margin: 10px 0 5px;
  text-align: left;
}

.modal-content input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-sizing: border-box;
  outline: none;
}

.modal-content input:focus {
  border-color: #ceef00;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

#cancel-website-btn {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
  flex: 1;
}

#cancel-website-btn:hover {
  background: linear-gradient(135deg, #ff6b81, #ff4757);
}

.modal-content button[type="submit"] {
  flex: 1;
  background: linear-gradient(135deg, #ffff00, #ceef00);
  color: #000;
  border: none;
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
}

.modal-content button[type="submit"]:hover {
  background: linear-gradient(135deg, #ceef00, #ffff00);
}

.required {
  color: red;
  margin-left: 4px;
}

/* 返回顶部和返回底部按钮 */
.scroll-buttons {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.scroll-button {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #ffff00, #ceef00);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.scroll-button:hover {
  background: linear-gradient(135deg, #ceef00, #ffff00);
  transform: scale(1.1);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
}

.scroll-button.hidden {
  display: none;
}

.scroll-to-top::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #000;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.scroll-to-bottom::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #000;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* 页脚样式 */
.footer-container {
  width: 100%;
  background: radial-gradient(circle, #ceef00, #ffff00);
  color: #000;
  padding: 20px 0;
  text-align: center;
  margin-top: 20px;
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: #000;
  text-decoration: none;
  font-size: 12px;
}

.footer-info {
  font-size: 14px;
}

.footer-info a {
  color: #000;
  text-decoration: none;
}

/* 响应式设计 */
@media (min-width: 769px) {
  .mobile-nav-toggle {
    display: none;
  }
}

@media (max-width: 768px) {
  .web {
    width: 90%;
    margin: 20px auto 0;
  }

  .header-left {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 0;
    background-color: white;
    z-index: 1000;
    align-items: center;
    text-align: center;
    width: 100%;
  }

  .logo img {
    margin: 0 auto;
    width: 120px;
  }

  .header-right {
    margin-top: 40px;
  }

  .website-links-container {
    display: none;
  }

  .engine-selector {
    justify-content: flex-start;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .engine-option {
    flex-shrink: 0;
  }

  .search-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0;
  }

  #search-input {
    flex: 1;
    border-radius: 5px 0 0 5px;
  }

  #search-button {
    border-radius: 0 5px 5px 0;
    width: auto;
  }

  .left-nav {
    position: fixed;
    top: 0;
    left: 0;
    padding: 20px 0;
    height: 100vh;
    z-index: 10000;
    overflow-y: auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 25%;
  }

  .left-nav.active {
    transform: translateX(0);
  }

  .nav-category {
    margin: 0 6px;
  }

  .mobile-nav-toggle {
    display: block;
  }

  .floor-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
  }

  .floor-cards .webcard {
    flex: 0 0 calc(50% - 5px);
    max-width: calc(50% - 5px);
  }

  .floor-cards .webcard:nth-child(2n) {
    margin-right: 0;
  }

  .sub-categories {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
  }

  .sub-category {
    flex-shrink: 0;
  }

  .ad {
    position: relative;
    width: 100%;
    height: auto;
    margin-bottom: 15px;
  }

  .carousel-indicators {
    bottom: 20px;
    gap: 4px;
  }

  .indicator-dot {
    width: 5px;
    height: 5px;
  }

  .indicator-dot.active {
    width: 15px;
    height: 5px;
  }

  .carousel-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .prev-btn {
    left: 5px;
  }

  .next-btn {
    right: 5px;
  }

  .tooltip {
    z-index: 9999;
    white-space: normal;
    bottom: 100%;
  }
}

@media (max-width: 480px) {
  .carousel-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .indicator-dot {
    width: 4px;
    height: 4px;
  }

  .indicator-dot.active {
    width: 12px;
    height: 4px;
  }

  .floor-cards .webcard {
    flex: 0 0 calc(50% - 5px);
    max-width: calc(50% - 5px);
  }
}