/* assets/css/navigation.css - 导航页专用样式 */

/* ============ 头部 ============ */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 5px var(--shadow-medium);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ============ 固定头部区域 ============ */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: linear-gradient(135deg, #677BE5 0%, #6F63C2 100%);
    box-sizing: border-box;
    border-bottom: none;
    /* 移除任何边框 */
    box-shadow: none;
    /* 移除阴影 */
}

/* 固定头部内部容器 - 用于内容居中 */
.fixed-header {
    margin-top: 120px;
}

.fixed-header .container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

/* 滚动内容区域 */
.scroll-content {
    margin-top: 270px;
    width: 100%;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

/* 调整头部内部间距 */
.fixed-header header,
.fixed-header .search-bar {
    margin-bottom: 20px;
}

/* 调整分组标题栏在固定模式下的样式 */
.fixed-header .groups-header {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(10px);
}

/* ============ 登录状态区域 ============ */
.login-status-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: 12px;
}

#userInfo,
#guestInfo {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(248, 247, 252, 0.8);
    padding: 6px 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px var(--shadow-dark);
}

#userInfo i.fa-user {
    color: #667eea;
    font-size: 0.9rem;
}

.username-display {
    font-weight: 600;
    color: #6880EA;
    font-size: 0.9rem;
}

.guest-text {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
}

.logout-btn,
.change-password-btn,
.token-manager-btn {
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.logout-btn,
.change-password-btn {
    background: rgba(108, 117, 125, 0.8);
}

.token-manager-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.logout-btn:hover,
.change-password-btn:hover {
    background: rgba(108, 117, 125, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(61, 69, 78, 0.3);
}

.token-manager-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.login-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-speed) ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* 顶部「自愿赞助」入口按钮 */
.donate-entry-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: all var(--transition-speed) ease;
}

.donate-entry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

#guestMessage {
    color: white;
    font-weight: 600;
    margin-top: 10px;
    font-size: 1rem;
}

/* ============ 搜索栏 ============ */
.search-bar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius-xl);
    padding: 10px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 15px;
}

.engine-selector {
    position: relative;
    min-width: 200px;
    width: 220px;
    flex-shrink: 0;
}

.engine-current {
    background: var(--light-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    width: 100%;
    height: 56px;
    padding: 0 15px;
    position: relative;
}

.engine-current:hover {
    border-color: var(--primary-color);
    background: #fff;
}

.engine-selector-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #666;
    transition: transform var(--transition-speed) ease;
    pointer-events: none;
    z-index: 2;
}

.content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    left: -10px;
}

.engine-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.engine-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    margin-top: 5px;
    padding: 10px 0;
    z-index: 1001;
    display: none;
    box-shadow: 0 5px 20px var(--shadow-light);
}

.engine-dropdown.show {
    display: block;
}

.engine-option {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background var(--transition-speed) ease;
}

.engine-option:hover {
    background: var(--light-color);
}

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

/* 登录后引擎可拖拽排序 */
#engineDropdown .engine-option {
    cursor: grab;
}

.engine-sort-ghost {
    opacity: 0.4;
    background: var(--light-color);
}

.engine-sort-chosen {
    cursor: grabbing;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* 右侧区域：共享标记在上、编辑/删除在下，统一靠右对齐（纵向排列，不横向挤压名称） */
.engine-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
}

/* 管理员共享引擎：右侧“共享”小标记 */
.engine-shared-badge {
    display: inline-block;
    font-size: 10px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 8px;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    white-space: nowrap;
}

.engine-option.active .engine-shared-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.engine-option-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.engine-option-content {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    padding: 8px 0;
}

.engine-text {
    text-align: center;
    flex-shrink: 0;
    font-size: 16px;
}

.engine-actions {
    display: flex;
    gap: 5px;
    opacity: 0.7;
    transition: opacity var(--transition-speed) ease;
    justify-content: flex-end;
}

.engine-option:hover .engine-actions {
    opacity: 1;
}

.engine-actions button {
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    cursor: pointer;
    padding: 5px 8px;
    color: #666;
    font-size: 12px;
    transition: all var(--transition-speed) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
}

.engine-actions button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.search-input-container {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--light-color);
    border-radius: var(--border-radius-md);
    border: 2px solid var(--border-color);
    transition: all var(--transition-speed) ease;
}

