* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

header {
    background: linear-gradient(90deg, #2c3e50, #4a6491);
    color: white;
    padding: 25px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.2rem;
    margin-top: 15px;
}

.search-container {
    background: #fff;
    border-radius: 50px;
    padding: 5px 20px;
    margin: 30px auto 20px;
    max-width: 600px;
    display: flex;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.search-container input {
    flex: 1;
    border: none;
    padding: 15px;
    font-size: 16px;
    outline: none;
    background: transparent;
}

.search-container button {
    background: transparent;
    border: none;
    color: #4a6491;
    cursor: pointer;
    font-size: 20px;
    padding: 0 15px;
    transition: transform 0.3s;
}

.search-container button:hover {
    transform: scale(1.1);
    color: #b21f1f;
}

.content {
    display: flex;
    min-height: 600px;
}

.sidebar {
    width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #eaeaea;
    overflow-y: auto;
    padding: 20px 0;
}

.main-content {
    flex: 1;
    padding: 25px 30px;
    background: #fff;
    overflow-y: auto;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4a6491;
}

.category-title {
    font-size: 1.8rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.batch-controls {
    display: flex;
    gap: 10px;
}

.batch-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    background: #4a6491;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.batch-btn:hover {
    background: #2c3e50;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.batch-btn.secondary {
    background: #b21f1f;
}

.batch-btn.secondary:hover {
    background: #8a1818;
}

.batch-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.link-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #eaeaea;
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    position: relative;
    cursor: pointer;
}

.link-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
    border-color: #4a6491;
}

.link-card.selected {
    border: 2px solid #4a6491;
    background: #e6f0ff;
}

.link-icon {
    height: 70px;
    width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4a6491, #2c3e50);
    color: white;
    font-size: 2.2rem;
    border-radius: 50%;
    margin-bottom: 15px;
    transition: transform 0.3s;
}

.link-card:hover .link-icon {
    transform: scale(1.1);
}

.link-content h3 {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0 10px;
}

.checkbox-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.link-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    border: 2px solid #4a6491;
    border-radius: 4px;
    background: white;
    transition: all 0.2s;
}

.link-checkbox:checked {
    background: #4a6491;
    border-color: #4a6491;
}

.link-checkbox:checked::after {
    content: "✓";
    display: block;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
}

/* 树形目录样式 */
.tree {
    list-style: none;
    padding-left: 20px;
}

.tree li {
    margin: 10px 0;
    position: relative;
    list-style-type: none;
}

.tree li::before {
    content: "";
    position: absolute;
    top: 12px;
    left: -15px;
    width: 10px;
    height: 1px;
    background: #888;
}

.tree li::after {
    content: "";
    position: absolute;
    top: -8px;
    left: -15px;
    height: 100%;
    width: 1px;
    background: #888;
}

.tree li:last-child::after {
    height: 20px;
}

.tree-caret {
    cursor: pointer;
    user-select: none;
    padding: 8px 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.tree-caret:hover {
    background: rgba(74, 100, 145, 0.1);
}

.tree-caret::before {
    content: "▸";
    display: inline-block;
    margin-right: 10px;
    transition: transform 0.3s;
    width: 15px;
    font-size: 1rem;
}

.tree-caret-down::before {
    transform: rotate(90deg);
}

.nested {
    display: none;
    padding-left: 25px;
}

.active {
    display: block;
}

.tree-leaf {
    padding: 8px 15px 8px 35px;
    cursor: pointer;
    border-radius: 6px;
    display: block;
    color: #555;
    transition: all 0.3s;
    font-size: 1.05rem;
}

.tree-leaf:hover, .tree-leaf.active-leaf {
    background: rgba(74, 100, 145, 0.15);
    color: #2c3e50;
    font-weight: 600;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.3rem;
    grid-column: 1 / -1;
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
    background: rgba(0, 0, 0, 0.25);
    margin-top: 20px;
    border-radius: 10px;
    font-size: 1rem;
}

@media (max-width: 1200px) {
    .links-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .links-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eaeaea;
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .links-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    header h1 {
        font-size: 2.2rem;
    }

    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .batch-controls {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .links-grid {
        grid-template-columns: 1fr;
    }

    .search-container {
        margin: 20px 15px;
    }

    header {
        padding: 20px 15px;
    }

    .batch-controls {
        flex-wrap: wrap;
    }
}

/* 自定义图标 */
.icon {
    display: inline-block;
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    font-size: 1.8rem;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.link-card {
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.batch-indicator {
    background: #4a6491;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-left: 10px;
    display: inline-block;
}