/* 基础变量定义 */
:root {
    --items-per-row: 4;
}

/* 动画定义 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 基础网格布局 */
.site-grid {
    display: grid;
    grid-template-columns: repeat(var(--items-per-row, 4), 1fr);
    gap: 20px;
    padding: 20px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

/* 确保分类内容区域的站点网格也应用相同的布局 */
.mt-2 .site-grid {
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
}

/* 淡入动画效果 */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* 站点卡片样式 */
.site-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* 更多按钮卡片特殊样式 */
.site-card.more-card {
    background: linear-gradient(145deg, #f8f9ff, #f0f2ff);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.site-card.more-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.15);
    background: linear-gradient(145deg, #f0f2ff, #e5e7ff);
}

.site-card.more-card:active {
    transform: translateY(0) scale(0.98);
}

/* 为普通站点卡片设置悬停和激活样式 */
.site-card:not(.more-card):hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e5e9;
}

.site-card:not(.more-card):active {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* 站点首字母/图标样式 */
.site-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    margin: 0 auto 12px;
    color: white;
    transition: all 0.3s ease;
}

.site-card:hover .site-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 站点名称样式 */
.site-name {
    font-size: 14px;
    color: #2c3e50;
    margin-top: 8px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

/* 分类标题样式 */
.category-title {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    margin-bottom: 1px;
}

.category-title:hover {
    background: #e9ecef;
}

.category-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    flex: 1;
}

/* 分类内容区域 */
.category-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* 分类图标样式 */
.category-icon {
    margin-left: 12px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #6b7280;
}

.category-icon:hover {
    color: #007bff;
}

.category-icon.rotate-180 {
    transform: rotate(180deg);
}

.category-icon svg {
    transition: color 0.2s ease;
}

/* 展开动画 */
.category-content-enter-active,
.category-content-leave-active {
    transition: all 0.3s ease;
}

.category-content-enter-from,
.category-content-leave-to {
    opacity: 0;
    transform: translateY(-10px);
}

/* 空数据提示样式 */
.empty-data {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 16px;
}

/* 悬浮按钮样式 */
.floating-buttons {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
}

.floating-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.floating-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.floating-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.home-button {
    background-color: #93c5fd; /* 更柔和的蓝色 */
}

.manage-button {
    background-color: #6ee7b7; /* 更柔和的绿色 */
}

.clear-cache-button {
    background-color: #fda4af; /* 更柔和的红色 */
}

/* 控制按钮样式 */
.control-button {
    background-color: #f1f5f9; /* 接近背景色的浅灰色 */
    color: #64748b; /* 深色文字确保可见性 */
    z-index: 1001; /* 确保控制按钮在最上层 */
    transition: all 0.3s ease;
    border: 1px dashed #d8d4d4;
}

.control-button:hover {
    background-color: #e2e8f0; /* 悬停时稍深的灰色 */
}

/* 展开状态的控制按钮旋转图标 */
.control-button.expanded svg {
    transform: rotate(45deg);
    transition: transform 0.3s ease;
}

.control-button svg {
    transition: transform 0.3s ease;
}

/* 确保按钮组在展开时每个按钮都有正确的定位 */
.floating-buttons {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: block;
}

/* 按钮组容器样式 */
.floating-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    transition: all 0.3s ease;
    position: absolute;
    bottom: 75px; /* 刚好在控制按钮上方 */
    right: 0;
    z-index: 999; /* 按钮组在控制按钮下方 */
}

/* 展开状态的按钮组 */
.floating-buttons-group.expanded {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* 确保控制按钮总是可见且在最上层 */
.floating-button.control-button {
    z-index: 1001;
    position: relative;
}

.button-text {
    display: none;
    position: absolute;
    right: 70px;
    padding: 6px 12px;
    border-radius: 4px;
    color: #333;
    background-color: white;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.floating-button:hover .button-text {
    display: block;
}

.button-text::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -5px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid white;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

/* 骨架屏样式 */
.skeleton-category-title {
    height: 40px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-site-card {
    min-height: 100px;
    background-color: #f8f8f8;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.skeleton-site-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 12px;
}

.skeleton-site-name {
    width: 80%;
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* 响应式布局 */
@media (max-width: 1200px) {
    :root {
        --items-per-row: 3;
    }
    
    .site-grid {
        grid-template-columns: repeat(var(--items-per-row, 3), 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    :root {
        --items-per-row: 2;
    }
    
    .floating-buttons {
        bottom: 20px;
        right: 20px;
    }
    
    .floating-button {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 576px) {
    .site-grid {
        grid-template-columns: repeat(var(--items-per-row, 2), 1fr);
        gap: 14px;
        padding: 16px;
    }

    .site-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .category-title h3 {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    :root {
        --items-per-row: 1;
    }
    
    .site-grid {
        grid-template-columns: repeat(var(--items-per-row, 1), 1fr);
        gap: 12px;
        padding: 12px;
    }

    .site-card {
        padding: 12px 8px;
    }

    .site-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .site-name {
        font-size: 12px;
    }

    .container-sm,
    .container {
        max-width: 560px;
    }
}