/* 友情链接主要样式 */
.friends-title {
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    color: #1976d2;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}
.friends-title span {
    border-bottom: 3px solid #42a5f5;
    padding-bottom: 4px;
}
.friends-desc {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

/* 修复友链页面加载器的显示问题 */
#friendslink-container {
    position: relative;
    min-height: 300px; /* 确保容器高度足够显示加载动画 */
    width: 100%;
    margin-bottom: 2rem;
    overflow: visible; /* 确保溢出内容可见 */
}

/* 特定于友链页面的加载容器样式 */
#friends-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    min-height: 200px;
    background-color: transparent;
    color: #1976d2;
    z-index: 5; /* 降低加载器的z-index，确保内容显示时可以覆盖它 */
    pointer-events: none; /* 避免阻挡下方内容的点击 */
}

/* 特定于友链页面的空状态样式 */
#no-friends {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    text-align: center;
    z-index: 10;
    display: none; /* 默认隐藏 */
}

/* 修正友链网格布局 - 始终使用固定的3列网格 */
#friends-grid {
    display: grid !important; /* 强制使用grid布局 */
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 1.5rem;
    width: 100%;
    margin-top: 1rem;
    box-sizing: border-box;
    z-index: 10;
    position: relative;
}

/* 响应式设计 */
@media (max-width: 992px) {
    #friends-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #friends-grid {
        grid-template-columns: 1fr;
        grid-gap: 1rem;
    }
    
    .api-card {
        padding: 1.25rem;
    }
}

/* 友链卡片基本样式 */
.api-card {
    position: relative;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    min-height: 120px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.api-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 友情链接卡片内容布局 */
.friend-link-card {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
    position: relative; /* 确保内部元素的绝对定位是相对于这个元素 */
}

.friend-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
    min-height: 80px;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

/* 头像样式 */
.friend-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e0e0e0;
    background: #fff;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* 使用备用图标的样式 */
.friend-card-avatar.fallback-avatar {
    border: 1px solid #e0e0e0;
    box-shadow: inset 0 0 3px rgba(0,0,0,0.1);
}

/* 特殊处理的头像样式 */
.friend-card-avatar.special-avatar {
    border: 2px solid #1976d2;
    box-shadow: 0 0 5px rgba(25, 118, 210, 0.5);
    position: relative;
}

/* 特殊头像的装饰效果 */
.friend-card-avatar.special-avatar::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 1px solid rgba(25, 118, 210, 0.3);
    animation: pulse 2s infinite;
}

/* 图标加载完全失败的样式 */
.friend-card-avatar.avatar-load-error {
    background-color: #f5f5f5;
    border: 1px dashed #ccc;
    position: relative;
}

/* 创建一个简单的图标占位符 */
.friend-card-avatar.avatar-load-error::after {
    content: "?";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #aaa;
    font-weight: bold;
}

/* 友链内容区域 */
.friend-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* 解决文本溢出问题 */
    overflow: hidden; /* 确保内容不溢出 */
}

/* 标题样式 */
.api-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    margin-right: 20px; /* 为状态点留出空间 */
    color: #1976d2;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 描述样式 */
.api-description {
    color: #666;
    margin-bottom: 0;
    line-height: 1.4;
    font-size: 1rem;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 状态点样式 */
.friend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    cursor: pointer;
    transition: all 0.3s ease;
}

.friend-dot:hover {
    transform: scale(1.2);
}

/* 卡片级联动画效果 */
@keyframes cascadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.cascade-item {
    animation: cascadeIn 0.6s ease forwards;
    opacity: 0;
}

/* 状态点颜色 */
.friend-dot[data-status="在线"] {
    background-color: #4caf50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

.friend-dot[data-status="离线"] {
    background-color: #f44336;
    box-shadow: 0 0 5px rgba(244, 67, 54, 0.5);
}

.friend-dot[data-status="加载中"] {
    background-color: #ff9800;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.apply-section {
    background: #fafbfc;
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.apply-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: #444;
}

.apply-title span {
    border-bottom: 2px solid #bdbdbd;
    padding-bottom: 2px;
}

.apply-section ul {
    margin: 1rem 0 1.5rem 0;
    padding-left: 1.5rem;
}

.apply-section li {
    margin-bottom: 0.7rem;
    color: #333;
    font-size: 1rem;
    list-style: none;
    position: relative;
}

.apply-section li:before {
    content: '✔';
    color: #43a047;
    font-weight: bold;
    margin-right: 0.5em;
}

.apply-btn {
    background: #4285f4;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.apply-btn:hover {
    background: #1976d2;
}

/* 移动设备样式优化 */
@media (max-width: 768px) {
    .apply-section {
        padding: 1rem;
    }
    
    .friend-card {
        min-height: 80px;
        gap: 1rem;
    }
    
    .friend-card-avatar {
        width: 50px;
        height: 50px;
    }
    
    .api-title {
        font-size: 1.1rem;
    }
}