/**
 * 自定义CSS样式
 * 这个文件包含网站的自定义样式，覆盖默认样式
 */

/* 自定义变量 */
:root {
  /* --primary-color: #4a7bff;  已在styles.css或theme.css中定义 */
  /* --secondary-color: #e66a47; 未使用 */
  /* --background-color: #f9f9fb; 应使用 var(--bg-color) */
  /* --text-color: #333; 应使用 var(--text-color) */
  /* --border-color: #e5e7eb; 应使用 var(--border-color) */
  
  /* CDN字体变量 */
  --font-primary: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --font-chinese: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-english: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
}

/* 全局字体优化 */
body {
  font-family: var(--font-primary);
  font-display: swap; /* 字体交换策略，提升加载性能 */
}

/* 中文页面字体优化 */
html[lang="zh"] body {
  font-family: var(--font-chinese);
}

/* 英文页面字体优化 */
html[lang="en"] body {
  font-family: var(--font-english);
}

/* 页面特定样式可以添加在这里 */

/* 确保导航栏在所有页面一致的样式 */
header {
    /* background-color: #fff; */ /* 移除硬编码背景色，应由theme.css控制 */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px !important; /* 固定高度并强制应用 */
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 确保logo样式一致 */
.logo-img {
    width: 40px !important;
    height: 40px !important;
    margin-right: 10px;
}

/* 确保导航菜单样式一致 */
nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin: 0 15px;
}

nav ul li a {
    text-decoration: none;
    /* color: #333; */ /* 移除硬编码文字颜色，应由theme.css控制 */
    font-weight: 500;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s;
    display: flex;
    align-items: center;
}

nav ul li a i {
    margin-right: 5px;
}

/* .active 状态的颜色应由 theme.css 控制 */
/* nav ul li.active a {
    color: #4a7bff;
} */

/* .active 状态的下划线颜色应由 theme.css 控制 */
/* nav ul li.active a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #4a7bff;
    border-radius: 3px;
} */

/* 确保操作按钮样式一致 */
.actions {
    display: flex;
    align-items: center;
}

.submit-btn {
    background-color: var(--primary-btn-bg, #4a7bff); /* 使用主题变量，提供备用值 */
    color: var(--primary-btn-text, white); /* 使用主题变量，提供备用值 */
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease; /* 添加过渡效果 */
}

.submit-btn i {
    margin-right: 5px;
}

.submit-btn:hover {
    background-color: var(--primary-btn-hover-bg, #3a5fcc); /* 使用主题悬停变量 */
}

/* 移除 .active 状态，因为按钮本身没有激活状态 */
/* .submit-btn.active {
    background-color: #3a5fcc;
} */

/* 右上角动态添加的主题按钮强制隐藏 */
button[data-theme="light"], 
button[data-theme="dark"], 
button[data-theme="system"] {
    display: none !important;
}

button:not(.theme-btn):has(i.fa-sun),
button:not(.theme-btn):has(i.fa-moon),
button:not(.theme-btn):has(i.fa-desktop) {
    display: none !important;
}

/* 例外：仅允许主题下拉菜单中的按钮显示 */
.theme-dropdown button[data-theme="light"],
.theme-dropdown button[data-theme="dark"],
.theme-dropdown button[data-theme="system"],
.theme-dropdown button:has(i.fa-sun),
.theme-dropdown button:has(i.fa-moon),
.theme-dropdown button:has(i.fa-desktop) {
    display: block !important;
}

/* 社群二维码样式 */
.community-qr {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 999;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    /* border: 2px solid red; */ /* 移除红色边框 */
}

.community-qr i {
    font-size: 20px;
    color: #ff9800; /* 改为橙色 */
}

.community-qr-popup {
    position: absolute;
    top: 50px;
    right: 0;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    align-items: center;
    width: 160px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.community-qr-popup.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.community-qr-popup img {
    width: 140px;
    height: 140px;
    margin-bottom: 10px;
}

.community-qr-popup p {
    margin: 0;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* 发布页面二维码样式 - 直接展开版本 */
.community-qr-submit {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 999;
}

.community-qr-submit-content {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
}

.community-qr-submit-content img {
    width: 140px;
    height: 140px;
    margin-bottom: 10px;
}

.community-qr-submit-content p {
    margin: 0;
    font-size: 12px;
    color: #666;
    text-align: center;
    font-weight: 500;
}

@media (max-width: 768px) {
    .community-qr {
        top: 70px;
        right: 15px;
        width: 36px;
        height: 36px;
    }
    
    .community-qr-submit {
        top: 70px;
        right: 15px;
        transform: scale(0.8);
        transform-origin: top right;
    }
    
    .community-qr-submit-content {
        width: 140px;
        padding: 12px;
    }
    
    .community-qr-submit-content img {
        width: 120px;
        height: 120px;
    }
    
    /* Clients页面小屏幕标题换行 */
    .clients-page .hero h1 span:first-child {
        display: block;
        margin-bottom: 5px; /* 可选：在两行之间添加一些间距 */
    }
}

/* 请求直连按钮提示框样式 */
.subscribe-btn {
    position: relative;
}

/* 首页服务器卡片直连角标 */
.server-card {
    position: relative; /* 确保角标的绝对定位是相对于卡片的 */
    overflow: hidden; /* 防止角标溢出卡片边界 */
}

/* 已创建实例的服务器卡片样式 - 差异化设计 */
.server-card.server-created {
    border: 2px solid rgba(34, 197, 94, 0.4); /* 绿色边框 */
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.02) 0%, rgba(34, 197, 94, 0.05) 100%); /* 淡绿色背景渐变 */
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1); /* 绿色阴影 */
    position: relative;
}

.server-card.server-created::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #22c55e, #16a34a, #15803d); /* 顶部绿色渐变条 */
    border-radius: 12px 12px 0 0;
}

