/* ---------------------------------- */
/* 全局设置 & 字体 */
/* ---------------------------------- */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---------------------------------- */
/* 背景渐变 (Lele-Panel 风格的核心) */
/* ---------------------------------- */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(
        135deg,
        #0f1c3a 0%,    /* 深海蓝 (左上角) */
        #1a335c 45%,    /* 灰蓝 */
        #3b669e 100%    /* 亮蓝 (右下角) */
    );
    opacity: 0.95;
    filter: brightness(0.9);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 50px;
    text-align: center;
}

/* ---------------------------------- */
/* 头部 & 时间 */
/* ---------------------------------- */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 40px;
	flex-wrap: nowrap; /* 确保不换行 */
}

.title {
    font-size: 3em;
    font-weight: 300;
    letter-spacing: 2px;
    margin: 0;
	white-space: nowrap; /* 防止标题换行 */
}

.pipe {
    position: static; /* 移除 absolute 定位，回到文档流 */
    text-align: left; /* 保持与标题对齐 */
	font-size: 3em;
    opacity: 1;
    margin-left: 10px;
	margin-right: 10px;
	color: green;	
}

.datetime {
    position: relative;
    text-align: left;
    font-size: 0.9em;
    opacity: 0.8;
}

#time {
    display: block;
    font-size: 2em;
    font-weight: 200;
}

.admin-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2em;
    cursor: pointer;
    transition: opacity 0.3s ease, background 0.2s;
    z-index: 10;
    opacity: 0; /* 默认透明 */
}

/* 鼠标悬停在 .datetime 区域时，显示 .admin-toggle */
.datetime:hover .admin-toggle {
    opacity: 1; /* 鼠标放在.datetime 区域时显示.admin-toggle */
}

/* 按钮自身悬停效果 */
.admin-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
	opacity: 1; /* 鼠标放上去时完全显示 */
}

/* ---------------------------------- */
/* 搜索栏 - 核心修改区域 */
/* ---------------------------------- */
.search-bar {
    /* 核心修改：改为垂直 Flex 布局 */
    display: flex;
    flex-direction: column; 
    align-items: center; /* 居中对齐 */
    width: 100%; 
    max-width: 700px; /* 限制宽度 */
    margin: 30px auto 50px auto; /* 确保居中和底部间距 */
    padding: 0 15px;
}

.search-bar form {
    /* 确保 form 占据容器宽度 */
    width: 100%;
    /* 移除 searchInput 的圆角切割 */
    display: flex; 
}

/* 搜索框样式 */
#searchInput {
    width: 100%;
    /* 移除最大宽度限制，让它填充 .search-bar form 的宽度 */
    /* 修正圆角，现在它是一个完整的圆角矩形 */
    border-radius: 30px; 
    padding: 15px 20px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.1em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    outline: none;
    transition: background 0.3s, box-shadow 0.3s;
    /* 移除不必要的边框 */
    border-right: none; 
}

#searchInput:focus {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* 搜索按钮样式 (在垂直布局下，这个按钮应该不在输入框旁边了，但保留其样式以防您在 HTML 中复用) */
/* ⚠️ 注意：在最新的 HTML 中，您已经移除了这个按钮，此样式可能不再使用。 */
.search-bar button {
    display: none; /* 隐藏不再需要的搜索按钮 */
}


/* 搜索引擎切换标签栏 */
.search-tab {
    /* 确保标签栏在搜索框下方居中 */
    display: flex;
    flex-wrap: wrap; 
    justify-content: center; 
    width: 100%; 
    max-width: 600px; 
    margin-top: 15px; /* 关键：与输入框的垂直间距 */
}

.search-tab .search-link {
    font-size: 0.9em; 
    padding: 5px 10px;
    margin: 0 8px; /* 标签间距 */
    cursor: pointer;
    /* 默认状态 */
    color: #aaa;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    transition: color 0.3s, border-color 0.3s;
}

