/**
 * 导航栏样式 - 参考 iLovePDF 设计
 * 简洁、专业
 */

/* ========================================
 * 导航栏基础
 * ======================================== */
.navbar {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 !important;
  min-height: 56px;
}

.navbar > .container {
  max-width: 1400px;
  padding: 0 24px;
}

.bg-light {
  background-color: #ffffff !important;
}

/* ========================================
 * Logo 区域
 * ======================================== */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  margin-right: 24px;
  text-decoration: none;
}

.main-icon {
  width: 32px;
  height: 32px;
  vertical-align: middle;
}

.navbar-brand .icon-text {
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
  margin-left: 0;
}

/* ========================================
 * 导航菜单项
 * ======================================== */
.navbar-nav {
  gap: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 20px !important;
  font-size: 18px;
  font-weight: 500;
  color: #374151 !important;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: #2563eb !important;
  background-color: #f3f4f6;
}

.nav-item.active > .nav-link,
.nav-link.active {
  color: #2563eb !important;
}

/* 图标样式 */
.icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-text {
  margin-left: 0;
  font-weight: 500 !important;
}

/* 分隔线 */
.nav-item-separator {
  position: relative;
  margin: 0;
  width: 0;
}

.nav-item-separator::before {
  display: none;
}

/* ========================================
 * 下拉菜单
 * ======================================== */
.dropdown-toggle::after {
  margin-left: 6px;
  border-top-width: 5px;
  border-right-width: 4px;
  border-left-width: 4px;
  opacity: 0.6;
}

.dropdown-menu {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  padding: 8px;
  min-width: 220px;
  margin-top: 0 !important;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: #374151;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background-color: #f3f4f6;
  color: #2563eb;
}

.dropdown-item .icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.dropdown-item .icon-text {
  flex: 1;
}

.dropdown-divider {
  margin: 6px 0;
  border-color: #e5e7eb;
}

/* 下拉菜单分组标题 */
.dropdown-header {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px 4px;
  margin-top: 4px;
}

/* 大型下拉菜单 */
.dropdown-menu-large {
  min-width: 280px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Mega Menu 多列平铺布局 */
.dropdown-mega {
  position: static;
}

.dropdown-menu-mega {
  width: 100%;
  max-width: 900px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.mega-menu-row {
  display: flex;
  gap: 24px;
}

.mega-menu-col {
  flex: 1;
  min-width: 180px;
}

.mega-menu-col .dropdown-header {
  padding: 0 0 8px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}

.mega-menu-col .dropdown-item {
  padding: 8px 0;
  border-radius: 0;
}

.mega-menu-col .dropdown-item:hover {
  background: transparent;
  color: #2563eb;
}

/* ========================================
 * 右侧按钮区域
 * ======================================== */
.navbar-nav .btn {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 50px;
}

.btn-outline-primary {
  color: #2563eb;
  border-color: #2563eb;
  background: transparent;
}

.btn-outline-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* 收藏图标 */
.navbar-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.nav-link:hover .navbar-icon {
  opacity: 1;
}

/* ========================================
 * 导航栏搜索框
 * ======================================== */
.nav-search {
  margin-left: auto;
  margin-right: 16px;
  align-items: center;
}

.nav-search-box {
  display: flex;
  align-items: center;
  background: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 6px 12px;
  transition: all 0.2s ease;
  width: 180px;
}

.nav-search-box:focus-within {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  width: 220px;
}

.nav-search-icon {
  width: 16px;
  height: 16px;
  color: #9ca3af;
  flex-shrink: 0;
}

.nav-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: #374151;
  padding: 0 8px;
  min-width: 0;
}

.nav-search-input::placeholder {
  color: #9ca3af;
}

.nav-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: #d1d5db;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.nav-clear-btn:hover {
  background: #9ca3af;
}

.nav-clear-btn svg {
  width: 10px;
  height: 10px;
  color: #ffffff;
}

/* ========================================
 * 响应式设计
 * ======================================== */
@media (max-width: 992px) {
  .navbar > .container {
    padding: 0 16px;
  }

  .nav-search-box {
    width: 140px;
  }

  .nav-search-box:focus-within {
    width: 180px;
  }
}

@media (max-width: 768px) {
  .nav-search {
    display: none;
  }
  .navbar-collapse {
    background: #ffffff;
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
  }

  .nav-link {
    padding: 12px 16px !important;
  }

  .icon-text {
    display: inline;
  }

  .dropdown-toggle::after {
    display: inline-block;
  }

  .dropdown-menu {
    border: none;
    box-shadow: none;
    padding-left: 24px;
  }
}

/* ========================================
 * 深色模式
 * ======================================== */
.dark-mode .navbar,
[data-theme="dark"] .navbar {
  background-color: #1f2937 !important;
  border-color: #374151;
}

.dark-mode .navbar-brand .icon-text,
[data-theme="dark"] .navbar-brand .icon-text {
  color: #f3f4f6;
}

.dark-mode .nav-link,
[data-theme="dark"] .nav-link {
  color: #e5e7eb !important;
}

.dark-mode .nav-link:hover,
[data-theme="dark"] .nav-link:hover {
  color: #60a5fa !important;
  background-color: #374151;
}

.dark-mode .dropdown-menu,
[data-theme="dark"] .dropdown-menu {
  background-color: #1f2937;
  border-color: #374151;
}

.dark-mode .dropdown-item,
[data-theme="dark"] .dropdown-item {
  color: #e5e7eb;
}

.dark-mode .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:hover {
  background-color: #374151;
  color: #60a5fa;
}

.dark-mode .dropdown-divider,
[data-theme="dark"] .dropdown-divider {
  border-color: #374151;
}

/* 搜索框深色模式 */
.dark-mode .nav-search-box,
[data-theme="dark"] .nav-search-box {
  background: #374151;
  border-color: transparent;
}

.dark-mode .nav-search-box:focus-within,
[data-theme="dark"] .nav-search-box:focus-within {
  background: #1f2937;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.dark-mode .nav-search-input,
[data-theme="dark"] .nav-search-input {
  color: #f3f4f6;
}

.dark-mode .nav-search-input::placeholder,
[data-theme="dark"] .nav-search-input::placeholder {
  color: #9ca3af;
}

.dark-mode .nav-search-icon,
[data-theme="dark"] .nav-search-icon {
  color: #9ca3af;
}

.dark-mode .nav-clear-btn,
[data-theme="dark"] .nav-clear-btn {
  background: #6b7280;
}

.dark-mode .nav-clear-btn:hover,
[data-theme="dark"] .nav-clear-btn:hover {
  background: #9ca3af;
}
