/* 全局样式 */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #f6f7ff 0%, #f1f5f9 100%);
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --card-hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* 加载页面样式 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    width: auto;
    height: 120px;
    margin-bottom: 2rem;
    animation: pulse 2s infinite;
    object-fit: contain;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(79, 70, 229, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 1rem;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 500;
    animation: fadeInOut 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(79, 70, 229, 0));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 20px rgba(79, 70, 229, 0.3));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(79, 70, 229, 0));
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
}

/* 卡片样式 */
.category-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease-out;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

/* 链接项样式 */
.link-item {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    display: block;
    text-decoration: none;
    cursor: default;
}

.link-item:hover {
    background: rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
    border-color: rgba(79, 70, 229, 0.2);
}

/* 拖拽相关样式 */
.sortable-ghost {
    opacity: 0.4;
    background: rgba(79, 70, 229, 0.1);
}

.sortable-chosen {
    transform: rotate(5deg);
}

.sortable-drag {
    transform: rotate(5deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.cursor-move {
    cursor: default;
}

.cursor-move:active {
    cursor: default;
}

/* 展开按钮样式 */
.toggle-btn, .collapse-btn {
    background: rgba(243, 244, 246, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(209, 213, 219, 0.3);
    transition: all 0.2s ease;
}

.toggle-btn:hover, .collapse-btn:hover {
    background: rgba(229, 231, 235, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 分类标题优化 */
.category-card h2 {
    border-bottom: 2px solid rgba(79, 70, 229, 0.1);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* 点击统计样式 */
.click-count {
    font-size: 0.75rem;
    color: #3b82f6;
    font-weight: 500;
}

/* 展开内容动画 */
.expanded-content {
    transition: all 0.3s ease;
}

/* 展开区域样式优化 */
.expanded-links {
    border: 1px solid rgba(229, 231, 235, 0.5);
    border-radius: 8px;
    padding: 12px;
    background: rgba(249, 250, 251, 0.5);
    backdrop-filter: blur(5px);
}

/* 收起按钮特殊样式 */
.collapse-btn {
    margin-top: 8px;
    background: rgba(239, 246, 255, 0.8);
    border-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.collapse-btn:hover {
    background: rgba(219, 234, 254, 0.9);
    border-color: rgba(59, 130, 246, 0.3);
}

/* 展开区域拖拽优化 */
.sortable-container.expanded {
    min-height: 60px;
    border: 2px dashed transparent;
    transition: border-color 0.2s ease;
}

.sortable-container.expanded:hover {
    border-color: rgba(79, 70, 229, 0.2);
}

/* 拖拽时的视觉反馈 */
.sortable-container.expanded .sortable-ghost {
    background: rgba(79, 70, 229, 0.1);
    border: 2px dashed rgba(79, 70, 229, 0.3);
}

/* 排名图标样式 */
.rank-icon {
    font-size: 0.875rem;
}

/* 搜索引擎按钮样式 */
.search-engine-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    background: transparent;
    border: none;
    color: #6b7280;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.search-engine-btn:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.search-engine-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.search-engine-btn i {
    font-size: 1rem;
}

.search-engine-btn span {
    font-size: 0.875rem;
}

/* 搜索框样式优化 */
.search-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 8px 32px rgba(79, 70, 229, 0.2);
    transform: translateY(-2px);
}

#searchInput {
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.125rem;
    color: #374151;
}

#searchInput::placeholder {
    color: #9ca3af;
}

/* 按钮样式 */
.btn-primary {
    background: var(--primary-color);
    color: white;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* 管理按钮样式 */
.admin-btn {
    background: rgba(79, 70, 229, 0.9);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--card-shadow);
}

.admin-btn:hover {
    background: rgba(67, 56, 202, 0.9);
    transform: translateY(-2px);
    box-shadow: var(--card-hover-shadow);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-card {
    animation: fadeIn 0.5s ease-out;
}

/* 响应式调整 */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    #searchEngine {
        border-radius: 0.5rem 0.5rem 0 0;
        width: 100%;
    }
    
    #searchInput {
        border-radius: 0;
        width: 100%;
    }
    
    .search-btn {
        border-radius: 0 0 0.5rem 0.5rem;
        width: 100%;
    }
    
    .search-engine-btn {
        padding: 0.5rem 1rem;
        gap: 0.25rem;
    }
    
    .search-engine-btn span {
        display: none;
    }
    
    .search-engine-btn i {
        font-size: 1.125rem;
    }
    
    #searchInput {
        font-size: 1rem;
        padding: 1rem 1.5rem;
    }
    
    .btn-primary {
        padding: 1rem 1.5rem;
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 70, 229, 0.7);
}

/* 回到顶部按钮样式 */
#backToTop {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#backToTop:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

/* 页面滚动优化 */
html {
    scroll-behavior: smooth;
}

/* 导航内容区域优化 */
#navigationContent {
    max-height: none;
}

/* 分类卡片间距优化 */
.category-card {
    margin-bottom: 1.5rem;
}

/* 链接项优化 */
.link-item {
    margin-bottom: 0.5rem;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .category-card {
        margin-bottom: 1rem;
    }
    
    #backToTop {
        width: 44px;
        height: 44px;
    }
    
    .admin-btn span {
        display: none;
    }
    
    .admin-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
    }
}

/* 响应式网格优化 */
@media (max-width: 1024px) {
    #navigationContent {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #navigationContent {
        grid-template-columns: 1fr;
    }
    
    .category-card .grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1280px) {
    .category-card .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 文本截断优化 */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 链接项内容优化 */
.link-item .flex {
    align-items: flex-start;
}

.link-item .w-5 {
    margin-top: 2px;
}

/* Toast 提示样式 */
.toast {
    z-index: 1000;
}

/* 重置按钮样式 */
.reset-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: rgba(79, 70, 229, 0.1);
}

/* 网站图标样式 */
.site-icon {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.site-icon-small {
    width: 20px;
    height: 20px;
    object-fit: cover;
    border-radius: 3px;
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 拖拽手柄样式 */
.drag-handle {
    opacity: 0.4;
    transition: all 0.2s ease;
    cursor: grab;
}

.drag-handle:hover {
    opacity: 0.8;
    background: rgba(79, 70, 229, 0.1) !important;
    transform: scale(1.1);
    cursor: grab;
}

.link-item:hover .drag-handle {
    opacity: 0.6;
}

.drag-handle:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* 链接项布局优化 */
.link-item .flex {
    align-items: center;
    justify-content: space-between;
}

/* 确保拖拽手柄始终可见 */
.sortable-container .link-item {
    position: relative;
}

.sortable-container .link-item::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sortable-container .link-item:hover::after {
    opacity: 1;
}

/* 图标容器样式 */
.icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    padding: 2px;
}

/* 图标加载动画 */
.icon-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 链接区域保持正常光标 */
.link-item a {
    cursor: pointer;
} 