/* 
 * 现代化网址导航样式
 * 配色：清新绿 - 科学配色方案
 * 原则：60-30-10法则 + 高对比度 + 背景中性化
 * 
 * 布局说明：
 * - 一级分类：左侧边栏
 * - 二级分类：顶部选项卡
 * - 三级分类：选项卡内容内
 */

:root {
    --primary: #10b981;
    --primary-light: #34d399;
    --primary-dark: #059669;
    --secondary: #22c55e;
    --accent: #4ade80;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #262626;
    --bg-card: rgba(38, 38, 38, 0.8);
    --bg-card-hover: rgba(38, 38, 38, 0.95);
    
    --text-primary: #fafafa;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(16, 185, 129, 0.4);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 60px rgba(16, 185, 129, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --sidebar-width: 130px;
    --sidebar-collapsed: 50px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* 工具箱布局变量 */
    --header-height: 50px;
    --footer-height: 30px;
    --right-sidebar-width: 280px;
}

[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f5;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(255, 255, 255, 1);
    
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(16, 185, 129, 0.4);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 60px rgba(16, 185, 129, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* 全局滚动条样式 - 防止出现黑条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 100% 80% at 50% -30%, rgba(16, 185, 129, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 80% 60% at 100% 100%, rgba(34, 197, 94, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ========== 侧边栏样式 ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: width var(--transition-normal), transform var(--transition-normal);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    overflow: visible;
}

.sidebar.collapsed .logo {
    gap: 0;
    justify-content: center;
    width: 100%;
}

.sidebar.collapsed .logo-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-count,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .theme-toggle span {
    display: none;
}

.sidebar.collapsed .sidebar-search {
    display: none;
}

.sidebar.collapsed .sidebar-nav {
    padding: 8px 4px;
}

.sidebar.collapsed .nav-item {
    padding: 10px 0;
    justify-content: center;
}

.sidebar.collapsed .nav-item i {
    width: 20px;
    font-size: 16px;
}

.sidebar.collapsed .sidebar-footer {
    padding: 4px;
    flex-direction: row;
    gap: 4px;
    height: var(--footer-height);
}

.sidebar.collapsed .footer-btn {
    padding: 0;
    flex: 1;
    aspect-ratio: auto;
    border: none;
    font-size: calc(var(--footer-height) / 2.5);
    width: calc(var(--footer-height) - 8px);
    height: calc(var(--footer-height) - 8px);
}

/* 折叠状态下的搜索按钮 - CSS选择器语法正确，无需修改 */
/* .collapsed-search-btn 中的点号是CSS类选择器前缀，对应HTML中的 class="collapsed-search-btn" */
.collapsed-search-btn {
    display: none;
    width: 100%;
    padding: 10px 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: all var(--transition-fast);
}

.collapsed-search-btn:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
}

.sidebar.collapsed .collapsed-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 100;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    box-sizing: border-box;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.logo:hover {
    background: var(--bg-tertiary);
}

.logo-icon {
    width: calc(var(--header-height) - 14px);
    height: calc(var(--header-height) - 14px);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: calc(var(--header-height) / 3);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    transition: opacity var(--transition-normal), width var(--transition-normal);
}

/* 折叠状态下的侧边栏header */
.sidebar.collapsed .sidebar-header {
    padding: 10px 0;
    justify-content: center;
}

/* ========== 侧边栏搜索区域 ========== */
.sidebar-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.search-engine-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}

.engine-tab {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all var(--transition-fast);
}

.engine-tab:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.engine-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 8px;
    color: var(--text-muted);
    font-size: 11px;
}

.search-input-wrapper input {
    width: 100%;
    padding: 6px 8px 6px 26px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
    transition: all var(--transition-fast);
}

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

.search-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 6px;
}

.sidebar.collapsed .sidebar-nav {
    overflow: visible;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 6px;
    white-space: nowrap;
    transition: opacity var(--transition-normal), width var(--transition-normal);
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    text-align: left;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-light);
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    opacity: 0.8;
}

.nav-item span {
    flex: 1;
    white-space: nowrap;
    transition: opacity var(--transition-normal), width var(--transition-normal);
}

/* 侧边栏缩起状态下的tooltip - 使用JavaScript实现 */
.sidebar.collapsed .nav-item {
    position: relative;
}

/* 底部按钮的tooltip - 使用JavaScript实现 */
.sidebar.collapsed .footer-btn {
    position: relative;
}

