:root {
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --color-primary: #2c3e50;
    --color-accent: #7782e0;
    --color-success: #27ae60;
    --color-danger: #e74c3c;
    --color-warning: #f39c12;
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--color-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    gap: 20px;
    padding: 20px 30px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 语言切换器 */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--bg-card);
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
}

.language-switcher select {
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    color: var(--color-primary);
}

/* 搜索框样式 */
.search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    max-width: 600px;
    width: 100%;
    transition: var(--transition);
    border: 2px solid transparent;
}

.search-wrapper:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
    transform: translateY(-2px);
}

.search-wrapper input {
    border: none;
    flex-grow: 1;
    padding: 16px 20px;
    background: transparent;
    font-size: 16px;
    outline: none;
    color: var(--color-primary);
}

.search-wrapper input::placeholder {
    color: #999;
}

.search-wrapper button {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 16px 24px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}

.search-wrapper button:hover {
    background: #2980b9;
    transform: scale(1.05);
}

/* 用户菜单 */
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.user-menu a, .user-menu span {
    color: var(--color-primary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: var(--transition);
    font-weight: 500;
}

.user-menu a:hover {
    background: var(--color-accent);
    color: white;
    transform: translateY(-2px);
}

/* 分类标签 */
.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
    justify-content: center;
}

.category-tag {
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}



.category-tag a {
    color: inherit;
    text-decoration: none;
}

/* 网址卡片网格 */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.link-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    min-height: 280px; /* 设置最小高度确保一致性 */
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.link-card:hover::before {
    left: 100%;
}

.link-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-accent);
}

/* 网站图标 */
.site-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    flex-shrink: 0; /* 防止图标被压缩 */
}

.site-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

/* 网站标题 */
.link-card a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    pointer-events: none;
    flex-shrink: 0; /* 防止标题被压缩 */
}

/* 网站描述 - 关键修改 */
.site-subtitle {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    max-height: 2.8em; /* 限制最大高度为2行 */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制显示2行 */
    -webkit-box-orient: vertical;
    flex: 1; /* 占据剩余空间 */
    width: 100%;
    margin-bottom: auto; /* 推送收藏按钮到底部 */
}

/* 收藏按钮容器 - 关键修改 */
.favorite-container {
    margin-top: auto; /* 自动推到底部 */
    width: 100%;
    flex-shrink: 0; /* 防止被压缩 */
}
/* 更精确的高度控制 */
.link-card {
    min-height: 220px; /* 根据需要调整 */
    max-height: 350px; /* 设置最大高度 */
}

/* 如果描述为空，也要占据空间 */
.site-subtitle:empty {
    min-height: 2.8em; /* 与有内容时的高度一致 */
}

/* 响应式调整 */
@media (max-width: 768px) {
    .link-card {
        min-height: 280px;
        max-height: 320px;
    }
}

@media (max-width: 480px) {
    .link-card {
        min-height: 260px;
        max-height: 300px;
    }
}

/* 收藏按钮 */
.btn-fav {
    background: var(--color-success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
    font-weight: 500;
    width: 60%; /* 占满容器宽度 */
}

.btn-fav:hover {
    background: #219a52;
    transform: scale(1.05);
}

.btn-fav.favorited {
    background: var(--color-warning);
}


/* 表单样式 */
.form-container {
    max-width: 500px;
    margin: 50px auto;
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
}

.form-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--color-primary);
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
}

.btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #c0392b;
}

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

.btn-success:hover {
    background: #219a52;
}

/* 管理后台样式 */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
}

.admin-nav {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e1e8ed;
    flex-wrap: wrap;
}

.admin-nav a {
    color: var(--color-primary);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--color-accent);
    color: white;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--color-primary);
}

.admin-table tr:hover {
    background: #f8f9fa;
}

/* 消息提示 */
.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    margin-bottom: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-primary);
    background: var(--bg-card);
    border: 2px solid transparent;
    transition: var(--transition);
}