.search-input-container:focus-within {
    border-color: var(--primary-color);
    background: #fff;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 18px;
    outline: none;
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: background var(--transition-speed) ease;
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* ============ 分组标题栏 ============ */
.groups-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.groups-title-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.groups-title {
    color: white;
    font-size: 1.8rem;
    font-weight: 600;
    user-select: none;
}

.add-group-btn,
.add-group-btn1,
.add-group-btn2 {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.add-group-btn:hover,
.add-group-btn2:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
}

.add-group-btn1 {
    background: linear-gradient(135deg, #5821d8 100% 0%, #0a3fec 100%);
}

.add-group-btn1:hover {
    background: linear-gradient(135deg, #360b9b 100% 0%, #052488 100%);
    transform: translateY(-2px);
}

.add-group-btn2 {
    background: linear-gradient(135deg, var(--success-color) 0%, #F86A45 100%);
}

.add-group-btn2:hover {
    background: linear-gradient(135deg, #F86A45 0%, var(--success-color) 100%);
}

/* ============ 排序控制 ============ */
.sort-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sort-btn {
    background: var(--gray-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition-speed) ease;
}

.sort-btn:hover {
    background: var(--gray-dark);
}

.sort-btn.active {
    background: var(--success-color);
}

.sort-btn.save-btn {
    background: var(--success-color);
}

.sort-btn.cancel-btn {
    background: var(--danger-color);
}

/* ============ 分组布局 ============ */
.groups-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.group-row {
    display: flex;
    gap: 20px;
    transition: all var(--transition-speed) ease;
    position: relative;
}

.group-sidebar {
    width: 200px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius-lg);
    padding: 10px;
    box-shadow: 0 5px 20px var(--shadow-light);
    position: relative;
}

.group-title-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
    min-height: 20px;
}

.group-title {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    margin-bottom: 8px;
    line-height: 1.3;
    display: flex;
    align-items: flex-start;
    padding-top: 8px;
    user-select: none;
}

.group-right-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin-left: 15px;
    margin-bottom: 0px;
    min-height: 100%;
}

.group-creator,
.group-creator2 {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 60px;
    font-size: 11px;
    text-align: center;
    padding: 1px 2px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    user-select: none;
}

.group-creator2 {
    background: linear-gradient(135deg, #cfd305, #028122);
}

.group-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    /* 默认透明 */
    transition: opacity var(--transition-speed) ease;
}

/* 鼠标悬停在分组侧边栏时显示按钮 */
.group-sidebar:hover .group-actions {
    opacity: 1;
}

.group-action-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition-speed) ease;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-action-btn:hover {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.add-link-btn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--transition-speed) ease;
}

.add-link-btn:hover {
    background: var(--primary-dark);
}

/* 分组底部按钮行：添加网址 + 打开全部（并排，不改变分组宽度） */
.group-btn-row {
    display: flex;
    gap: 6px;
    width: 100%;
    align-items: stretch;
}

.group-btn-row .add-link-btn {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
}

.open-all-links-btn {
    flex: 0 0 38px;
    background: #eef2fb;
    color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all var(--transition-speed) ease;
}

.open-all-links-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

/* 游客 / 无添加权限时单独占满整行 */
.group-btn-row .open-all-links-btn:only-child {
    flex: 1 1 auto;
    padding: 10px;
}

.links-container {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius-lg);
    padding: 12px;
    box-shadow: 0 5px 20px var(--shadow-light);
    position: relative;
    min-height: 100px;
    align-items: center;
    justify-content: flex-start;
}

/* ============ 链接项 ============ */
.link-item {
    position: relative;
    display: flex;
    align-items: center;
    width: 215px;
    height: 50px;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-speed) ease;
    background: var(--light-color);
    border: 1px solid var(--border-color);
}

.link-icon-container {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #1e40af;
    overflow: hidden;
    background: transparent;
    border-radius: 4px;
}

.link-item:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-light);
    border-color: var(--primary-color);
}

.link-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #1e40af;
    overflow: hidden;
    background: transparent;
    border-radius: 4px;
}

.link-icon i {
    font-size: 20px;
    color: #1e40af !important;
}

.link-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 2px;
}

.link-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: none;
    gap: 2px;
    z-index: 10;
}

.link-item:hover .link-actions {
    display: flex;
}

.link-action-btn {
    width: 20px;
    height: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
}