.nav-badge {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 8px;
    transition: opacity var(--transition-normal), width var(--transition-normal);
    font-variant-numeric: tabular-nums;
}

.nav-item.active .nav-badge {
    background: var(--primary);
    color: white;
}

.nav-count {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 8px;
    transition: opacity var(--transition-normal), width var(--transition-normal);
    font-variant-numeric: tabular-nums;
}

.nav-item.active .nav-count {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 2px 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 6px;
    align-items: center;
    height: var(--footer-height);
    box-sizing: border-box;
}

.footer-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--footer-height) - 8px);
    height: calc(var(--footer-height) - 8px);
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: calc(var(--footer-height) / 2.5);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.footer-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.theme-toggle span {
    white-space: nowrap;
    transition: opacity var(--transition-normal), width var(--transition-normal);
}

/* ========== 主内容区样式 ========== */
/* 主内容区样式已移至工具箱新增样式部分 */

.content-area {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

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

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
}

.view-btn {
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--primary);
    color: white;
}

.item-count {
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== 二级分类选项卡样式 - 新增 ========== */
.sub-category-tabs {
    margin-bottom: 20px;
    display: none;
}

.tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
    transition: all var(--transition-fast);
    backdrop-filter: blur(4px);
}

.tab-item:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.tab-item.active:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ========== 网址网格样式 ========== */
.sites-grid-wrapper {
    display: flex;
    gap: 16px;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    flex: 1;
}

.sites-grid.list-view {
    grid-template-columns: 1fr;
}

.site-card-wrapper {
    position: relative;
}

.site-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 14px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-fast);
    position: relative;
    content-visibility: auto;
    contain-intrinsic-size: auto 80px;
}

.favorite-btn {
    position: absolute;
    top: 8px;
    right: 40px;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.8);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: all var(--transition-fast);
    z-index: 10;
}

.site-card-wrapper:hover .favorite-btn {
    opacity: 1;
}

.favorite-btn:hover {
    background: var(--primary);
    color: white;
}

.favorite-btn.active {
    opacity: 1;
    background: var(--primary);
    color: white;
}

.site-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12), 0 0 0 1px rgba(16, 185, 129, 0.08);
}

.site-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}

.site-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: all var(--transition-fast);
}

.site-card:hover .site-icon {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.site-icon img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: contain;
}

.site-icon i {
    color: var(--primary);
    font-size: 18px;
}

.site-info {
    flex: 1;
    min-width: 0;
}

.site-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.site-desc {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
    line-height: 1.5;
}

.site-url {
    font-size: 11px;
    color: var(--text-muted);
}

.site-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.click-count {
    color: var(--primary);
    font-weight: 500;
}

.hot-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

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

.empty-state p {
    font-size: 13px;
}

.main-footer {
    padding: 8px 16px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 9px;
    line-height: 1.3;
}

.main-footer .copyright {
    margin-top: 2px;
    opacity: 0.7;
    font-size: 9px;
}

.main-footer .copyright a {
    color: var(--text-muted);
    text-decoration: none;
}

.main-footer .copyright a:hover {
    text-decoration: underline;
}

.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 50px;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-normal);
    z-index: 90;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ========== 搜索弹窗样式 ========== */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.search-modal.active .search-modal-content {
    transform: scale(1);
}

.search-modal.show {
    opacity: 1;
    visibility: visible;
}

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

.search-modal-header h2 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.search-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.search-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.search-modal-body {
    padding: 20px;
}

.search-modal-engines {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.modal-engine-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition-fast);
    min-width: 60px;
}

.modal-engine-tab i {
    font-size: 16px;
}

.modal-engine-tab:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-engine-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-modal-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-modal-input-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 16px;
}

.search-modal-input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: all var(--transition-fast);
}

