/* css/style.css */
@import url("/css/gridstack.min.css");

/* =========================================
   1. 基础布局 (网页流式布局 - 核心修改)
   ========================================= */
/* 1. 根元素与 Body 设置 */
html {
    /* 强制垂直滚动条，防止页面跳动 */
    overflow-y: scroll; 
}
/* 允许主窗口滚动 */
body { 
    /* 核心修复：必须设为 visible 或 clip，绝不能用 hidden/auto，否则 sticky 失效 */
    overflow: visible !important; 
    
    /* 替代 overflow-x: hidden 的方案，防止横向溢出 */
    width: 100%;
    max-width: 100vw;
    
    min-height: 100vh; 
    margin: 0; 
    padding: 0; 
    display: flex; 
    flex-direction: column; 
    position: relative;
}

/* 2. 头部样式：随页面滚动 (普通文档流) */
.site-header {
    background-color: var(--card-background);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-lg) var(--spacing-md); 
    text-align: center;
    position: relative; 
    z-index: 5000; 
}

/* 3. 主内容包裹层：确保 overflow 为 visible */
#main-wrapper {
    flex: 1; 
    position: relative; 
    z-index: 1; 
    height: auto !important; 
    /* 核心修复：必须 visible，让内部的 sticky 元素能感知到窗口滚动 */
    overflow: visible !important; 
}

/* 4. 视图容器 */
.app-view {
    height: auto !important;
    /* 核心修复：同上 */
    overflow: visible !important; 
    padding-bottom: 20px;
}

/* GridStack 容器适配 */
.grid-stack { 
    overflow: visible !important; 
    max-width: 1600px; 
    margin: 0 auto; 
    transition: padding 0.3s; 
}

/* 5. 搜索栏/功能区 - 增强吸附配置 */
.controls-container {
    /* 开启吸附 */
    position: -webkit-sticky; /* Safari */
    position: sticky;       
    
    /* 吸附阈值：0 表示紧贴浏览器窗口顶部 */
    top: 0; 
    
    /* 层级：低于模态框(9999)，高于普通内容(1) */
    z-index: 4000; 
    
    /* 视觉样式 */
    width: 100%;
    max-width: 1200px; 
    margin: 0 auto; 
    background-color: rgba(255, 255, 255, 0.95); /* 提高不透明度，防止文字重叠 */
    backdrop-filter: blur(10px); /* 毛玻璃效果 */
    -webkit-backdrop-filter: blur(10px);
    
    padding: var(--spacing-md); 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); /* 增加阴影，增强层次感 */
    
    /* 底部圆角：吸顶时去掉圆角会更自然，这里保留圆角看个人喜好 */
    border-bottom-left-radius: var(--border-radius-lg); 
    border-bottom-right-radius: var(--border-radius-lg); 
    
    display: flex; 
    flex-direction: column; 
    gap: var(--spacing-md);
    box-sizing: border-box; 
    transition: background-color 0.3s, box-shadow 0.3s;
}

/* 深色模式适配 */
body.dark-theme .controls-container {
    background-color: rgba(30, 30, 30, 0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* 页脚：随内容流排布 */
.site-footer { 
    background-color: var(--card-background); 
    border-top: 1px solid var(--border-color); 
    text-align: center; 
    padding: var(--spacing-lg); 
    color: var(--text-secondary-color); 
    font-size: 0.9rem; 
    margin-top: auto; 
    position: relative;
    z-index: 10;
}

/* iframe 高度适配 */
.tab-iframe {
    width: 100%;
    min-height: calc(100vh - 150px); 
    border: none;
    display: none;
    background: #fff;
}
.tab-iframe.active {
    display: block;
}

/* =========================================
   2. 通知中心与头部组件
   ========================================= */
.header-actions,
.notification-wrapper { 
    position: relative; 
    display: inline-block; 
    margin-left: 8px;
    z-index: auto; 
}

.badge-dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; background: #ef4444;
    border-radius: 50%; border: 2px solid #fff;
    pointer-events: none;
}

/* 下拉菜单 */
.dropdown-menu {
    position: absolute; 
    top: calc(100% + 12px); 
    right: -10px; 
    z-index: 6000 !important; 
    width: 320px;
    background: #fff; 
    border-radius: 12px;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.2); 
    border: 1px solid rgba(0,0,0,0.08);
    display: none; 
    margin-top: 0;
    overflow: hidden;
    transform-origin: top right;
    text-align: left; 
}