.link-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.link-name {
    font-size: 17px;
    font-weight: 500;
    text-align: left;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

/* 管理员链接徽章样式 */
.admin-link-badge {
    position: absolute;
    top: 3px;
    right: 10px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 5;
    pointer-events: none;
}

/* 普通用户链接徽章样式 */
.user-link-badge {
    position: absolute;
    top: 22px;
    right: 6px;
    background: linear-gradient(135deg, #cfd305, #028122);
    color: white;
    font-size: 8px;
    padding: 2px 5px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 5;
    pointer-events: none;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============ 拖拽排序 ============ */
.drag-handle {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    cursor: move;
    color: #666;
    opacity: 0.5;
    transition: opacity var(--transition-speed) ease;
    display: none;
    z-index: 10;
}

.link-item:hover .drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-handle:hover {
    opacity: 1;
    color: var(--primary-color);
}

.group-drag-handle {
    position: absolute;
    top: 20px;
    right: 60px;
    cursor: move;
    color: #666;
    opacity: 0.5;
    transition: opacity var(--transition-speed) ease;
    display: none;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 4px;
}

.group-sidebar:hover .group-drag-handle {
    display: block;
}

.sort-hint {
    text-align: center;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: var(--border-radius-md);
    margin: 10px 0;
    color: var(--primary-color);
    font-size: 14px;
    display: none;
}

.sorting-mode .sort-hint {
    display: block;
}

.sorting-mode .link-item,
.sorting-mode .links-container {
    cursor: move;
}

.sorting-mode .drag-handle {
    display: flex !important;
    opacity: 1;
}

.sorting-mode .link-actions {
    display: none !important;
}

/* ============ 空状态 ============ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    width: 100%;
}

.empty-state i {
    font-size: 20px;
    margin-bottom: 20px;
    color: #888;
}

.new-group-prompt {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius-lg);
    padding: 40px 20px;
    text-align: center;
    margin-top: 20px;
    box-shadow: 0 5px 20px var(--shadow-light);
}

.new-group-prompt i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

/* ============ 图标侧边栏 ============ */
.icon-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    z-index: 1008;
    box-shadow: -5px 0 20px var(--shadow-light);
    transition: right var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}

.icon-sidebar.show {
    right: 0;
}

.icon-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.icon-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.icon-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.icon-category-btn {
    padding: 8px 16px;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.icon-category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.icons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.icon-item {
    position: relative;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.icon-item:hover {
    border-color: var(--primary-color);
}

.icon-item.selected {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.icon-item i {
    font-size: 24px;
    color: #1e40af !important;
    margin-bottom: 8px;
}

.icon-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 8px;
}

.icon-item-name {
    font-size: 12px;
    color: #666;
}

.icon-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

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

.icon-action-btn {
    width: 20px;
    height: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
}

.icon-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#customIconSections {
    transition: opacity 0.2s ease;
}

#customIconSections.hidden {
    display: none;
}

/* ============ 上传区域 ============ */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: var(--border-radius-md);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.upload-area i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.upload-preview {
    max-width: 100px;
    max-height: 100px;
    margin: 15px auto;
    display: none;
}

/* ============ 页脚 ============ */
footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
    font-size: 14px;
    padding: 20px 0;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

footer a:hover {
    color: white;
    text-decoration: underline;
}

footer p {
    margin: 5px 0;
    line-height: 1.6;
}

/* ============ 访客模式 ============ */
.guest-mode .add-group-btn,
.guest-mode .add-link-btn,
.guest-mode .group-action-btn,
.guest-mode .link-actions,
.guest-mode .engine-actions,
.guest-mode #addEngineBtn,
.guest-mode #sortModeBtn,
.guest-mode .control-btn[title*="添加"],
.guest-mode .control-btn[title*="编辑"],
.guest-mode .sort-controls {
    display: none !important;
}

/* ============ 分组位置选择器样式 ============ */
.form-group select.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 14px;
    transition: all var(--transition-speed) ease;
    background-color: white;
    cursor: pointer;
}

.form-group select.form-control:hover {
    border-color: var(--primary-color);
}

.form-group select.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-text.text-muted {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.required {
    color: #dc3545;
    margin-left: 2px;
}

/* 模态框表单组样式 */
.modal .form-group {
    margin-bottom: 20px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* 加载状态按钮 */
.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-primary i.fa-spinner {
    margin-right: 5px;
}

/* ============ 可见性设置模态框样式 ============ */
.users-list-container {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: #fff;
    margin-bottom: 15px;
    padding: 5px 0;
}

.users-list-container .loading-spinner {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-color);
}

.users-list-container .loading-spinner i {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.users-list-container .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-color);
}

.users-list-container .empty-state i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--gray-color);
}

.users-list-container .error-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--danger-color);
}

.users-list-container .error-state i {
    font-size: 32px;
    margin-bottom: 10px;
}

.user-checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-speed) ease;
}

.user-checkbox-item:last-child {
    border-bottom: none;
}

.user-checkbox-item:hover {
    background-color: var(--light-color);
}