.search-tab .search-link.active {
    /* 激活状态 */
    color: #c4a1ff; 
    border-bottom: 2px solid #c4a1ff;
    font-weight: bold;
}

.search-tab .search-link:hover {
    color: #ffffff;
}

/* =========================================================================
   Iconfont SVG 兼容性修复 (您原文件末尾的内容，为了兼容性保留)
   ========================================================================= */

/* 确保 Iconfont 的 SVG 能够正确显示 */
.card-icon .iconfont-svg {
    /* 重要：让 SVG 填充父容器 (.card-icon) */
    width: 100%;	
    height: 100%;
    
    /* 图标本身的颜色设置 */
    fill: currentColor;	
    
    /* 调整 SVG 内部元素定位，确保图标居中 */
    vertical-align: -0.15em;	
    overflow: hidden;
}

/* ---------------------------------- */
/* 链接网格 & 分组 (UI 重点) - (其余保持不变) */
/* ---------------------------------- */
.link-group {
    text-align: left;
    margin-bottom: 40px;
}

/* 修正：分组标题，使用 flexbox 让 "+" 紧跟名称 */
.group-title {
    display: flex;	
    align-items: center;	
    
    font-size: 1.5em;
    font-weight: 400;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
    color: #c4a1ff; /* 浅紫色的分组标题 */
}

/* 分组名称本身 */
.group-title span:first-child {
    margin-right: 10px; /* 在分组名称和 "+" 之间留出间隙 */
}

/* 新增：主页分组标题的 "+" 按钮样式 */
.add-link-btn {
    font-size: 1.2em;
    font-weight: bold;
    color: #4CAF50; /* 绿色 */
    cursor: pointer;
    padding: 0 5px;
    transition: color 0.2s, transform 0.2s;
    user-select: none;
	opacity: 0; /* 默认透明 */
}

.add-link-btn:hover {
	opacity: 1; /* 鼠标放上去时完全显示 */
    color: #76ff7a; /* 悬停时变亮 */
    transform: scale(1.1);
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    list-style: none;
    padding: 0;
}

/* 链接卡片容器 */
.links-grid li {
    position: relative; /* 确保链接编辑按钮定位在其内部 */
}

/* 链接卡片 */
.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, background 0.2s, box-shadow 0.2s;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative; /* 链接卡片也需要 relative 来包含浮动按钮 */
}

.link-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* 新增：链接卡片浮动编辑按钮 */
.link-edit-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1em;
    color: #ccc;
    cursor: pointer;
    opacity: 0; /* 默认隐藏 */
    transition: opacity 0.2s, color 0.2s;
    z-index: 10;
}

.link-card:hover .link-edit-btn {
    opacity: 1; /* 鼠标悬停在卡片上时显示 */
}

.link-edit-btn:hover {
    color: #ffc107; /* 悬停时变色 */
}
/* 确保点击齿轮不会触发链接跳转 */
.link-edit-btn:active {
    pointer-events: auto;
}