.dropdown-menu::before {
    content: "";
    position: absolute; top: -6px; right: 20px;
    width: 12px; height: 12px;
    background: #fff;
    transform: rotate(45deg);
    border-top: 1px solid rgba(0,0,0,0.08);
    border-left: 1px solid rgba(0,0,0,0.08);
    z-index: 6001; 
}

.dropdown-menu.visible { 
    display: block; 
    animation: menuSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes menuSlideIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-header {
    padding: 14px 16px; 
    font-weight: 700; color: #1f2937; font-size: 0.95rem;
    border-bottom: 1px solid #f3f4f6; 
    background: #fff;
    display: flex; justify-content: space-between; align-items: center;
}

.dropdown-content { 
    max-height: 350px; 
    overflow-y: auto; 
    background: #fff;
}
.dropdown-content::-webkit-scrollbar { width: 4px; }
.dropdown-content::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* 通知列表项 */
.notif-item { padding: 16px; border-bottom: 1px solid #f3f4f6; transition: background 0.2s; position: relative; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f9fafb; }
.notif-header { display: flex; align-items: center; margin-bottom: 6px; }
.notif-title { font-size: 0.9rem; color: #111; font-weight: 600; flex: 1; }
.notif-time { font-size: 0.75rem; color: #9ca3af; white-space: nowrap; margin-left: 8px; }
.notif-body { font-size: 0.85rem; color: #4b5563; line-height: 1.8; white-space: pre-wrap !important; margin-top: 6px; }
.notif-tag { display: inline-flex; align-items: center; justify-content: center; padding: 2px 6px; font-size: 0.7rem; border-radius: 4px; margin-right: 8px; font-weight: 600; height: 20px; }
.tag-info { background: #eff6ff; color: #3b82f6; border: 1px solid #dbeafe; }
.tag-warning { background: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; }
.tag-success { background: #f0fdf4; color: #15803d; border: 1px solid #dcfce7; }
.empty-notif { padding: 40px 20px; text-align: center; color: #9ca3af; font-size: 0.9rem; }

/* =========================================
   3. 通用组件与工具栏
   ========================================= */
.search-container { margin: 0; position: relative; }
#search-input { width: 100%; padding: 0.8rem 1rem; font-size: 1rem; border: 1px solid var(--border-color); border-radius: 25px; background-color: var(--background-color); color: var(--text-color); transition: all 0.3s ease; }
#search-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2); }
mark { background-color: var(--primary-color); color: white; padding: 0 3px; border-radius: 3px; }
.tool-categories { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; max-width: 800px; margin: 0 auto; }
.category-btn { padding: 0.5rem 1rem; border: 1px solid var(--border-color); background-color: transparent; color: var(--text-secondary-color); border-radius: 20px; cursor: pointer; transition: all 0.3s ease; }
.category-btn:hover, .category-btn.active { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }

.grid-stack-item-content { background-color: transparent !important; inset: 0 !important; }
main { flex-grow: 1; padding: var(--spacing-xl) var(--spacing-md) 6rem; position: relative; }
.header-actions { position: absolute; top: 50%; transform: translateY(-50%); right: var(--spacing-md); display: flex; align-items: center; gap: var(--spacing-md); }
.header-btn { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary-color); padding: var(--spacing-sm); border-radius: var(--border-radius-md); cursor: pointer; white-space: nowrap; line-height: 0; transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s; }
.header-btn svg { width: 20px; height: 20px; fill: var(--text-secondary-color); transition: fill 0.3s; }
.header-btn:hover { background-color: var(--background-color); border-color: var(--primary-color); }
.header-btn:hover svg { fill: var(--primary-color); }
.header-btn:focus-visible { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25); }
#save-layout-btn, #reset-layout-btn { display: none; }
.layout-controls { display: flex; gap: var(--spacing-sm); }
body:not(.dark-theme) .moon-icon { display: none; }
body.dark-theme .sun-icon { display: none; }

.view-switcher { display: flex; background-color: var(--background-color); border-radius: var(--border-radius-md); padding: 4px; border: 1px solid var(--border-color); flex-shrink: 0; }
.view-btn { background: none; border: none; padding: 6px; cursor: pointer; border-radius: var(--border-radius-sm); line-height: 0; }
.view-btn svg { width: 20px; height: 20px; fill: var(--text-secondary-color); transition: fill 0.3s; }
.view-btn:hover svg, .view-btn.active svg { fill: var(--primary-color); }
.view-btn.active { background-color: var(--card-background); box-shadow: var(--shadow-sm); }

.grid-stack.editing .grid-stack-item { outline: 2px dashed var(--primary-color); }
.grid-stack-item { animation: card-enter 0.5s ease-out forwards; opacity: 0; transform: translateY(20px); }
@keyframes card-enter { to { opacity: 1; transform: translateY(0); } }

/* =========================================
   4. 工具卡片样式
   ========================================= */
.tool-card { background-color: var(--card-background); border-radius: var(--border-radius-lg); box-shadow: var(--shadow-md); display: flex; flex-direction: column; height: 100%; position: relative; overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease, outline 0.2s; outline: 2px solid transparent; border: none; }
.tool-card.key-focused { outline-color: var(--primary-color); box-shadow: var(--shadow-lg); transform: translateY(-5px); }
.tool-card:focus-visible { outline: 2px solid var(--primary-color); box-shadow: var(--shadow-lg); }
.tool-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.tool-card:hover .card-actions { opacity: 1; visibility: visible; }
.card-content { padding: var(--spacing-lg) var(--spacing-xl); display: flex; flex-direction: column; flex-grow: 1; text-decoration: none; color: inherit; }
.tool-card-header { display: flex; align-items: center; margin-bottom: var(--spacing-lg); }
.tool-card-icon { width: 48px; height: 48px; margin-right: var(--spacing-md); fill: var(--primary-color); flex-shrink: 0; transition: fill 0.3s ease; }
.tool-card-icon svg { width: 48px !important; height: 48px !important; display: block; }
.tool-card-title { font-size: 1.25rem; font-weight: 600; color: var(--text-color); }
.tool-card-description { font-size: 0.9rem; color: var(--text-secondary-color); flex-grow: 1; }
.tool-card-category-tag { position: absolute; top: var(--spacing-md); left: var(--spacing-md); font-size: 0.75rem; font-weight: 500; padding: 2px 8px; border-radius: 10px; color: #fff; }
.card-actions { position: absolute; top: var(--spacing-sm); right: var(--spacing-sm); display: flex; gap: var(--spacing-xs); background-color: rgba(255, 255, 255, 0.7); backdrop-filter: blur(4px); padding: 4px; border-radius: var(--border-radius-md); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.card-action-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 50%; transition: background-color 0.2s; line-height: 0; }
.card-action-btn:hover { background-color: rgba(0, 0, 0, 0.05); }
body.dark-theme .card-action-btn:hover { background-color: rgba(255, 255, 255, 0.1); }
body.dark-theme .card-actions { background-color: rgba(30, 30, 30, 0.7); }
.card-action-btn svg { width: 24px; height: 24px; }
.favorite-btn svg { transition: transform 0.2s, fill 0.2s; }
.favorite-btn.favorited svg { fill: var(--warning-color); transform: scale(1.1); }
.preview-btn svg { fill: var(--text-secondary-color); }

/* 列表模式 */
.grid-stack.list-view .grid-stack-item { position: static !important; width: 100% !important; height: auto !important; margin-bottom: var(--spacing-md); transform: none !important; }
.list-view .tool-card { flex-direction: row; align-items: center; padding: var(--spacing-md); }
.list-view .card-content { flex-direction: row; padding: 0; align-items: center; }
.list-view .tool-card-header { margin-bottom: 0; flex-shrink: 0; }
.list-view .tool-card-icon { width: 40px; height: 40px; }
.list-view .tool-card-title { font-size: 1.1rem; margin-left: var(--spacing-md); }
.list-view .tool-card-description { margin-left: var(--spacing-xl); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.list-view .card-actions { position: static; margin-left: auto; background-color: transparent; padding: 0; opacity: 1; visibility: visible; }
.list-view .tool-card-category-tag { display: none; }

/* 锁住遮罩 */
.lock-overlay { position: absolute; inset: 0; background: rgba(255,255,255,0.95); z-index: 10; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.lock-overlay .lock-icon { width: 40px; fill: #9ca3af; margin-bottom: 8px; }
.lock-text { font-size: 0.9rem; color: #4b5563; font-weight: 600; background: #f3f4f6; padding: 4px 12px; border-radius: 99px; }

/* =========================================
   5. 侧边面板 (设置/帮助)
   ========================================= */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: var(--card-background);
    z-index: 99999 !important;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    visibility: hidden;
}

.side-panel.visible { transform: translateX(0) !important; visibility: visible !important; }

.panel-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99998 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.panel-overlay.visible { opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; }

/* 模态框通用 */
.modal-help { width: 90vw; max-width: 1400px; height: 90vh; }
.modal-help .modal-content { padding: 0; flex-grow: 1; display: flex; }
#help-iframe { width: 100%; height: 100%; border: none; }

/* =========================================
   6. 全局设置 - 样式控制类
   ========================================= */
body.hide-descriptions .tool-card-description { display: none !important; }
body.particles-hidden #particles-js { display: none !important; opacity: 0 !important; }

body.density-compact .tool-card { padding: 12px !important; }
body.density-compact .tool-card-header { margin-bottom: 8px !important; }
body.density-compact .tool-card-icon { width: 32px !important; height: 32px !important; }
body.density-compact .tool-card-title { font-size: 1rem !important; }

/* body.density-spacious .tool-card { padding: 30px !important; }
body.density-spacious .tool-card-title { font-size: 1.4rem !important; } */

/* =========================================
   7. 交互组件
   ========================================= */
/* 上下文菜单 */
.context-menu { position: fixed; background-color: var(--card-background); border-radius: var(--border-radius-md); box-shadow: var(--shadow-lg); padding: var(--spacing-sm) 0; z-index: 1001; opacity: 0; transform: scale(0.95); visibility: hidden; transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s; }
.context-menu.visible { opacity: 1; transform: scale(1); visibility: visible; }
.context-menu ul { list-style: none; padding: 0; margin: 0; }
.context-menu li { padding: var(--spacing-sm) var(--spacing-lg); cursor: pointer; font-size: 0.9rem; color: var(--text-color); }
.context-menu li:hover { background-color: var(--primary-color); color: white; }

/* 搜索结果面板 */
.cmd-palette { position: fixed; top: 20%; left: 50%; transform: translateX(-50%); width: 600px; max-width: 90vw; background: #fff; border-radius: 12px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); z-index: 3000; overflow: hidden; display: none; flex-direction: column; }
.cmd-palette.visible { display: flex; animation: fadeInScale 0.2s ease-out; }
@keyframes fadeInScale { from { opacity: 0; transform: translateX(-50%) scale(0.95); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.cmd-header { display: flex; align-items: center; padding: 16px; border-bottom: 1px solid #e5e7eb; }
.cmd-header svg { fill: #9ca3af; margin-right: 12px; }
#cmd-input { flex: 1; border: none; outline: none; font-size: 1.1rem; color: #1f2937; }
.cmd-esc { font-size: 0.75rem; color: #9ca3af; border: 1px solid #e5e7eb; padding: 2px 6px; border-radius: 4px; }
.cmd-results { max-height: 300px; overflow-y: auto; padding: 8px 0; }
.cmd-item { padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; color: #374151; font-size: 0.95rem; border-left: 3px solid transparent; }
.cmd-item:hover, .cmd-item.selected { background: #f3f4f6; border-left-color: #3b82f6; }
.cmd-item .shortcut { font-size: 0.8rem; color: #9ca3af; }
.cmd-footer { padding: 8px 16px; background: #f9fafb; border-top: 1px solid #e5e7eb; display: flex; gap: 16px; font-size: 0.75rem; color: #6b7280; }
kbd { background: #fff; border: 1px solid #d1d5db; border-radius: 3px; padding: 1px 4px; font-family: monospace; }

/* 标签栏 */
.tabs-bar { display: flex; align-items: center; background: #f1f5f9; padding: 0 16px; height: 40px; border-bottom: 1px solid #e2e8f0; overflow-x: auto; flex-shrink: 0; }
.tab-item { display: flex; align-items: center; gap: 8px; padding: 6px 16px; margin-right: 4px; background: #e2e8f0; color: #64748b; border-radius: 6px 6px 0 0; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; user-select: none; max-width: 200px; }
.tab-item.active { background: #fff; color: #3b82f6; font-weight: 600; box-shadow: 0 -2px 5px rgba(0,0,0,0.02); }
.tab-item:hover:not(.active) { background: #cbd5e1; }
.tab-close { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 12px; margin-left: 4px; }
.tab-close:hover { background: #ef4444; color: #fff; }

/* 用户操作区 */
#user-actions { display: flex; align-items: center; gap: 12px; margin-left: 16px; padding-left: 16px; border-left: 1px solid #e5e7eb; height: 32px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; color: white; font-weight: 600; font-size: 1rem; display: flex; justify-content: center; align-items: center; cursor: pointer; user-select: none; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
#user-actions .btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; border-radius: 6px; color: #4b5563; background: transparent; font-size: 0.9rem; transition: all 0.2s; border: 1px solid transparent; }
#user-actions .btn:hover { background: #eff6ff; color: #2563eb; }

/* 订阅卡片 */
#pricing-content-area { background-color: #f8fafc; padding: 32px; }
.pricing-loading { text-align: center; color: #9ca3af; padding: 50px 0; }
.pricing-section-title { font-size: 1.5rem; font-weight: 700; color: #1f2937; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid #e5e7eb; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; margin-bottom: 32px; }
.pricing-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 24px; display: flex; flex-direction: column; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); transition: all 0.2s ease; }
.pricing-card:hover { transform: translateY(-4px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); border-color: #3b82f6; }
.pricing-card-header h3 { font-size: 1.2rem; font-weight: 600; color: #111827; margin: 0 0 8px; }
.pricing-card-header p { font-size: 0.85rem; color: #6b7280; min-height: 40px; }
.pricing-card-price { margin: 20px 0; font-size: 2.5rem; font-weight: 800; color: #1e40af; }
.pricing-card-price .unit { font-size: 1rem; font-weight: 500; color: #6b7280; margin-left: 4px; }
.pricing-card-features { list-style: none; padding: 0; margin: 0 0 24px; flex-grow: 1; }
.pricing-card-features li { font-size: 0.9rem; color: #4b5563; padding: 6px 0; display: flex; align-items: center; }
.pricing-card-features li::before { content: '✓'; color: #10b981; font-weight: bold; margin-right: 8px; }
.pricing-card-action { margin-top: auto; }
.pricing-btn { display: block; width: 100%; text-align: center; padding: 12px; background: #3b82f6; color: #fff; border-radius: 8px; font-weight: 600; text-decoration: none; transition: background 0.2s; }
.pricing-btn:hover { background: #2563eb; }

/* 个人中心 */
#subscription-list, #my-request-list, #order-list, #login-history-list { max-height: 350px; overflow-y: auto; padding-right: 4px; }
#subscription-list::-webkit-scrollbar, #my-request-list::-webkit-scrollbar { width: 6px; }
#subscription-list::-webkit-scrollbar-thumb, #my-request-list::-webkit-scrollbar-thumb { background-color: #e5e7eb; border-radius: 3px; }
.sub-item, .dev-item, .req-item, .order-item { padding: 16px; border: 1px solid #f1f5f9; border-radius: 8px; margin-bottom: 12px; background: #fff; transition: all 0.2s ease; display: flex; justify-content: space-between; align-items: center; }
.sub-item:hover, .dev-item:hover, .req-item:hover, .order-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.05); border-color: #e2e8f0; transform: translateY(-1px); }
.item-title { font-weight: 600; color: #1f2937; font-size: 0.95rem; margin-bottom: 4px; }
.item-desc { font-size: 0.8rem; color: #64748b; line-height: 1.4; }
.order-no { font-family: 'Consolas', 'Monaco', monospace; background: #f1f5f9; padding: 1px 4px; border-radius: 3px; color: #475569; letter-spacing: 0.5px; }
.status-badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.status-approved { background: #dcfce7; color: #166534; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-rejected { background: #fee2e2; color: #991b1b; }
#login-history-list tr { border-bottom: 1px solid #f1f5f9; }
#login-history-list td { padding: 12px 8px; font-size: 0.85rem; color: #4b5563; }

/* 聊天部分样式 */
.chat-loading-spinner { text-align: center; padding: 10px; font-size: 0.8rem; color: #94a3b8; display: none; width: 100%; }
.chat-loading-spinner i { animation: spin 1s linear infinite; margin-right: 5px; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.chat-room-body { flex: 1; overflow-y: auto; padding: 20px 30px; display: flex; flex-direction: column; height: 0; }
#chat-content-inner { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.msg-row { display: flex; gap: 12px; width: fit-content; max-width: 80%; align-self: flex-start; }
.msg-row.mine { align-self: flex-end !important; margin-left: auto !important; margin-right: 0 !important; flex-direction: row-reverse; }
.msg-row.other { align-self: flex-start !important; margin-right: auto !important; margin-left: 0 !important; flex-direction: row; }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 1px solid #e2e8f0; color: #64748b; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.8rem; }
.msg-row.mine .msg-avatar { background: #3b82f6; color: #fff; border: none; }
.msg-bubble { padding: 10px 14px; border-radius: 12px; font-size: 0.95rem; line-height: 1.5; box-shadow: 0 1px 2px rgba(0,0,0,0.05); position: relative; word-wrap: break-word; white-space: pre-wrap; }
.msg-row.other .msg-bubble { background: #fff; color: #1e293b; border-top-left-radius: 2px; }
.msg-row.mine .msg-bubble { background: #3b82f6; color: #fff; border-top-right-radius: 2px; }
.msg-meta { font-size: 0.7rem; color: #94a3b8; opacity: 0.8; margin-top: 4px; }
.msg-row.mine .msg-meta { text-align: right; }

/* 聊天搜索 */
.search-navigator { position: absolute; top: 80px; right: 20px; z-index: 50; background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-radius: 6px; display: flex; align-items: center; padding: 4px; gap: 4px; font-size: 0.85rem; animation: slideDown 0.2s ease-out; }
.search-nav-count { padding: 0 8px; color: #64748b; border-right: 1px solid #f1f5f9; }
.search-nav-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 4px; color: #334155; transition: all 0.2s; }
.search-nav-btn:hover { background: #f1f5f9; color: #3b82f6; }
.search-highlight { background: #fef08a; color: #854d0e; border-radius: 2px; padding: 0 2px; transition: all 0.3s; }
.search-highlight.active { background: #f97316; color: #fff; box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.2); font-weight: bold; }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 响应式 */
@media (max-width: 1024px) { .header-actions { flex-wrap: wrap; justify-content: flex-end; width: auto; gap: var(--spacing-sm); } .layout-controls { order: 1; } .view-switcher { order: 2; } #settings-btn { order: 3; } .theme-btn { order: 4; } .site-header h1 { font-size: 1.8rem; } }
@media (max-width: 768px) { body { font-size: 15px; } .site-header { padding-left: var(--spacing-md); padding-right: var(--spacing-md); text-align: left; } .site-header h1 { margin-bottom: 0; } .site-header p { display: none; } .header-actions { gap: var(--spacing-sm); } .header-btn { padding: 6px; } #layout-controls { display: none; } .tool-categories { overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; padding-bottom: 10px; } .category-btn { flex-shrink: 0; } .list-view .tool-card-description { display: none; } }
@media (max-width: 480px) { .header-actions { width: auto; position: static; transform: none; margin-top: var(--spacing-md); justify-content: center; } .site-header { text-align: center; } main { padding: var(--spacing-lg) var(--spacing-sm) 4rem; } .controls-container { border-radius: 0; } .tool-card-title { font-size: 1.1rem; } .tool-card-icon { width: 36px; height: 36px; } .list-view .tool-card-title { margin-left: var(--spacing-sm); } }

/* ================================================= */
/* 全局布局修正：解决双滚动条与页脚挤压问题 */
/* ================================================= */

/* 核心逻辑：当打开任何工具时 (tool-active) */
body.tool-active {
    height: 100vh !important;
    overflow: hidden !important; /* 彻底禁用外层主页面的滚轮 */
    display: flex;
    flex-direction: column;
}

/* 当工具打开时，隐藏主平台的页脚，因为它会干扰插件内部的操作 */
body.tool-active .site-footer {
    display: none !important;
}

/* 主容器在工具打开时占据剩余所有高度 */
body.tool-active #main-wrapper {
    flex: 1;
    height: auto !important;
    min-height: 0; /* 允许高度收缩，防止撑破容器 */
    overflow: hidden;
}

body.tool-active .app-view, 
body.tool-active #view-workspace {
    height: 100% !important;
}

/* iframe 必须 100% 充满，并自带滚轮 */
body.tool-active .tab-iframe {
    width: 100%;
    height: 100%;
    border: none;
    overflow: auto; /* 只允许计算插件内部出现滚轮 */
}

/* ------------------------------------------------- */
/* 紧凑模式专属：隐藏 Header 并重新计算高度 */
/* ------------------------------------------------- */

/* 紧凑模式下隐藏页头 */
body.density-compact.tool-active .site-header {
    display: none !important;
}

/* 标准模式（默认）下的高度：100vh - Header(约100px) - Tabs(40px) */
body.tool-active #main-wrapper {
    height: calc(100vh - 140px) !important; 
}

/* 紧凑模式下的高度：100vh - Tabs(40px) */
body.density-compact.tool-active #main-wrapper {
    height: calc(100vh - 40px) !important;
}

/* 优化标签栏高度固定 */
.tabs-bar {
    height: 40px;
    flex-shrink: 0; /* 禁止被压缩 */
}

/* =========================================
   空状态美化样式 (Empty States)
   ========================================= */
.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: #94a3b8; /* 柔和的灰色 */
    width: 100%;
}

.empty-state-icon {
    font-size: 5rem;
    margin-bottom: 24px;
    opacity: 0.2;
    filter: grayscale(1);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 0.95rem;
    max-width: 320px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.empty-state-action {
    padding: 10px 24px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.empty-state-action:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* ================= 伪装搜索框样式修复 ================= */

/* 1. 外观模拟：让 div 看起来像 input */
.fake-search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 25px; /* 圆角 */
    background-color: var(--background-color);
    color: var(--text-secondary-color);
    transition: all 0.3s ease;
    cursor: pointer; /* 鼠标变手型 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none; /* 禁止选中文本 */
    box-sizing: border-box;
}

/* 2. 悬停效果 */
.fake-search-input:hover {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* 3. 内部文字样式 */
.placeholder-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #999;
}

.shortcut-hint {
    font-size: 0.8rem;
    color: #999;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
    white-space: nowrap;
}

/* 4. 深色模式适配 */
body.dark-theme .fake-search-input {
    background-color: #1e1e1e;
    border-color: #333;
}
body.dark-theme .fake-search-input:hover {
    border-color: #3b82f6;
}

/* --- 1. 彻底隐藏 GridStack 默认的缩放手柄 --- */
.grid-stack-item > .ui-resizable-handle {
    display: none !important; /* 默认完全隐藏 */
}

/* --- 2. 仅在进入“编辑模式”时才显示缩放手柄 --- */
.grid-stack.editing .grid-stack-item > .ui-resizable-handle {
    display: block !important;
    background-image: none !important; /* 去掉默认难看的图标 */
}

/* 我们可以自定义一个漂亮的小三角作为编辑手柄 */
.grid-stack.editing .grid-stack-item > .ui-resizable-handle::after {
    content: "";
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    opacity: 0.5;
}

/* --- 3. 确保卡片操作按钮（预览/收藏）默认隐藏 --- */
.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;           /* 初始透明度为0 */
    visibility: hidden;   /* 初始不可见 */
    transform: translateY(-5px); /* 增加一个轻微位移动画 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
}

/* --- 4. 鼠标悬停时才显示按钮 --- */
.tool-card:hover .card-actions {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* --- 5. 优化“已拥有”标签的间距，避免太贴边 --- */
.card-price-tag {
    bottom: 15px !important;
    right: 15px !important;
    user-select: none;
    pointer-events: none; /* 标签不响应鼠标事件 */
}