.user-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: all var(--transition-speed) ease;
}

.user-checkbox-item input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name i {
    color: var(--primary-color);
    font-size: 12px;
}

.user-meta {
    font-size: 12px;
    color: var(--gray-color);
    margin-top: 4px;
}

.user-select-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0 10px 0;
}

.user-select-actions .btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* 按钮尺寸变体 */
.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-secondary {
    background: var(--gray-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-speed) ease;
}

.btn-secondary:hover {
    background: var(--gray-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-light);
}

#visibilityModal .form-hint {
    margin-top: 10px;
    color: var(--gray-color);
    font-size: 13px;
    line-height: 1.5;
}

#visibilityModal .form-hint i {
    color: var(--primary-color);
    margin-right: 5px;
}

#visibilityModal .modal-content {
    max-width: 600px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ 移动端适配优化（保留原有样式） ============ */
@media (max-width: 768px) {
    header {
        height: 150px;
    }

    header h1 {
        font-size: 1.8rem;
        /* 从2.8rem减小到1.8rem */
        white-space: nowrap;
        /* 强制不换行 */
        overflow: hidden;
        /* 隐藏溢出 */
        text-overflow: ellipsis;
        /* 溢出显示省略号 */
    }

    header p {
        font-size: 0.9rem !important;
        /* 从1.1rem减小到0.9rem */
    }

    /* 容器修复 */
    .container {
        padding: 0 12px;
        width: 100%;
        margin-top: 20px;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* 固定头部修复 */
    .fixed-header {
        position: relative;
        width: 100%;
        padding: 10px 0;
        margin-top: 140px;
        z-index: auto;

    }

    .fixed-header .container {
        padding: 0 12px;
    }

    /* ===== 搜索栏修复 ===== */
    .search-bar {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 20px;
        margin-bottom: 20px;
        width: 100%;
        box-sizing: border-box;
    }

    /* 搜索引擎选择器 - 固定宽度但自适应 */
    .engine-selector {
        width: 100%;
        min-width: unset;
        /* 取消最小宽度限制 */
        max-width: 100%;
        position: relative;
        z-index: 100;
    }

    .engine-current {
        width: 100%;
        height: 48px;
        padding: 0 15px;
        background: #fff;
        border: 2px solid #e9ecef;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
    }

    .content-wrapper {
        display: flex;
        align-items: center;
        gap: 8px;
        max-width: calc(100% - 30px);
    }

    .engine-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100% - 30px);
        font-size: 15px;
    }

    .engine-selector-arrow {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        color: #666;
        pointer-events: none;
    }

    /* 搜索引擎下拉菜单 */
    .engine-dropdown {
        width: 100%;
        max-height: 300px;
        overflow-y: auto;
        background: #fff;
        border: 2px solid #e9ecef;
        border-radius: 12px;
        margin-top: 5px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    }

    .engine-option {
        padding: 12px 15px;
    }

    .engine-option-content {
        width: 100%;
    }

    /* 搜索输入框容器 */
    .search-input-container {
        width: 100%;
        background: #fff;
        border: 2px solid #e9ecef;
        border-radius: 12px;
        transition: all 0.3s ease;
    }

    .search-input-container:focus-within {
        border-color: #667eea;
    }

    .search-input {
        width: 100%;
        height: 48px;
        padding: 0 15px;
        border: none;
        background: transparent;
        font-size: 16px;
        outline: none;
    }

    /* 搜索按钮 */
    .search-btn {
        width: 20%;
        height: 48px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        padding: 2px;
        border-radius: 12px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        transition: all 0.3s ease;
    }

    .search-btn:active {
        transform: translateY(1px);
        opacity: 0.9;
    }

    /* ===== 分组标题栏修复 ===== */
    .groups-header {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 10px 0;
        width: 100%;
        box-sizing: border-box;
    }

    .groups-title-container {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .groups-title {
        font-size: 1.5rem;
        color: white;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* 右侧按钮组 */
    .group-right-content {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        margin-left: 0;
    }

    .group-creator,
    .group-creator2 {
        width: auto;
        padding: 4px 10px;
        font-size: 11px;
        border-radius: 20px;
        white-space: nowrap;
    }

    .group-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        opacity: 1;
    }

    .group-action-btn {
        width: 30px;
        height: 30px;
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 添加分组按钮 */
    .add-group-btn1,
    .add-group-btn2 {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 10px;
        white-space: nowrap;
    }

    /* 排序控制 */
    .sort-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }

    .sort-btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 120px;
        padding: 12px;
        font-size: 14px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
    }

    .sort-btn.active {
        background: #28a745;
    }

    #sortActionButtons {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }

    #sortActionButtons .sort-btn {
        flex: 1 1 calc(50% - 5px);
    }

    /* 登录状态 */
    .login-status-container {
        position: fixed;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        z-index: 1002;
        margin: 85px auto 15px auto;
        justify-content: center;
        width: 100%;
    }

    /* 分组布局 */
    .group-row {
        flex-direction: column;
        gap: 15px;
    }

    .group-sidebar {
        width: 100%;
        padding: 15px;
    }

    .links-container {
        flex: 1;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .link-item {
        width: 100%;
        min-width: 0;
        padding: 8px 12px;
        height: auto;
        min-height: 44px;
    }

    .link-name {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }

    .link-icon-container {
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }

    /* 滚动内容 */
    .scroll-content {
        margin-top: 0;
        width: 100%;
    }

    /* 确保所有元素使用border-box */
    * {
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .groups-title {
        font-size: 1.3rem;
    }

    .sort-btn,
    #sortActionButtons .sort-btn {
        flex: 1 1 100%;
    }

    .link-item {
        width: 100%;
    }

    .group-action-btn {
        width: 35px;
        height: 35px;
    }

    .add-group-btn1,
    .add-group-btn2 {
        width: 100%;
        justify-content: center;
    }
}