.server-card.server-created:hover {
    border-color: rgba(34, 197, 94, 0.6);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}



/* 深色主题下的已创建实例样式 */
html[data-theme="dark"] .server-card.server-created,
body[data-theme="dark"] .server-card.server-created {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, rgba(34, 197, 94, 0.1) 100%);
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.2), 0 2px 8px rgba(0, 0, 0, 0.2);
}



.hosted-badge {
    position: absolute;
    top: 8px; /* 距离顶部的距离 */
    right: 8px; /* 距离右侧的距离 */
    background-color: #ff4500; /* 橙红色背景，醒目 */
    color: white;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 4px;
    z-index: 5; /* 确保在其他元素之上 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 如果需要斜角效果，可以取消下面的注释并调整 */
/*
.hosted-badge {
    position: absolute;
    top: 12px;
    right: -30px;
    background-color: #ff4500;
    color: white;
    padding: 5px 30px;
    font-size: 0.7rem;
    font-weight: bold;
    transform: rotate(45deg);
    transform-origin: top right;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    text-align: center;
}
*/

/* 优化首页加载顺序 - 服务器数量徽章默认隐藏，避免页面加载时闪烁 */
.server-counter-badge {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease-out;
}

/* 当JS加载完成后会动态显示 */
.server-counter-badge.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* 优化页面加载性能 - 避免布局抖动 */
.server-list {
    min-height: 300px; /* 预设最小高度 */
}

.categories-sidebar-floating {
    /* 确保左侧分类栏不会阻塞主要内容的渲染 */
    will-change: transform;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .server-counter-badge {
        /* 移动端可以稍微调整位置 */
        transform: translateY(-5px);
    }
    
    .server-list {
        min-height: 200px; /* 移动端减少预设高度 */
    }
}

/* CDN资源加载优化 */
/* 字体加载优化 - 防止FOIT（Flash of Invisible Text） */
@font-face {
    font-family: 'Inter';
    font-display: swap; /* 字体交换策略 */
    src: local('Inter');
}

@font-face {
    font-family: 'Noto Sans SC';
    font-display: swap;
    src: local('Noto Sans SC');
}

/* 图片懒加载样式 */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[data-src].lazy-loaded {
    opacity: 1;
}

/* 加载占位符 */
.image-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 关键资源预加载提示 */
.resource-loading {
    position: relative;
    overflow: hidden;
}

.resource-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
} 