.search-modal-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.search-modal-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.search-modal-hint {
    text-align: center;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== 响应式样式 ========== */
.mobile-menu-btn {
    display: none;
    padding: 8px 12px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        grid-template-columns: 0 1fr;
    }
    
    .main-content {
        grid-column: 2;
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    .sites-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .search-tabs {
        flex-wrap: wrap;
    }
    
    .search-hint {
        display: none;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .tabs-wrapper {
        padding: 10px 12px;
    }
    
    .tab-item {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ========== 工具箱新增样式 ========== */

/* 顶部栏样式 - 适应左边栏 */
.top-header {
    position: fixed;
    top: 0;
    left: 130px;
    right: 0;
    height: 30px;
    background: var(--primary);
    border-bottom: 1px solid var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 150;
    transition: left 0.3s ease, right 0.3s ease;
    box-sizing: border-box;
    color: white;
}

.top-header.sidebar-collapsed {
    left: 50px;
}

.top-header.right-sidebar-open {
    right: var(--right-sidebar-width);
}

.top-header.hidden {
    transform: translateY(-100%);
}

/* 远程吸顶导航栏偏移 - JS检测到.navbar时动态添加 */
.has-remote-navbar .top-header {
    top: 28px;
}
.has-remote-navbar .sidebar {
    top: 28px;
}
.has-remote-navbar .main-wrapper {
    padding-top: calc(var(--header-height) + 28px);
}
@media (max-width: 768px) {
    .has-remote-navbar .main-wrapper {
        padding-top: 58px;
    }
    .has-remote-navbar .right-sidebar {
        top: 44px;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-toggle {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition-fast);
}

.header-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
}

.header-logo i {
    color: var(--primary);
    font-size: 18px;
}

.header-menus {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    padding: 0 20px;
    overflow-x: auto;
}

.header-menus::-webkit-scrollbar {
    height: 0;
}

/* 顶栏标签页样式 */
.header-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    padding: 0 8px;
    overflow-x: auto;
    margin: 0 8px;
}

.header-tabs::-webkit-scrollbar {
    height: 0;
}

.header-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all var(--transition-fast);
    max-width: 250px;
    min-width: 0;
    flex-shrink: 0;
    height: 24px;
    line-height: 1;
}

.header-tab.active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    border-color: white;
    font-weight: 500;
}

.header-tab:hover {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.header-tab.active:hover {
    background: white;
    color: var(--primary);
}

.tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    min-width: 0;
    flex: 1;
}

.tab-close {
    width: 14px;
    height: 14px;
    border: none;
    background: transparent;
    color: inherit;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    padding: 0;
    opacity: 0.5;
    margin-left: 2px;
}

.tab-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.2);
}

.header-menu-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all var(--transition-fast);
    text-decoration: none;
    height: 26px;
    line-height: 1;
}

.header-menu-item:hover {
    color: white;
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.header-menu-item.active,
.header-menu-item[data-active="true"] {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    border-color: white;
    font-weight: 500;
}

.header-menu-item.active:hover,
.header-menu-item[data-active="true"]:hover {
    background: white;
    color: var(--primary);
}

.header-menu-item i {
    font-size: 11px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.header-btn:hover {
    background: rgba(0, 0, 0, 0.25);
    color: white;
}

.header-btn:active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
}

/* 主区域包装器 - 适配顶部栏和底部栏 */
.main-wrapper {
    display: grid;
    grid-template-columns: 130px 1fr auto;
    grid-template-rows: 1fr;
    min-height: 100vh;
    padding-top: var(--header-height);
    padding-bottom: var(--footer-height);
}

/* 左边栏收起时调整 */
.main-wrapper:has(.sidebar.collapsed) {
    grid-template-columns: 50px 1fr auto;
}

.main-wrapper.no-header {
    padding-top: 0;
}

.main-wrapper.no-footer {
    padding-bottom: 0;
}

/* 主内容区调整 - 适配右侧栏 */
.main-content {
    grid-column: 2;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-right: var(--right-sidebar-width);
}

/* 右侧栏收起时主内容区调整 */
.main-wrapper:has(.right-sidebar.collapsed) .main-content,
.main-content.right-sidebar-collapsed {
    margin-right: 0;
}

/* 兼容不支持:has的浏览器 */
@media (min-width: 1201px) {
    .main-wrapper .main-content {
        margin-right: var(--right-sidebar-width);
    }
    
    .main-wrapper:has(.right-sidebar.collapsed) .main-content,
    .main-content.right-sidebar-collapsed {
        margin-right: 0;
    }
}

/* iframe容器样式 */
.iframe-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.iframe-tabs-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    height: 100%;
}

.iframe-tabs-content iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-primary);
    display: block;
    /* 确保iframe不会超出容器 */
    max-width: 100%;
}

.iframe-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.iframe-loading.hidden {
    display: none;
}

/* 网址导航容器 */
.nav-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
}

/* 右侧命令栏样式 */
.right-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: var(--footer-height);
    width: var(--right-sidebar-width);
    background: var(--bg-secondary);
    border-left: none;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

