/* AI应用列表页面样式 - 暗色主题 */

/* 导航分类样式 */
.nav-category {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    padding-bottom: 4px;
    position: relative;
    transition: color 0.3s ease;
    text-decoration: none;
    white-space: nowrap; /* 防止标签内文字换行 */
}

.nav-category:hover {
    color: #e0e0e0;
}

.nav-category.active {
    color: #ffffff;
}

.nav-category.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #00ff7f; /* 绿色下划线，模拟图片中的效果 */
}

/* 搜索框样式优化 */
#searchInput {
    transition:
        border-color 0.3s ease,
        background-color 0.3s ease;
}

#searchInput:focus {
    border-color: #4f46e5 !important; /* 使用紫色焦点边框，更现代化 */
    box-shadow: none; /* 移除默认阴影 */
}

/* 确保分类导航在小屏幕上正确换行 */
@media (max-width: 768px) {
    .nav-category {
        font-size: 14px;
        margin-bottom: 8px;
    }
}

/* 网格布局容器 */
.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 默认显示4个 */
    gap: 1rem;
    padding: 0; /* 移除内边距，让内容与页面边距对齐 */
}

/* 2K屏幕及更大屏幕显示5列 */
@media (min-width: 1920px) {
    .grid-container {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1280px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-container {
        grid-template-columns: repeat(1, 1fr);
    }
}

.agent-card {
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        border-color 0.3s ease;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    width: 100%;
    height: 240px; /* 恢复原来的卡片高度 */
    position: relative; /* 为绝对定位分类标签做准备 */
    display: flex;
    flex-direction: column;
    background-color: #1f2937; /* 确保背景色 */
    cursor: pointer; /* 添加鼠标悬停为小手效果 */
}

.agent-card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.5),
        0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

/* 分类标签悬浮在右上角 */
.category-badge {
    position: absolute;
    top: 0.53rem;
    right: 0.5rem;
    z-index: 1;
    font-size: 0.65rem;
}

.agent-card .p-6 {
    padding: 1.5rem; /* 保持原有内边距 */
    flex: 1;
    display: flex;
    flex-direction: column;
}

.agent-card .mt-6 {
    margin-top: 1.5rem; /* 增加按钮区域的上边距 */
    margin-bottom: 0.5rem; /* 确保按钮区靠近底部 */
}

.pagination-active {
    background: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
    color: #f8fafc;
    border-color: #4cc9f0;
}

/* 响应式布局调整 */
@media (max-width: 768px) {
    .agent-card {
        margin-bottom: 1rem;
    }

    .search-filter-container {
        flex-direction: column;
        gap: 1rem;
    }
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 分页按钮样式 - 暂时保留，可能需要移除 */
.pagination-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover {
    transform: translateY(-1px);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
    border-color: #4cc9f0;
    color: #f8fafc;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* AI应用卡片响应式调整 */
.agent-card-content {
    display: flex;
    flex-direction: row;
}

@media (max-width: 640px) {
    .agent-card-content {
        flex-direction: column;
    }

    .agent-card-avatar {
        margin-bottom: 1rem;
    }
}

/* 按钮样式 */
.agent-use-btn {
    background: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
}

.agent-use-btn:hover {
    background: linear-gradient(135deg, #4361ee 0%, #4cc9f0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.agent-view-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-view-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* 无限滚动加载 */
.infinite-scroll-loader {
    display: flex;
    justify-content: center;
    padding: 2rem;
    width: 100%;
}

/* 无更多数据提示 */
.no-more-data {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* 优化卡片内部间距 */
.agent-card .p-6 {
    padding: 1rem; /* 增加内边距，改善紧凑感 */
    display: flex;
    flex-direction: column;
    height: calc(100% - 2rem); /* 减去新的padding高度 */
}

.agent-card .content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative; /* 为内容元素定位做准备 */
    margin-top: 1rem; /* 增加内容顶部间距 */
}

/* 图标和标题在同一行 */
.title-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem; /* 增加标题行的下边距 */
}

.agent-card .ml-4 {
    margin-left: 0.75rem; /* 增加头像和内容间距 */
}

/* 描述信息单独一行，限制高度并显示省略号 */
.description {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* 显示3行后添加省略号 */
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    line-height: 1.4; /* 稍微减小行高 */
    margin-bottom: 0.5rem; /* 增加描述信息底部间距 */
    padding-bottom: 0.25rem; /* 添加底部内边距，避免文字被遮挡 */
    box-sizing: border-box; /* 确保padding计算正确 */
}

.agent-card .button-wrapper {
    margin-top: 0.5rem; /* 增加按钮区域的上边距 */
    margin-bottom: 0.25rem;
}

/* 按钮间距 */
.agent-card .space-x-3 > * {
    margin-right: 0.5rem; /* 适度按钮间距 */
}

.agent-card .space-x-3 > *:last-child {
    margin-right: 0;
}

/* 确保图标大小一致 */
.agent-card .w-16.h-16 {
    width: 4rem;
    height: 4rem;
}

/* 确保图标正确显示 */
.agent-card img {
    object-fit: cover;
    border-radius: 0.75rem; /* 与卡片相同的圆角 */
}

/* 调整标题样式 */
.agent-card .text-lg.font-semibold {
    margin-bottom: 0.25rem;
}

/* 标题下方的统计信息 - 与my-agents页面保持一致 */
.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
}

.stat-item {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    color: #9ca3af;
}

.stat-item i {
    color: #60a5fa;
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

.stat-item:nth-child(2) i {
    color: #60a5fa;
}

.stat-label {
    color: #9ca3af;
    margin-right: 0.25rem;
}

.stat-value {
    color: #d1d5db;
    font-weight: 400;
}

.stat-item:nth-child(2) .stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #60a5fa;
}

.stat-unit {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.7rem;
    margin-left: 0.125rem;
}

/* 调整分类标签 - 放在右上角 */
.agent-card .flex.items-center.justify-between .span {
    align-self: flex-start; /* 让分类标签对齐到顶部 */
}

/* 调整分类标签 */
.agent-card .px-2\.5\.py-0\.5 {
    padding: 0.2rem 0.5rem;
}

/* 调整按钮内边距 - 更小的按钮 */
.agent-card .py-1\.5\.px-3 {
    padding: 0.375rem 0.75rem;
}

/* 按钮容器右对齐 */
.agent-card .button-wrapper.justify-end {
    justify-content: flex-end;
}

/* 自定义下拉菜单样式 - 与搜索框风格一致 */
.sort-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    background-color: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 0.5rem;
    width: 140px;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-trigger:hover {
    background-color: #374151;
    border-color: #6b7280;
}

.dropdown-trigger:focus {
    outline: none;
    border-color: #6b7280;
    box-shadow: none;
}

.dropdown-trigger .fa-chevron-down.rotate {
    transform: rotate(180deg);
}

.dropdown-menu {
    background-color: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    position: relative;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 400;
}

.dropdown-item:hover {
    background-color: #374151;
}

.dropdown-item.active {
    background-color: #374151;
    color: #ffffff;
}

.dropdown-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #3b82f6;
}

/* 图标样式优化 */
.dropdown-item i {
    width: 16px;
    text-align: center;
}

/* 响应式调整 */
@media (max-width: 640px) {
    .dropdown-trigger {
        font-size: 0.875rem;
        padding: 0.625rem 0.75rem;
    }
    
    .dropdown-menu {
        width: 100%;
        min-width: unset;
    }
    
    .dropdown-item {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}
