/* ========================================================= */
/*       最终美化版的 static/css/style.css (100% 宽度)        */
/* ========================================================= */

/* 全局与主题 */
:root {
    --pico-primary: #1095c1;
    --pico-primary-hover: #0d7b9e;
    --pico-primary-focus: rgba(16, 149, 193, 0.25);
    --pico-primary-inverse: #FFF;
    --pico-card-box-shadow: 0 0.125rem 0.5rem rgba(10, 22, 50, 0.05), 0 0.0625rem 0.125rem rgba(10, 22, 50, 0.1);
    --pico-border-radius: 0.5rem;
}

body {
    background-color: #f8f9fa;
}

main.container {
    /* 关键修改：移除最大宽度限制，让它自然地 100% 宽度 */
    max-width: none;
    padding: 2rem 2rem; /* 左右增加一些边距 */
}

/* 在大屏幕上给一点边距，防止内容贴边 */
@media (min-width: 1200px) {
    main.container {
        padding: 2rem 4rem;
    }
}

/* 头部 */
header h1 a {
    text-decoration: none;
    color: var(--pico-h1-color);
    transition: color 0.2s;
}
header h1 a:hover {
    color: var(--pico-primary);
}

/* 卡片样式 */
article, section {
    margin-bottom: 2.5rem;
}
article {
    padding: 1.5rem 2rem;
    background-color: #fff;
    border: none;
    box-shadow: var(--pico-card-box-shadow);
}

/* --- 书签列表美化 --- */
.bookmark-category-group {
    margin-bottom: 2rem;
}
.bookmark-category-title {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    font-size: 1.25rem;
    font-weight: 600;
}

#bookmarks-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

#bookmarks-list li {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #fff;
    border-radius: var(--pico-border-radius);
    box-shadow: var(--pico-card-box-shadow);
    transition: all 0.2s ease-in-out;
}

#bookmarks-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 1rem rgba(10, 22, 50, 0.08);
}

.bookmark-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden; /* 防止内容溢出 */
    flex-grow: 1;
}

.bookmark-content a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--pico-h1-color);
    text-decoration: none;
    overflow: hidden;
}

.bookmark-content a:hover .bookmark-name {
    color: var(--pico-primary);
}

.bookmark-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.favicon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 4px;
    object-fit: contain;
}

/* 关键布局：将元数据和按钮放在一起 */
/* --- 这是悬浮面板的核心逻辑 --- */
.meta-and-actions {
    /* 1. 绝对定位，脱离文档流 */
    position: absolute;
    bottom: 100%; /* 定位到 li 的顶部 */
    left: 50%;     /* 水平居中 */
    transform: translateX(-50%) translateY(10px); /* 向上移动并调整水平居中 */
    
    /* 2. 外观样式 */
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: #374151; /* 深色背景 */
    color: #f3f4f6;            /* 浅色文字 */
    border-radius: var(--pico-border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    white-space: nowrap;
    z-index: 20; /* 确保在最顶层 */
    
    /* 3. 默认隐藏 */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out, visibility 0.2s;
}

/* 4. 悬浮在 li 上时，显示面板 */
#bookmarks-list li:hover .meta-and-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0); /* 向上移动的动画效果 */
}

/* 5. 新增：用伪元素创建一个小三角指示器 */
.meta-and-actions::after {
    content: '';
    position: absolute;
    top: 100%; /* 定位到面板的底部 */
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent; /* 创建一个向上的三角形 */
}


.meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--pico-secondary);
    white-space: nowrap;
    /* 默认隐藏元数据，悬浮时显示 */
    opacity: 0;
    transition: opacity 0.2s;
}

#bookmarks-list li:hover .meta {
    opacity: 1;
}

.actions {
    display: flex;
}

.actions button {
    padding: 0.2rem;
    background: transparent;
    border: none;
    color: var(--pico-secondary);
    opacity: 0.5;
    transition: all 0.2s;
}

#bookmarks-list li:hover .actions button {
    opacity: 1;
}

.actions button:hover {
    color: var(--pico-primary);
    transform: scale(1.15);
}

/* --- 思维导图样式 (保持不变) --- */
#mindmap-container {
    width: 100%;
    height: 100vh;
    display: none;
    position: relative;
    border: 1px solid var(--pico-muted-border-color);
    background-color: #fff;
    border-radius: var(--pico-border-radius);
    box-shadow: var(--pico-card-box-shadow);
    margin-top: 1rem;
    overflow: hidden;
}
#mindmap-container .markmap, #mindmap-container svg {
    width: 100%;
    height: 100%;
    display: block;
}