/* 右侧栏header */
.right-sidebar-header {
    height: var(--header-height);
    padding: 0 16px;
    background: var(--primary);
    border-bottom: 1px solid var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* 右侧栏内容区域 */
.right-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.right-sidebar.collapsed {
    display: none !important;
}

.right-sidebar-title {
    font-size: 14px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}

.right-sidebar-toggle {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--transition-fast);
}

.right-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.right-sidebar.collapsed .right-sidebar-toggle i {
    transform: rotate(180deg);
}

.right-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.right-sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.right-sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.right-sidebar-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    text-align: left;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.right-sidebar-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding-left: 10px;
}

.right-sidebar-item.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-light);
    border-left: 2px solid var(--primary);
    padding-left: 4px;
}

.right-sidebar-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.right-sidebar-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    opacity: 0.8;
}

/* 三级分类侧边栏样式 */
.tertiary-sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    min-width: 120px;
    max-width: 150px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.tertiary-sidebar-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
    text-align: left;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tertiary-sidebar-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tertiary-sidebar-item.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-light);
}

.tertiary-sidebar-item i {
    width: 14px;
    text-align: center;
    font-size: 12px;
    opacity: 0.8;
}

/* 命令分类样式 */
.command-category {
    margin-bottom: 16px;
}

.command-category-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 8px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.command-category-title::before {
    display: none;
}

.command-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.command-item {
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.command-item:hover {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.command-item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-item-name::before {
    display: none;
}

.command-item-content {
    display: none;
}

.command-item.copied {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.2);
}

.command-item.copied .command-item-name {
    color: var(--success);
}

/* 命令编辑按钮样式 */
.cmd-cat-edit-actions,
.cmd-item-edit-actions {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
    vertical-align: middle;
}

.command-category-title .edit-btn.add-item {
    font-size: 10px;
    padding: 1px 4px;
    margin-left: 2px;
}

.command-category-title .edit-actions .edit-btn,
.command-category-title .edit-btn.add-item {
    padding: 2px 6px;
    min-width: 22px;
    min-height: 20px;
    border-radius: 3px;
    cursor: pointer;
}

.command-add-category {
    text-align: center;
}

.command-add-category .add-cat-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    gap: 4px;
    transition: all var(--transition-fast);
}

.command-add-category .add-cat-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

/* 右侧边栏精简模式 */
.right-sidebar.compact-mode .right-sidebar-content {
    padding: 6px;
}

.right-sidebar.compact-mode .command-category {
    margin-bottom: 8px;
}

.right-sidebar.compact-mode .command-category-title {
    font-size: 10px;
    padding: 4px 2px;
    letter-spacing: 0;
}

.right-sidebar.compact-mode .command-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.right-sidebar.compact-mode .command-item {
    padding: 3px 4px;
    border-radius: 3px;
    min-height: 22px;
}

.right-sidebar.compact-mode .command-item-name {
    font-size: 10px;
}

.right-sidebar.compact-mode .command-item-name span {
    width: 5px;
    height: 5px;
}

/* 底部栏样式 - 适应左边栏 */
.bottom-footer {
    position: fixed;
    bottom: 0;
    left: 130px;
    right: 0;
    height: var(--footer-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 150;
    transition: left 0.3s ease, right 0.3s ease;
}

.bottom-footer.sidebar-collapsed {
    left: 50px;
}

.bottom-footer.right-sidebar-open {
    right: var(--right-sidebar-width);
}

.bottom-footer.hidden {
    transform: translateY(100%);
}

.footer-left,
.footer-center,
.footer-right {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-center {
    flex: 1;
    justify-content: center;
    overflow-x: auto;
}

.footer-center::-webkit-scrollbar {
    height: 0;
}

.footer-tool-btn {
    width: calc(var(--footer-height) - 8px);
    height: calc(var(--footer-height) - 8px);
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--footer-height) / 2.5);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.footer-tool-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
}

/* 底栏边栏切换按钮 - 绿色 */
.sidebar-toggle-btn {
    background: var(--success);
    color: white;
}

.sidebar-toggle-btn:hover {
    background: var(--success);
    opacity: 0.9;
    color: white;
}

.footer-copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.footer-copy-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.footer-copy-btn.copied {
    border-color: var(--success);
    color: var(--success);
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.footer-info i {
    font-size: 10px;
}

/* IP地址点击效果 */
#ip-address {
    transition: all 0.2s ease;
}