/* 收藏导航项样式 */
.nav-favorites {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 107, 107, 0.1);
    border-color: #ff6b6b !important;
}

.nav-favorites:hover {
    background: rgba(255, 107, 107, 0.15);
}

.nav-favorites i {
    color: #ff6b6b;
}

.favorites-count {
    background: #ff6b6b;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

/* 托管服务器特殊卡片样式 */
.card-footer.hosted-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* 托管服务器创建和查看按钮样式 */
.btn-create-server.hosted-create-btn,
.btn-view-server.hosted-create-btn {
    margin-left: auto;
    margin-right: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    flex: initial;
    min-width: auto;
}

/* 卡片头部相对定位，用于右上角按钮定位 */
.server-card .card-header {
    position: relative;
}

/* 右上角创建按钮样式 */
.btn-create-server.hosted-create-btn-top,
.btn-view-server.hosted-create-btn-top {
    position: absolute;
    top: 2px;
    right: 2px;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: auto;
    height: auto;
    line-height: 1.2;
}

.btn-create-server.hosted-create-btn-top:hover,
.btn-view-server.hosted-create-btn-top:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 创建按钮颜色 - 半透明橙色 */
.btn-create-server.hosted-create-btn-top {
    background-color: rgba(255, 127, 80, 0.25);
    color: #ff4500;
    border: 1px solid rgba(255, 69, 0, 0.2);
    backdrop-filter: blur(8px);
    font-weight: 500;
}

.btn-create-server.hosted-create-btn-top:hover {
    background-color: #ff4500;
    border-color: #ff4500;
    color: white;
    font-weight: 600;
    transform: translateY(-1px);
}

/* 查看按钮颜色 - 半透明绿色 */
.btn-view-server.hosted-create-btn-top {
    background-color: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.2);
    backdrop-filter: blur(8px);
    font-weight: 500;
}

.btn-view-server.hosted-create-btn-top:hover {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
    font-weight: 600;
    transform: translateY(-1px);
}