.pagination a:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.pagination .current {
    background: var(--color-accent);
    color: white;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .search-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .user-menu {
        justify-content: center;
    }

    .categories {
        justify-content: center;
    }

    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .link-card {
        padding: 20px 15px;
    }

    .site-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .language-switcher {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 20px;
    }

    .admin-nav {
        flex-direction: column;
        gap: 10px;
    }

    .admin-table {
        font-size: 14px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 12px;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 10px;
    }

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

    .link-card {
        padding: 15px 10px;
    }

    .site-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .form-container {
        padding: 20px;
        margin: 20px auto;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(52, 152, 219, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 工具提示 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 置顶标识 */
.pinned {
    position: relative;
}

.pinned::before {
    /* content: '📌'; */
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    z-index: 1;
}

/* 拖拽排序 */
.sortable {
    cursor: move;
}

.sortable:hover {
    background: #f8f9fa;
}

.drag-over {
    background: #e3f2fd;
    border: 2px dashed var(--color-accent);
}
/* 网站标签样式 - 调整位置顺序 */
.badge {
    position: absolute;
    top: 8px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    z-index: 2;
}

/* 左1：价格类型标签 */
.badge-free {
    left: 8px;
    background: var(--color-success);
}

.badge-paid {
    left: 8px;
    background: var(--color-warning);
}

/* 左2：访问类型标签 */
.badge-direct {
    left: 45px; /* 在价格标签后面 */
    background: #17a2b8;
}

.badge-vpn {
    left: 45px; /* 在价格标签后面 */
    background: var(--color-danger);
}

/* 左3：语言标签 */
.badge-lang {
    left: 82px; /* 在访问类型标签后面 */
    background: var(--color-accent);
}


/* 网站图标支持文字显示 */
.site-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    margin-top: 20px;
}

.site-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.site-icon.text-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 20px;
    font-weight: bold;
}

/* 编辑模态框样式 */
.edit-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.edit-modal-content {
    background-color: var(--bg-card);
    margin: 2% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

.edit-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.icon-input-group {
    display: flex;
    gap: 10px;
    align-items: end;
}

.icon-input-group .form-group {
    flex: 1;
    margin-bottom: 0;
}

.icon-type-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.icon-type-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.icon-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: bold;
    margin-top: 10px;
}

.icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
/* 网站标签样式 - 调整位置顺序 */
.badge {
    position: absolute;
    top: 8px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    z-index: 2;
}

/* 左1：价格类型标签 */
.badge-free {
    left: 8px;
    background: var(--color-success);
}

.badge-paid {
    left: 8px;
    background: var(--color-warning);
}

/* 左2：访问类型标签 */
.badge-direct {
    left: 45px; /* 在价格标签后面 */
    background: #17a2b8;
}

.badge-vpn {
    left: 45px; /* 在价格标签后面 */
    background: var(--color-danger);
}

/* 左3：语言标签 */
.badge-lang {
    left: 82px; /* 在访问类型标签后面 */
    background: var(--color-accent);
}


/* 网站图标支持文字显示 */
.site-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.site-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.site-icon.text-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 20px;
    font-weight: bold;
}

/* 图标类型切换按钮 */
.icon-type-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.icon-type-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;
    color: var(--color-text);
}

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

.icon-type-btn:hover {
    border-color: var(--color-accent);
}

/* 图标预览 */
.icon-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: bold;
    margin-top: 10px;
}

.icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* 编辑模态框样式 */
.edit-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.edit-modal-content {
    background-color: var(--bg-card);
    margin: 2% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

.edit-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* 语言切换器样式 */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-switcher select {
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

/* 翻译按钮样式 */
.translate-btn {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.translate-btn:hover {
    background: var(--color-primary);
    transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .icon-type-toggle {
        flex-direction: column;
    }
    
    .icon-type-btn {
        text-align: center;
    }
    
    .language-switcher {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 20px;
        justify-content: center;
    }
}
