/**
 * All of the CSS for your public-facing functionality should be
 * included in this file.
 */

/* 基础容器样式 - 宽度由PHP动态生成 */
.friends-plugin-container {
    box-sizing: border-box;
    width: 100%;
}

/* 确保在侧边栏或小容器中也能正常显示 */
.widget .friends-plugin-container,
.sidebar .friends-plugin-container {
    max-width: none;
    margin: 0;
    padding: 10px 0;
}

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

.friend-card {
    background: #fff;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #eee;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.friend-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.friend-name {
    margin: 0 0 8px 0;
    font-size: 1em;
    font-weight: 600;
}

.friend-name a {
    color: #333;
    text-decoration: none;
}

.friend-name a:hover {
    color: #0073aa;
}

.friend-description {
    margin: 0 0 12px 0;
    font-size: 0.85em;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.friend-latest-post {
    font-size: 0.85em;
    color: #666;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}

.latest-post-title {
    display: block;
    color: #333;
    text-decoration: none;
    margin-bottom: 4px;
    font-size: 0.9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.latest-post-title:hover {
    color: #0073aa;
}

.latest-post-date {
    font-size: 0.8em;
    color: #999;
}

.no-latest-post {
    color: #999;
    font-style: italic;
    font-size: 0.85em;
}

/* 超窄屏幕适配（< 480px） */
@media screen and (max-width: 480px) {
    .friends-plugin-container {
        padding: 10px;
    }
    
    .friends-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .friend-card {
        padding: 12px;
    }
    
    .friend-name {
        font-size: 0.95em;
    }
    
    .friend-description {
        font-size: 0.8em;
        -webkit-line-clamp: 3;
    }
    
    .friend-latest-post {
        font-size: 0.8em;
        padding-top: 10px;
    }
    
    .latest-post-title {
        font-size: 0.85em;
    }
    
    .latest-post-date {
        font-size: 0.75em;
    }
}

/* 窄屏幕适配（480px - 768px） */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .friends-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
    
    .friend-card {
        padding: 14px;
    }
    
    .friend-name {
        font-size: 0.95em;
    }
    
    .friend-description {
        font-size: 0.82em;
    }
    
    .friend-latest-post {
        font-size: 0.82em;
    }
}

/* 中等屏幕适配（768px - 992px） */
@media screen and (min-width: 769px) and (max-width: 992px) {
    .friends-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    
    .friend-description {
        font-size: 0.88em;
    }
}

/* 宽容器样式 */
.friends-plugin-container.wide-container .friends-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.friends-plugin-container.wide-container .friend-card {
    padding: 18px;
}

/* 窄容器适配（720px以下） */
.friends-plugin-container.narrow-container .friends-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.friends-plugin-container.narrow-container .friend-card {
    padding: 14px;
}

.friends-plugin-container.narrow-container .friend-name {
    font-size: 0.95em;
}

.friends-plugin-container.narrow-container .friend-description {
    font-size: 0.85em;
}

/* 非常窄的容器（480px以下） */
.friends-plugin-container.very-narrow-container .friends-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.friends-plugin-container.very-narrow-container .friend-card {
    padding: 12px;
}

.friends-plugin-container.very-narrow-container .friend-name {
    font-size: 0.9em;
}

.friends-plugin-container.very-narrow-container .friend-description {
    font-size: 0.8em;
    -webkit-line-clamp: 2;
}

.friends-plugin-container.very-narrow-container .latest-post-title {
    font-size: 0.8em;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .friend-card {
        background: #222;
        border-color: #333;
    }

    .friend-name a {
        color: #e0e0e0;
    }

    .friend-description {
        color: #999;
    }

    .friend-latest-post {
        border-top-color: #333;
    }

    .latest-post-title {
        color: #e0e0e0;
    }

    .latest-post-date,
    .no-latest-post {
        color: #666;
    }
}