/* 对话按钮样式 - 蓝色主题 */
.btn-chat-server,
.btn-chat-server.hosted-chat-btn-top {
    position: absolute;
    top: 2px;
    right: 2px;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: auto;
    height: auto;
    line-height: 1.2;
    background-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(8px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-chat-server:hover,
.btn-chat-server.hosted-chat-btn-top:hover {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: white;
    font-weight: 600;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-chat-server i {
    font-size: 0.75rem;
}

/* 托管服务器底部指标容器 */
.card-footer .card-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* 当card-stats为空或只有stars时，调整布局 */
.card-footer .card-stats:empty,
.card-footer .card-stats:has(.metric:only-child) {
    flex: 0;
    margin-right: 15px;
}

/* 确保托管服务器的指标不会换行 */
.card-footer.hosted-actions .card-stats .metric {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12px;
}

.btn-create-server,
.btn-view-server,
.btn-view-servers {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-create-server:hover,
.btn-view-server:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

.btn-create-server i,
.btn-view-server i,
.btn-view-servers i {
    font-size: 14px;
}

/* 深色主题下的托管服务器按钮样式 */
html[data-theme="dark"] .btn-create-server,
html[data-theme="dark"] .btn-view-server,
html[data-theme="dark"] .btn-view-servers,
body[data-theme="dark"] .btn-create-server,
body[data-theme="dark"] .btn-view-server,
body[data-theme="dark"] .btn-view-servers {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .btn-create-server:hover,
html[data-theme="dark"] .btn-view-server:hover,
html[data-theme="dark"] .btn-view-servers:hover,
body[data-theme="dark"] .btn-create-server:hover,
body[data-theme="dark"] .btn-view-server:hover,
body[data-theme="dark"] .btn-view-servers:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

html[data-theme="dark"] .card-footer.hosted-actions,
body[data-theme="dark"] .card-footer.hosted-actions {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 环境变量模态框需要更高的z-index以显示在其他模态框之上 */
#env-modal {
    z-index: 2000;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: var(--bg-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

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

.modal-content.modal-large {
    max-width: 700px;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-description {
    margin: 0 0 12px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* OAuth提供商按钮 */
.oauth-providers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.oauth-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.oauth-provider-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.provider-icon {
    width: 24px;
    height: 24px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-color);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 123, 255, 0.1);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 模态框操作按钮 */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    background: #356dd8;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

/* 环境变量输入 */
.env-input-group {
    margin-bottom: 16px;
}

.env-input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-color);
}

.env-input-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-color);
    font-size: 14px;
}

.env-input-group .input-description {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 工具列表 */
.tools-select-all {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.tools-select-all label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.tools-list {
    display: grid;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.tool-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    transition: all 0.2s ease;
}

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

.tool-item input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.tool-info {
    flex: 1;
}

.tool-name {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
}

.tool-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.desc-toggle {
    color: #007bff;
    cursor: pointer;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.desc-toggle:hover {
    color: #0056b3;
    text-decoration: underline;
}

.desc-short, .desc-full {
    display: inline;
}

/* 深色主题模态框 */
html[data-theme="dark"] .modal-content,
body[data-theme="dark"] .modal-content {
    background: var(--bg-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-control {
    background: var(--bg-secondary);
    color: var(--text-color);
}

html[data-theme="dark"] .oauth-provider-btn,
body[data-theme="dark"] .oauth-provider-btn {
    background: var(--bg-secondary);
}

html[data-theme="dark"] .tool-item,
body[data-theme="dark"] .tool-item {
    background: var(--bg-secondary);
}

/* 安装指令模态框样式 */
.success-icon {
    text-align: center;
    margin-bottom: 16px;
}

.success-icon .fa-check-circle {
    font-size: 48px;
    color: #10b981;
}

.installation-section {
    margin: 24px 0;
}

.mcp-url-section {
    margin-bottom: 12px;
}

.mcp-url-section h4 {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
}

.mcp-url-display-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
}

.mcp-url-display {
    display: block;
    width: 100%;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    color: var(--primary-color);
    background: transparent;
    border: none;
    word-break: break-all;
    line-height: 1.3;
    margin: 0;
}

/* 创建阶段安装模态框特定样式 */
.installation-modal-content {
    max-width: 800px !important;
    width: 90vw !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
}

#installation-modal .modal-content {
    max-width: 800px !important;
    width: 90vw !important;
    max-height: 95vh !important;
    display: flex !important;
    flex-direction: column !important;
}

#installation-modal .modal-body {
    max-width: none;
    overflow-y: auto !important;
    max-height: calc(95vh - 140px) !important;
    flex: 1 !important;
    /* 只在内容超出时显示滚动条 */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

/* 当内容超出时显示滚动条 */
#installation-modal .modal-body:hover {
    scrollbar-color: var(--border-color) var(--bg-secondary);
}

/* 强制显示滚动条（当内容超出时） */
#installation-modal .modal-body.scrollable {
    scrollbar-color: var(--border-color) var(--bg-secondary);
}

#installation-modal .modal-body.scrollable::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

#installation-modal .modal-body.scrollable::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

/* 美化滚动条 - 只在内容超出时显示 */
#installation-modal .modal-body::-webkit-scrollbar {
    width: 6px;
}

#installation-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

#installation-modal .modal-body::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.2s ease;
}

/* 悬停时显示滚动条 */
#installation-modal .modal-body:hover::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

#installation-modal .modal-body:hover::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

#installation-modal .modal-body:hover::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

#installation-modal .success-header {
    text-align: center;
    margin-bottom: 20px; /* 减少间距，因为移除了图标 */
}

#installation-modal .success-icon {
    display: none; /* 隐藏绿点图标 */
}

#installation-modal .success-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 8px 0;
}

#installation-modal .success-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

#installation-modal .modal-header {
    border-bottom: none;
    padding: 16px 24px 0;
    position: relative;
    display: none; /* 隐藏整个header，包括关闭按钮 */
}

#installation-modal .modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#installation-modal .modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-color);
}

#installation-modal .client-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 10px 0 8px 0;
    padding-bottom: 0;
}

@media (min-width: 768px) {
    #installation-modal .client-tabs {
        grid-template-columns: repeat(6, 1fr);
    }
}

