/* 网址导航页面样式 */

.bookmark-search-box {
  display: flex;
  align-items: center;
}

.bookmark-search-input {
  width: 200px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all .2s;
}

.bookmark-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,140,255,.1);
  width: 260px;
}

.bookmark-search-input::placeholder {
  color: var(--muted);
}

.bookmark-refresh-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.bookmark-refresh-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.bookmark-refresh-btn:active {
  transform: scale(0.95);
}

.bookmark-refresh-btn.loading svg {
  animation: spin 1s linear infinite;
}

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

.bookmark-count {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* 移动端分类按钮 - 默认隐藏 */
.mobile-category-btn {
  display: none;
}

/* 主布局 */
.bookmark-main {
  display: flex;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* 侧边栏 */
.bookmark-sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: width .2s;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-toggle {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
}

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

.category-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.category-list::-webkit-scrollbar {
  width: 4px;
}

.category-list::-webkit-scrollbar-track {
  background: transparent;
}

.category-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 2px;
}

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

.category-item.active {
  background: rgba(79,140,255,.08);
  color: var(--accent);
}

.category-item.active .category-name {
  font-weight: 500;
}

.category-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.category-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-item.active .category-name {
  color: var(--accent);
}

.category-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

.category-item.active .category-count {
  background: rgba(79,140,255,.15);
  color: var(--accent);
}

/* 主内容区 */
.bookmark-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.bookmark-content::-webkit-scrollbar {
  width: 6px;
}

.bookmark-content::-webkit-scrollbar-track {
  background: transparent;
}

.bookmark-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.category-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 书签网格 */
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: all .2s;
  cursor: pointer;
}

.bookmark-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(79,140,255,.15);
  transform: translateY(-1px);
}

.bookmark-item:active {
  transform: translateY(0);
}

.bookmark-favicon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  overflow: hidden;
}

.bookmark-favicon img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.bookmark-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.bookmark-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.bookmark-domain {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-hint {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

/* 响应式 */
@media (max-width: 768px) {
  /* 移动端头部优化 */
  .nav-header {
    padding: 0 12px;
  }
  
  .nav-header-right {
    gap: 8px;
  }
  
  .bookmark-search-input {
    width: 120px;
    font-size: 12px;
    padding: 5px 10px;
  }
  
  .bookmark-search-input:focus {
    width: 160px;
  }
  
  .bookmark-refresh-btn {
    width: 28px;
    height: 28px;
  }
  
  .bookmark-count {
    font-size: 11px;
    padding: 2px 8px;
  }
  
  /* 移动端分类切换 - 水平滚动标签 */
  .bookmark-sidebar {
    position: fixed;
    left: 0;
    top: 52px;
    bottom: 0;
    width: 260px;
    max-width: 80vw;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }
  
  .bookmark-sidebar.open {
    transform: translateX(0);
  }
  
  /* 移动端侧边栏遮罩 */
  .bookmark-sidebar-overlay {
    position: fixed;
    inset: 0;
    top: 52px;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(2px);
    z-index: 149;
    opacity: 0;
    visibility: hidden;
    transition: all .3s;
  }
  
  .bookmark-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }
  
  /* 移动端分类按钮（头部） */
  .mobile-category-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    max-width: 120px;
  }
  
  .mobile-category-btn:active {
    transform: scale(0.96);
    background: var(--bg);
  }
  
  .mobile-category-btn svg {
    flex-shrink: 0;
  }
  
  .mobile-category-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  /* 隐藏桌面端侧边栏切换按钮 */
  .sidebar-toggle {
    display: none;
  }
  
  /* 移动端内容区优化 */
  .bookmark-content {
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  
  .category-title {
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }
  
  /* 移动端书签网格 - 单列 */
  .bookmark-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  /* 移动端书签卡片 - 更大的触摸目标 */
  .bookmark-item {
    padding: 14px 16px;
    min-height: 56px;
  }
  
  .bookmark-favicon {
    width: 24px;
    height: 24px;
  }
  
  .bookmark-favicon img {
    width: 18px;
    height: 18px;
  }
  
  .bookmark-title {
    font-size: 14px;
  }
  
  .bookmark-domain {
    font-size: 12px;
  }
  
  /* 移动端分类列表项 - 更大的触摸目标 */
  .category-item {
    padding: 12px 14px;
    min-height: 48px;
  }
  
  .category-icon {
    font-size: 16px;
  }
  
  .category-name {
    font-size: 14px;
  }
  
  .category-count {
    font-size: 12px;
    padding: 2px 8px;
  }
  
  /* 移动端空状态 */
  .empty-state {
    padding: 60px 20px;
  }
  
  .empty-icon {
    font-size: 40px;
  }
  
  .empty-text {
    font-size: 15px;
  }
  
  .empty-hint {
    font-size: 12px;
  }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
  .bookmark-search-box {
    display: none;
  }
  
  .bookmark-count {
    display: none;
  }
  
  .nav-header {
    padding: 0 10px;
  }
  
  .bookmark-content {
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  
  .bookmark-item {
    padding: 12px 14px;
  }
  
  .category-title {
    font-size: 15px;
  }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .bookmark-content {
    padding: 8px 12px;
  }
  
  .bookmark-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .empty-state {
    padding: 30px 20px;
  }
}

/* 安全区域适配 */
@supports (padding: max(0px)) {
  .bookmark-main {
    height: calc(100vh - 52px - env(safe-area-inset-bottom));
  }
  
  @media (max-width: 768px) {
    .bookmark-sidebar {
      top: calc(52px + env(safe-area-inset-top));
      bottom: env(safe-area-inset-bottom);
    }
  }
}