#ip-address:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* 底栏倒计时 */
.footer-countdown {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin: 0 4px;
}

.footer-countdown i {
    font-size: 10px;
    color: var(--warning);
}

/* 底栏计时器 */
.footer-timer {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin: 0 4px;
}

.footer-timer i {
    font-size: 10px;
}

/* 底栏按钮状态 */
.footer-tool-btn.active {
    background: var(--success);
    color: white;
}

.footer-tool-btn.inactive {
    background: var(--error);
    color: white;
}

.footer-tool-btn.hidden-state {
    background: var(--warning);
    color: white;
}

/* 复制成功提示 */
.copy-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.copy-toast.show {
    opacity: 1;
    visibility: visible;
}

/* 响应式适配 - 工具箱 */
@media (max-width: 1200px) {
    .main-wrapper {
        grid-template-columns: 130px 1fr;
    }
    
    .main-wrapper:has(.sidebar.collapsed) {
        grid-template-columns: 50px 1fr;
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .right-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: var(--footer-height);
        transform: translateX(100%);
        z-index: 200;
    }
    
    .right-sidebar.open {
        transform: translateX(0);
    }
    
    .right-sidebar.collapsed {
        display: none !important;
    }

    .right-sidebar.collapsed .right-sidebar-content {
        display: none;
    }
    
    .header-menus {
        display: none;
    }
}

@media (max-width: 1024px) {
    .main-wrapper {
        padding-top: 78px;
    }
    
    .top-header {
        padding: 0 12px;
    }
    
    .header-logo span {
        display: none;
    }
    
    .bottom-footer {
        padding: 0 8px;
    }
    
    .footer-center {
        display: none;
    }
}

@media (max-width: 768px) {
    .top-header {
        height: 30px;
    }
    
    .main-wrapper {
        padding-top: 30px;
        padding-bottom: 28px;
    }
    
    .bottom-footer {
        height: 28px;
    }
    
    .footer-right {
        display: none;
    }
    
    .right-sidebar {
        top: 30px;
        bottom: 28px;
    }
}

/* 移动端额外优化 */
@media (max-width: 640px) {
    /* 网址卡片优化 */
    .sites-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .site-card {
        padding: 12px;
    }

    .site-icon {
        width: 36px;
        height: 36px;
    }

    .site-icon img {
        width: 20px;
        height: 20px;
    }

    .site-title {
        font-size: 14px;
    }

    .site-desc {
        font-size: 12px;
        -webkit-line-clamp: 1;
    }

    /* 搜索框优化 */
    .header-search {
        max-width: 200px;
    }

    .search-box input {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* 侧边栏优化 */
    .sidebar {
        width: 100%;
        max-width: 280px;
    }

    .nav-item {
        padding: 10px 16px;
    }

    /* 分类标签优化 */
    .sub-nav-tabs {
        gap: 4px;
    }

    .sub-nav-tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* 模态框优化 */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        padding: 16px;
    }

    /* 工具箱优化 */
    .toolbox-container {
        padding: 8px;
    }

    .toolbox-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .toolbox-item {
        padding: 12px 8px;
    }

    /* 按钮优化 */
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* 触摸优化 */
    .nav-item,
    .site-card,
    .btn,
    .sub-nav-tab {
        min-height: 44px;
    }

    /* 防止缩放 */
    input, select, textarea {
        font-size: 16px;
    }
}

/* 小屏幕手机优化 */
@media (max-width: 375px) {
    .sites-grid {
        gap: 6px;
    }

    .site-card {
        padding: 10px;
    }

    .header-search {
        max-width: 160px;
    }

    .toolbox-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        max-height: 100vh;
        overflow-y: auto;
    }

    .modal-overlay {
        align-items: flex-start;
        padding-top: 20px;
    }
}

/* ==================== 精简显示模式 ==================== */
.compact-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
}

/* 精简模式下有三级侧边栏时，切为1列布局（内容区变窄，2列太挤） */
.compact-grid.has-tertiary-sidebar {
    grid-template-columns: 1fr !important;
}

@media (max-width: 768px) {
    .compact-grid {
        grid-template-columns: 1fr !important;
    }
}

.compact-group {
    margin-bottom: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px 10px;
    transition: border-color var(--transition-fast);
}

.compact-group:hover {
    border-color: rgba(16, 185, 129, 0.2);
}