#installation-modal .client-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    justify-content: center;
    min-height: 32px;
    text-align: center;
}

#installation-modal .client-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-color);
    border-color: var(--primary-color);
}

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

#installation-modal .client-tab img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    border-radius: 2px;
    flex-shrink: 0;
}

#installation-modal .client-tab i {
    font-size: 16px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 帮助图标和提示样式 */
.modal-description-with-help {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 10px 0;
    position: relative;
}

.modal-description-with-help .modal-description {
    font-size: 14px;
    color: var(--text-color);
    margin: 0;
    text-align: center;
    font-weight: 500;
}

.help-icon-btn {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.help-icon-btn:hover {
    color: var(--primary-color);
    background-color: rgba(74, 123, 255, 0.1);
    transform: scale(1.1);
}

.help-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(74, 123, 255, 0.1);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: helpTooltipFadeIn 0.3s ease-out;
}

@keyframes helpTooltipFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.help-tooltip-content {
    padding: 0;
}

.help-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(74, 123, 255, 0.1);
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-radius: 12px 12px 0 0;
}

.help-tooltip-header h4 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-tooltip-header h4 i {
    color: var(--primary-color);
}

.help-tooltip-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--light-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-tooltip-close:hover {
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.05);
}

.help-tooltip-body {
    padding: 20px 24px 24px;
}

.help-steps {
    margin: 0 0 20px 0;
    padding-left: 20px;
    color: var(--text-color);
    line-height: 1.6;
}

.help-steps li {
    margin-bottom: 12px;
    font-size: 14px;
}

.help-steps ul {
    margin: 8px 0 0 20px;
    padding-left: 0;
}

.help-steps ul li {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--light-text);
}

.help-steps strong {
    color: var(--primary-color);
    font-weight: 600;
}

.help-tip {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid rgba(74, 123, 255, 0.2);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
}

.help-tip i {
    color: var(--primary-color);
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.help-tip span {
    color: var(--text-color);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
}

/* uv安装提示样式 */
.uv-install-tip {
    margin: 8px 0;
    animation: slideInFromTop 0.3s ease-out;
}

.uv-install-tip .tip-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    padding: 4px 0;
    color: var(--light-text);
    font-size: 13px;
}

.uv-install-tip .tip-trigger:hover {
    color: var(--primary-color);
}

.uv-install-tip .tip-trigger i:first-child {
    color: var(--primary-color);
    font-size: 14px;
}

.uv-install-tip .tip-trigger-text {
    flex: 1;
    font-weight: 400;
}

.uv-install-tip .tip-arrow {
    color: var(--light-text);
    font-size: 10px;
    transition: transform 0.2s ease;
}

.uv-install-tip.expanded .tip-arrow {
    transform: rotate(180deg);
}

.uv-install-tip .tip-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-top: 8px;
    animation: expandDown 0.3s ease-out;
}

@keyframes expandDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding-top: 16px;
        padding-bottom: 16px;
    }
}

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

.uv-install-tip .tip-icon {
    color: var(--primary-color);
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.uv-install-tip .tip-content {
    flex: 1;
}

.uv-install-tip .tip-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    font-size: 14px;
}

.uv-install-tip .tip-commands {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.uv-install-tip .tip-command-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.uv-install-tip .os-label {
    font-weight: 600;
    color: var(--text-color);
    min-width: 80px;
    font-size: 13px;
}

.uv-install-tip .tip-command {
    flex: 1;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: var(--text-color);
    background: transparent;
    border: none;
    padding: 0;
    word-break: break-all;
    line-height: 1.4;
}

.uv-install-tip .copy-tip-command-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
}

.uv-install-tip .copy-tip-command-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.uv-install-tip .tip-note {
    font-size: 12px;
    color: var(--light-text);
    font-style: italic;
    line-height: 1.4;
}

#installation-modal .modal-description {
    font-size: 16px;
    color: var(--text-color);
    margin: 24px 0 16px 0;
    text-align: center;
    font-weight: 500;
}

#installation-modal .modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: auto;
    padding: 20px 24px 24px;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