.card-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.card-name {
    font-size: 1em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.card-url {
    font-size: 0.7em;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ---------------------------------- */
/* 模态框 (管理界面) - (保持不变) */
/* ---------------------------------- */
.modal {
    display: none;	
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #2b2b2b;
    margin: 10% auto;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* 通用输入框样式 (应用于所有模态框内的输入) */
.modal-content input[type="text"],
.modal-content input[type="password"],
.modal-content input[type="number"] {	
    width: 95%;
    padding: 10px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid #555;
    background: #3c3c3c;
    color: white;
    border-radius: 4px;
}

.modal-content button.primary-btn {
    background-color: #6a5acd;
    color: white;
    padding: 10px 15px;
    margin: 8px 0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-content button.primary-btn:hover {
    background-color: #5849a9;
}

.error-message {
    color: #ff6b6b;
    margin-top: 10px;
}

/* ---------------------------------- */
/* 管理面板内部样式 (分组管理) - (保持不变) */
/* ---------------------------------- */

/* 账户/分组管理列表容器 */
#currentGroups, .setting-subsection {
    margin-top: 20px;
    padding-right: 10px;
}

/* 设置“账户管理”区域标题的样式，使其看起来可点击 */
.manager-toggle {
    cursor: pointer;
    color: #4CAF50;	
    font-size: 1.3em;
    padding: 5px 0;
    margin-bottom: 5px;
    transition: color 0.2s ease;
}

.manager-toggle:hover {
    color: #76ff7a;
}

/* 折叠图标的样式 */
.manager-toggle span {
    font-size: 0.8em;
    margin-left: 10px;
    display: inline-block;
    transition: transform 0.3s ease;
}

/* 确保子区域的边距和背景正确 */
.setting-subsection {
    padding: 15px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    margin-top: 10px;
}

/* 分组/链接管理列表项样式 (用于分组管理列表) */
.manage-link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #f0f0f0;
}
.manage-link-item:last-child {
    border-bottom: none;
}

/* 管理按钮 (编辑/删除) 的通用样式 */
.manage-btn {
    margin-left: 8px;
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.manage-btn.edit-btn {
    background-color: #007bff;
    color: white;
}
.manage-btn.delete-btn {
    background-color: #dc3545;
    color: white;
}

/* 新增/编辑分组表单容器的样式 */
#manageGroupForm {
    background-color: #3c3c3c;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

#manageGroupForm h4 {
    margin-top: 0;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
}


/* ---------------------------------------------------- */
/* 新增/编辑链接 浮动模态框样式 (Modal Mini) - (保持不变) */
/* ---------------------------------------------------- */

/* modal-mini 是浮动小窗口的基础样式 */
.modal-mini {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 380px; /* 调整宽度 */
    /* background: rgba(0, 0, 0, 0.7); /* 可以不设背景，让 content-mini 来设置 */
}

/* modal-content-mini 是实际的内容区域 */
.modal-content-mini {
    background: rgba(30, 35, 45, 0.95); /* 深色背景，更贴合主题 */
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5); /* 更深的阴影 */
    border: 1px solid rgba(100, 100, 100, 0.3);
    position: relative;
}

.modal-content-mini h4 {
    color: #fff;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

/* 链接表单的 Fieldset 样式 */
.link-form-fieldset {
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.link-form-fieldset legend {
    color: #8c8c8c;
    padding: 0 10px;
    font-size: 0.9em;
}

/* 确保 label 和 input 在 form-group 中垂直对齐 */
.modal-mini .form-group {
    display: flex; /* 启用 flex 布局 */
    align-items: center;
    margin-bottom: 15px;
}

.modal-mini label {
    color: #ccc;
    font-size: 0.95em;
    min-width: 60px; /* 确保标签对齐 */
    text-align: right;
    padding-right: 10px;
}

/* 输入框样式 (复用管理面板的样式，但确保美观) */
.modal-mini input[type="text"],
.modal-mini input[type="number"],
.modal-mini input[type="password"] {
    flex-grow: 1; /* 让输入框填充剩余空间 */
    background: rgba(255, 255, 255, 0.05); /* 稍微透明的背景 */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f0f0f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s, background 0.3s;
}

.modal-mini input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #007bff; /* 聚焦时使用蓝色强调 */
    outline: none;
}

/* 按钮组样式 */
.form-actions {
    display: flex;
    justify-content: flex-start; /* 左对齐主要按钮 */
    gap: 10px; /* 按钮间距 */
    margin-top: 20px;
}

/* 删除按钮单独靠右 (如果使用 margin-left: auto; 则不需要这个类) */
.delete-btn-small {
    background-color: #dc3545 !important;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9em;
}

.delete-btn-small:hover {
    background-color: #c82333 !important;
}

/* 确保 close-button 样式正确 */
.modal-content-mini .close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s;
}

.modal-content-mini .close-button:hover {
    color: #fff;
}

/* ---------------------------------- */
/* 移动设备适配 */
/* ---------------------------------- */

@media (max-width: 768px) {
    .modal-mini {
        width: 90%;	
    }
}

/* ---------------------------------- */
/* 页脚 (Footer) 样式 - (保持不变) */
/* ---------------------------------- */
footer {
    text-align: center;
    padding: 20px 0;
    width: 100%;
    /* 将页脚定位到视口的底部，确保它始终在页面最下方 */
    position: static;	
    bottom: 0;
    left: 0;
}

.footer-link {
    color: #fff;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 300;
    letter-spacing: 1px;
    opacity: 0.5; /* 默认半透明 */
    transition: opacity 0.3s ease, color 0.3s;
}

/* 鼠标悬停变亮效果 */
.footer-link:hover {
    opacity: 1; /* 鼠标放上去时完全显示 */
    color: #c4a1ff; /* 悬停时使用分组标题的浅紫色，增加主题一致性 */
}

/* 移动端适配：取消固定定位，防止遮挡内容 */
@media (max-width: 768px) {
    footer {
        margin-top: 20px;
        padding: 10px 0;
    }
}

/* ---------------------------------- */
/* 分组拖动排序样式 */
/* ---------------------------------- */

/* 可拖动项的基础样式 */
.manage-link-item.draggable-item {
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.manage-link-item.draggable-item:active {
    cursor: grabbing;
}

/* 拖动时的样式 */
.manage-link-item.dragging {
    opacity: 0.5;
    background: rgba(100, 100, 255, 0.1) !important;
    border: 2px dashed #4CAF50 !important;
}

/* 拖动经过区域的样式 */
.manage-link-item.drag-over {
    background: rgba(76, 175, 80, 0.2) !important;
    border: 2px solid #4CAF50 !important;
    border-radius: 5px;
    transform: scale(1.02);
}

/* 临时消息动画 */
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* 拖动提示文本 */
.manage-link-item::before {
    content: "⋮⋮";
    color: #888;
    margin-right: 10px;
    font-weight: bold;
    cursor: grab;
}

.manage-link-item.dragging::before {
    color: #4CAF50;
}

/* 管理面板标题添加拖动提示 */
#linkManager h3:contains('导航分组管理')::after {
    content: " (可拖动排序)";
    font-size: 0.8em;
    color: #888;
    font-weight: normal;
}

/* 确保管理项在拖动时有足够的视觉反馈 */
.manage-link-item {
    padding: 12px 15px !important;
    margin: 5px 0 !important;
    border: 1px solid transparent !important;
    border-radius: 5px !important;
    transition: all 0.3s ease !important;
}

.manage-link-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ---------------------------------- */
/* 11/29/2025新增：回到顶部按钮样式 */
/* ---------------------------------- */

.scroll-to-top-btn {
    position: fixed; /* 固定在视窗中 */
    bottom: 30px; /* 距离底部 30px */
    right: 30px; /* 距离右侧 30px */
    z-index: 90; /* 确保在大多数元素之上 */
    width: 50px;
    height: 50px;
    /* 使用主题色 c4a1ff 的半透明版本 */
    background-color: rgba(196, 161, 255, 0.7); 
    /* 使用深色背景色作为文字颜色，形成对比 */
    color: #0f1c3a; 
    border: none;
    border-radius: 50%; /* 圆形 */
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    /* 使用 opacity 和 transform 实现平滑过渡 */
    transition: background-color 0.3s, opacity 0.3s, transform 0.3s;
    
    /* Flex 布局确保 Iconify 图标居中 */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* 默认隐藏状态 (JS会控制 opacity) */
    opacity: 0; 
    /* 当 opacity=0 时，禁止鼠标事件，防止用户点击看不见的按钮 */
    pointer-events: none;
}

.scroll-to-top-btn:hover {
    background-color: #c4a1ff; /* 悬停时颜色加深/变亮 */
    transform: scale(1.1);
}