.compact-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 0 6px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    border-left: 2px solid var(--primary);
    border-radius: 0;
    margin-bottom: 6px;
    line-height: 1.4;
    letter-spacing: 0.3px;
}

.compact-group-count {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: auto;
    background: var(--bg-tertiary);
    padding: 0 5px;
    border-radius: 8px;
    line-height: 1.6;
}

.compact-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
}

.compact-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    transition: all var(--transition-fast);
    position: relative;
    line-height: 1.5;
    max-width: 200px;
}

.compact-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
}

.compact-item:active {
    transform: translateY(0);
    box-shadow: none;
}

.compact-icon {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity var(--transition-fast);
}

.compact-item:hover .compact-icon {
    opacity: 1;
}

.compact-name {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    transition: color var(--transition-fast);
}

.compact-fav {
    color: #f59e0b;
    font-size: 7px;
    position: absolute;
    top: 1px;
    left: 3px;
    filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4));
}

.compact-hot {
    font-size: 8px;
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    text-shadow: 0 0 4px rgba(245, 158, 11, 0.3);
}

[data-theme="light"] .compact-group {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .compact-group:hover {
    border-color: rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .compact-item {
    background: #f5f5f5;
    border-color: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

[data-theme="light"] .compact-item:hover {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}

[data-theme="light"] .compact-group-count {
    background: #eee;
}

/* ==================== 前端编辑模式 ==================== */

/*
 * 编辑模式核心原则：编辑模式下元素获得 edit-active 类，
 * 但编辑操作按钮默认全部隐藏，仅 hover/focus 时才显示
 */

/* 编辑模式切换按钮 - 精致圆形 */
.edit-mode-toggle {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    margin-left: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
    position: relative;
}
.edit-mode-toggle:hover {
    color: var(--primary);
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
    opacity: 1;
    transform: scale(1.05);
}
.edit-mode-toggle.active {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
    opacity: 1;
    animation: glow-edit 2.5s ease-in-out infinite;
}
@keyframes glow-edit {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.25); }
    50% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0); }
}
.sidebar.collapsed .edit-mode-toggle {
    display: none;
}

/* ========== 编辑按钮显隐完全由JS控制，CSS不设置display ========== */
.edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
    transition: all 0.2s;
    line-height: 1;
}
.edit-btn:hover {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.15);
}
.edit-btn.del-cat:hover,
.edit-btn.del-item:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}
.edit-btn.add-sub:hover,
.edit-btn.add-item:hover {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
}

/* 侧边栏编辑模式下的分类按钮 */
.nav-item.edit-active {
    display: flex;
    align-items: center;
    padding-right: 4px;
    position: relative;
}
.nav-item.edit-active .nav-badge {
    margin-right: 0;
}
/* 一级分类编辑按钮 - 下方弹出卡片 */
.nav-item.edit-active .cat-edit-actions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--bg-secondary, #1e2533);
    border-radius: 0 0 6px 6px;
    padding: 4px 6px;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    justify-content: center;
    gap: 4px;
    border-top: 1px solid var(--border-color);
}
.nav-item.edit-active .cat-edit-actions .edit-btn {
    padding: 3px 6px;
    font-size: 11px;
    border-radius: 4px;
}

/* 精简模式 - 分类组标题添加按钮 - 显隐由JS控制 */
.compact-group-title .edit-btn.add-item {
    font-size: 11px;
    padding: 1px 5px;
    margin-left: 6px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
}
.compact-group-title .edit-btn.add-item:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

/* ========== 二级分类（tab-item）编辑按钮样式 ========== */
.tab-item [class*="edit-actions"] .edit-btn {
    padding: 1px 3px;
    font-size: 9px;
}

/* ========== 三级/四级分类（tertiary-sidebar）编辑按钮 - hover时才显示 ========== */
.tertiary-sidebar-item.edit-active {
    display: flex;
    align-items: center;
}
.tertiary-sidebar-item [class*="edit-actions"] .edit-btn {
    padding: 1px 3px;
    font-size: 9px;
}

/* 四级分类样式 */
.tertiary-sidebar-item.level4-item {
    padding-left: 28px;
    font-size: 12px;
    opacity: 0.85;
}
.tertiary-sidebar-item.level4-item:hover {
    opacity: 1;
}