#installation-modal .btn-secondary,
#installation-modal .btn-primary {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 140px;
}

#installation-modal .btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

#installation-modal .btn-secondary:hover {
    background: var(--bg-color);
    border-color: var(--text-secondary);
}

#installation-modal .btn-primary {
    background: var(--primary-color);
    color: white;
}

#installation-modal .btn-primary:hover {
    background: #356dd8;
}

/* 小屏幕优化 */
@media (max-width: 767px) {
    .installation-modal-content {
        width: 95vw !important;
    }
    
    #installation-modal .client-tabs {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    #installation-modal .client-tab {
        font-size: 11px;
        padding: 6px 4px;
        gap: 3px;
    }
    
    #installation-modal .client-tab img,
    #installation-modal .client-tab i {
        width: 14px;
        height: 14px;
    }
    
    #installation-modal .modal-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    #installation-modal .btn-secondary,
    #installation-modal .btn-primary {
        width: 100%;
        min-width: unset;
    }
    
    #installation-modal .success-header h2 {
        font-size: 20px;
    }
    
    #installation-modal .success-subtitle,
    #installation-modal .modal-description {
        font-size: 14px;
    }
}

.installation-section h3 {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

/* OS Support Badge */
.os-support-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding: 3px 8px;
    background: linear-gradient(135deg, rgba(74, 123, 255, 0.15), rgba(139, 92, 246, 0.15));
    border-radius: 10px;
    font-size: 0.7rem;
    vertical-align: middle;
}

.os-support-badge i {
    font-size: 0.8rem;
    opacity: 0.9;
}

.os-support-badge i.fa-apple {
    color: #a3a3a3;
}

.os-support-badge i.fa-windows {
    color: #00a4ef;
}

.os-support-badge i.fa-linux {
    color: #fcc624;
}

.client-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.client-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.client-tab:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-secondary);
}

.client-tab.active {
    border-color: var(--primary-color);
    background-color: rgba(74, 123, 255, 0.1);
    color: var(--primary-color);
}

.install-command-container {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    padding-right: 40px; /* 为复制按钮留出空间 */
    margin: 12px 0;
    max-height: 120px;
    min-height: 60px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 美化滚动条 */
.install-command-container::-webkit-scrollbar {
    width: 6px;
}

.install-command-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.install-command-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.install-command-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.install-command {
    display: block;
    width: 100%;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: var(--text-color);
    background: transparent;
    border: none;
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
    margin: 0;
    padding-right: 36px;
}

.copy-command-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.copy-command-btn .btn-text {
    display: none; /* 隐藏文字，只显示图标 */
}

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

/* 安装按钮样式（用于支持URL Scheme的客户端） */
.copy-command-btn.install-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    animation: pulse 2s infinite;
}

.copy-command-btn.install-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* URL Scheme一键安装样式 */
.install-command.has-url-scheme {
    padding: 0;
}

.install-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.url-scheme-install {
    display: flex;
    align-items: center;
    gap: 12px;
}

.url-scheme-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.url-scheme-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.url-scheme-button i {
    font-size: 16px;
}

.install-or {
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
}

.manual-command {
    display: block;
    width: 100%;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    word-break: break-all;
    line-height: 1.5;
    margin: 0;
}

/* 响应式优化 */
@media (max-width: 767px) {
    .url-scheme-button {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .manual-command {
        font-size: 12px;
    }
}

/* MCP URL复制按钮样式 */
.mcp-url-display-container {
    position: relative;
    display: flex;
    align-items: center;
}

.mcp-url-display {
    flex: 1;
    padding-right: 32px;
}

.copy-url-btn {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

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

/* 已连接server card样式 */
.server-connected {
    border: 2px solid #10b981 !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2) !important;
}

.connected-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
}

/* 可选Key提示链接样式 */
.optional-key-link-section {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
}

.key-status-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #4b5563;
}

.key-status-info i {
    color: #3b82f6;
}

.use-own-key-link {
    margin-left: auto;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.use-own-key-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.key-save-success {
    margin-top: 10px;
    padding: 8px 12px;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    color: #065f46;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.key-save-success i {
    color: #10b981;
}

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