.danger-modal {
    border: 1px solid var(--pico-del-color, #d32f2f);
}
.danger-modal header {
    background-color: var(--pico-del-color, #d32f2f);
    color: white;
}
.danger-modal header .close {
    color: white;
}


/* 页脚样式 */
#site-footer {
    text-align: center;
    margin-top: auto;
    padding-top: var(--spacing-medium);
    font-size: 9pt;
    color: var(--color-muted);
    font-style: italic;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
  }

#add-bookmark-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    
    /* 1. 背景半透明：使用 RGBA 颜色值 (Pico Primary Color #1095c1 对应的 RGBA) */
    /* 这会让背景半透明，但 "+" 号保持不透明，效果更好 */
    background-color: rgba(16, 149, 193, 0.75); 
    
    color: var(--pico-primary-inverse); /* "+" 号的颜色，通常是白色 */
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 1000;
    
    /* 2. 完美居中：使用 Flexbox 代替 line-height */
    display: flex;
    justify-content: center; /* 水平居中 */
    align-items: center;    /* 垂直居中 */
    
    font-size: 1.75rem;
    /* 旧的 line-height 和 text-align 已经不再需要 */

    /* 过渡动画保持不变 */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#add-bookmark-fab:hover {
    /* 悬浮时，背景变为完全不透明，提供清晰反馈 */
    background-color: var(--pico-primary-hover); /* 这是 Pico 的悬浮颜色变量 */
    
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
/* --- 书签列表过滤器美化 --- */
.filters.grid {
    align-items: stretch; /* 关键：让网格中的所有项目高度都一样！ */
    gap: 0.75rem;       /* 稍微减小间距，让它们更紧凑 */
}

/* 确保所有过滤器内的元素垂直居中，并有统一的外观 */
.filters.grid > * {
    margin: 0; /* 移除 Pico.css 可能带来的默认 margin */
}

/* --- 新增：危险操作的轮廓按钮样式 --- */
button.danger-outline {
    /* 继承 Pico.css 的变量系统，实现风格统一 */
    --pico-color: var(--pico-del-color, #d32f2f);
    --pico-border-color: var(--pico-del-color, #d32f2f);
    
    background-color: transparent; /* 透明背景 */
    color: var(--pico-color);      /* 红色文字 */
    border-width: var(--pico-border-width);
    padding: var(--pico-form-element-padding-vertical) var(--pico-form-element-padding-horizontal);
    border-radius: var(--pico-border-radius);
    font-weight: var(--pico-font-weight);
    transition: all var(--pico-transition);
}

/* 鼠标悬浮时的效果：背景变红，文字变白 */
button.danger-outline:hover {
    --pico-color: var(--pico-primary-inverse); /* 白色文字 */
    background-color: var(--pico-del-color, #d32f2f);
    border-color: var(--pico-del-color, #d32f2f);
}

#bookmarks-count-title {
    /* 这是您最需要的：在标题上方创建足够的空间 */
    margin-top: 2rem; 

    /* 同时在标题下方也增加一些空间，避免紧贴下面的列表 */
    margin-bottom: 1rem; 
    
    /* 优化一下字体，让它看起来像个合适的副标题 */
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--pico-h2-color);
}


/* --- 自定义下拉菜单样式 --- */
.custom-select-container {
    position: relative; /* 关键：为绝对定位的下拉列表提供参照 */
    width: 100%;
}

/* 模拟输入框的按钮 */
#category-filter-trigger {
    width: 100%;
    text-align: left; /* 文字靠左，像输入框一样 */
    display: flex;
    justify-content: space-between; /* 文字和箭头分开 */
    align-items: center;
    margin: 0; /* 覆盖 Pico 的默认按钮 margin */
    padding-right: 2.5rem; /* 为箭头留出空间 */
}

/* 在按钮上模拟下拉箭头 */
#category-filter-trigger::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0.3em 0.3em 0 0.3em;
    border-color: var(--pico-h1-color) transparent transparent transparent;
    position: absolute;
    right: 1rem;
    pointer-events: none; /* 让点击能穿透箭头 */
}

/* 下拉选项列表的容器 */
.custom-select-options {
    position: absolute;
    top: calc(100% + 4px); /* 在按钮下方显示，留一点空隙 */
    left: 0;
    width: 100%;
    background-color: var(--pico-card-background-color);
    border: 1px solid var(--pico-form-element-border-color);
    border-radius: var(--pico-border-radius);
    box-shadow: var(--pico-card-box-shadow);
    list-style: none;
    padding: 0.5rem;
    margin: 0;
    z-index: 1010; /* 确保在其他元素之上 */
    max-height: 300px;
    overflow-y: auto;
}

/* 列表中的每一项 */
.custom-select-options li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: var(--pico-border-radius);
    transition: background-color 0.2s;
}

.custom-select-options li:hover {
    /* 使用纯色背景，而不是半透明的 focus 颜色 */
    background-color: var(--pico-primary);
    /* 同时，将文字颜色变为白色，以保证对比度 */
    color: var(--pico-primary-inverse); 
}
/* 列表项中的删除按钮 */
.custom-select-options .delete-option-btn {
    background: transparent;
    border: none;
    color: #ff0000; /* 删除按钮的颜色 */
    padding: 0 0.25rem;
    margin-left: 1rem;
    font-size: 1.2rem;
    line-height: 1;
    opacity: 0.5;
    transition: all 0.2s;
}

.custom-select-options .delete-option-btn:hover {
    opacity: 1;
    color: #d32f2f;
    transform: scale(1.2);
}
/* 使用更具体的选择器来确保样式覆盖 */
.custom-select-options li:hover,
.custom-select-options li:focus-within {
    background-color: var(--pico-primary) !important; /* 使用 !important 强制生效 */
    color: var(--pico-primary-inverse) !important;
}

/* 确保 li 内部的按钮在悬浮时颜色也正确 */
.custom-select-options li:hover .delete-option-btn {
    color: var(--pico-primary-inverse) !important;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc; /* 默认灰色 (检测中) */
    margin-right: 0.75rem;
    flex-shrink: 0; /* 防止被压缩 */
    animation: pulse 2s infinite ease-in-out; /* 检测中的动画 */
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.status-dot.online {
    background-color: #28a745; /* 绿色 */
    animation: none; /* 检测完成，停止动画 */
}

.status-dot.offline {
    background-color: #dc3545; /* 红色 */
    animation: none; /* 检测完成，停止动画 */
}
.status-dot.lan {
    background-color: #007bff; /* 蓝色 */
    animation: none;
}