/* 精简模式 - 网址项编辑按钮 - 内联显示 */
.compact-item .item-edit-actions {
    display: inline-flex;
    margin-left: 4px;
    gap: 2px;
    vertical-align: middle;
}
.compact-item .item-edit-actions .edit-btn {
    color: var(--text-muted);
    padding: 2px 4px;
    font-size: 10px;
    border-radius: 3px;
}
.compact-item .item-edit-actions .edit-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
}
.compact-item .item-edit-actions .edit-btn.del-item:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* 普通模式 - 网址卡片编辑按钮 - hover时在标题后内联显示 */
.site-card-wrapper.edit-active {
    position: relative;
}
.site-title .item-edit-actions {
    display: none !important;
    margin-left: 6px;
    gap: 2px;
    vertical-align: middle;
}
.site-title .item-edit-actions .edit-btn {
    padding: 1px 4px;
    font-size: 10px;
    border-radius: 3px;
}
.site-title .item-edit-actions .edit-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
}
.site-title .item-edit-actions .edit-btn.del-item:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* ========== 编辑模态框 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal.show,
.modal.show {
    display: flex;
}

.edit-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.edit-modal-header h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin: 0;
}
.edit-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.edit-modal-close:hover {
    color: var(--text-primary);
}

.edit-modal-body {
    padding: 20px;
}

.edit-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

.edit-btn-cancel {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.edit-btn-cancel:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.edit-btn-primary {
    padding: 8px 20px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.edit-btn-primary:hover {
    background: var(--primary-dark);
}

/* 表单样式 */
.edit-form-group {
    margin-bottom: 14px;
}
.edit-form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.edit-form-group input,
.edit-form-group select,
.edit-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.edit-form-group input:focus,
.edit-form-group select:focus,
.edit-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.edit-form-group textarea {
    resize: vertical;
    min-height: 50px;
}

.edit-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.edit-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}
.edit-checkbox-label input[type="checkbox"] {
    width: auto;
}

/* 图标选择字段 */
.icon-picker-field {
    display: flex;
    gap: 6px;
    align-items: center;
}
.icon-picker-field input {
    flex: 1;
}
.icon-pick-btn {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.2s;
}
.icon-pick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.icon-preview-i {
    font-size: 18px;
    color: var(--primary);
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

/* ========== 图标选择器 ========== */
.icon-picker-search {
    margin-bottom: 12px;
}
.icon-picker-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    box-sizing: border-box;
}

.icon-picker-layout {
    display: flex;
    gap: 10px;
    height: 400px;
}

.icon-picker-sidebar {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.icon-sidebar-tab {
    display: block;
    padding: 5px 8px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
}
.icon-sidebar-tab:hover {
    color: var(--primary);
    background: var(--bg-hover);
}
.icon-sidebar-tab.active {
    background: var(--primary);
    color: #fff;
}

.icon-picker-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 6px;
}
.icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.icon-item:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
    transform: scale(1.05);
}
.icon-item.selected {
    background: var(--primary);
    border-color: var(--primary-dark);
}
.icon-item.selected i,
.icon-item.selected span {
    color: #fff;
}
.icon-item i {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 3px;
}
.icon-item span {
    font-size: 9px;
    color: var(--text-muted);
    word-break: break-all;
    line-height: 1.1;
}

/* 拖拽排序样式 */
.sortable-ghost {
    opacity: 0.4;
    background: rgba(16, 185, 129, 0.15) !important;
}
.sortable-drag {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 通知Toast */
.toast-notification {
    animation: toastSlideIn 0.3s ease-out;
}
@keyframes toastSlideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 亮色主题编辑模式 */
[data-theme="light"] .edit-modal-content {
    background: #fff;
    border-color: #e5e5e5;
}
[data-theme="light"] .edit-form-group input,
[data-theme="light"] .edit-form-group select,
[data-theme="light"] .edit-form-group textarea {
    background: #f5f5f5;
    border-color: #e5e5e5;
    color: #1a1a1a;
}
[data-theme="light"] .icon-picker-search input,
[data-theme="light"] .icon-sidebar-tab,
[data-theme="light"] .icon-item {
    background: #f5f5f5;
    border-color: transparent;
}
[data-theme="light"] .icon-item:hover {
    border-color: var(--primary);
}
[data-theme="light"] .icon-item i {
    color: var(--primary);
}
[data-theme="light"] .compact-item .item-edit-actions {
    background: transparent;
}
[data-theme="light"] .edit-mode-toggle {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}