/* ============ 横屏模式优化 ============ */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {

    /* 整个固定头部取消固定 */
    .fixed-header {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        padding: 5px 0;
        margin-top: 90px;
        z-index: 1;
        background: linear-gradient(135deg, #677BE5 0%, #6F63C2 100%);
    }

    /* 确保容器正常显示 */
    .fixed-header .container {
        padding: 0 15px;
    }

    /* 滚动内容区域边距归零 */
    .scroll-content {
        margin-top: 0;
    }

    /* 登录状态 - 改为页面内相对定位 */
    .login-status-container {
        position: fixed;
        top: 0;
        right: 0;
        justify-content: flex-end;
        margin: 0 15px 10px auto;
        width: auto;
        z-index: 1002;
    }

    /* 页头标题正常显示 */
    header {
        margin-bottom: 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    /* 搜索栏正常显示 */
    .search-bar {
        margin-bottom: 15px;
    }

    /* 分组标题栏正常显示 */
    .groups-header {
        margin-bottom: 15px;
    }

    /* 其余横屏优化代码保持不变... */
    .search-bar {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 10px;
        padding: 10px;
    }

    .engine-selector {
        width: 180px;
        min-width: 160px;
        flex: 0 0 auto;
    }

    .engine-current {
        height: 44px;
    }

    .search-input-container {
        flex: 1 1 auto;
        width: auto;
        min-width: 180px;
    }

    .search-input {
        height: 44px;
        font-size: 16px;
    }

    .search-btn {
        width: auto;
        min-width: 80px;
        padding: 0 15px;
        height: 44px;
        font-size: 15px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .groups-header {
        flex-direction: row;
        align-items: center;
        gap: 15px;
        padding: 5px 0;
    }

    .groups-title-container {
        flex: 1;
        flex-wrap: nowrap;
    }

    .groups-title {
        font-size: 1.5rem;
        white-space: nowrap;
    }

    .group-right-content {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .group-creator,
    .group-creator2 {
        padding: 2px 8px;
        font-size: 11px;
    }

    .group-actions {
        opacity: 0;
        flex-direction: row;
    }

    .group-sidebar:hover .group-actions {
        opacity: 1;
    }

    .group-action-btn {
        width: 24px;
        height: 24px;
    }

    .add-group-btn1,
    .add-group-btn2 {
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 13px;
    }

    .sort-controls {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .sort-btn {
        flex: 0 1 auto;
        min-width: 90px;
        padding: 6px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    #sortActionButtons {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .group-row {
        flex-direction: row;
        gap: 12px;
    }

    .group-sidebar {
        width: 180px;
        flex-shrink: 0;
    }

    .links-container {
        flex: 1;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 8px;
    }

    .link-item {
        width: 100%;
        min-width: 0;
        padding: 8px 12px;
        height: auto;
        min-height: 44px;
    }

    .link-name {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }

    .link-icon-container {
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }

    @media (max-width: 900px) {
        .engine-selector {
            width: 160px;
            min-width: 140px;
        }

        .search-btn {
            min-width: 70px;
            padding: 0 10px;
        }

        .groups-title {
            font-size: 1.3rem;
        }

        .link-item {
            padding: 6px 10px;
        }
    }
}