/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: #f4f4f4;
}

#data-count {
    font-size: 14px; /* 增加字体大小 */
    font-weight: bold; /* 字体加粗 */
    color: #ffffff; /* 使用绿色表示加载成功 */
    #background-color: #007bff; /* 设置浅色背景 */
    #border-radius: 4px; /* 圆角边框 */
    padding: 8px 20px; /* 内边距 */
    text-align: center; /* 水平居中 */
    margin-top: auto; /* 与上一个元素的间距 */
    transition: opacity 0.5s ease; /* 渐变显示动画 */
    opacity: 0; /* 默认透明 */
}

/* 当数据加载完成时，添加一个类来显示文本 */
#data-count.loaded {
    opacity: 1; /* 渐变显示 */
}

/* 加载遮罩层样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.visible {
    opacity: 1;
    visibility: visible;
}


.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

#loading-text {
    color: #333;
    font-size: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 背景容器 */
.wrapper {
    height: 100vh;
    width: 100%;
    background: linear-gradient(180deg, #04fafd 5%, #119dff 50%, #030423);
    position: fixed;
    z-index: -1;
    overflow: hidden;
}

/* 气泡容器 */
#bubbles-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* 气泡样式 */
.bubble {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: float-up var(--duration) linear infinite;
    opacity: var(--opacity);
}

/* 气泡上升动画 */
@keyframes float-up {
    0% {
        transform: translateY(100vh) scale(0) rotate(0deg);
        opacity: var(--opacity);
    }
    50% {
        opacity: var(--opacity);
    }
    100% {
        transform: translateY(-100px) scale(1) rotate(360deg);
        opacity: 0;
    }
}

/* 内容容器 */
.content {
    position: relative;
    z-index: 1;
    padding: 20px;
    max-width: 992px; /* 限制最大宽度 */
    margin: 0 auto;
}

/* 标题样式 */
h1 {
    font-size: 32px;
    text-align: center;
    color: #333;
    margin-bottom: 10px;
}

h2 {
    font-size: 18px;
    text-align: center;
    color: #555;
    margin-bottom: 20px;
}

/* 筛选按钮 */
.filters {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.filters button {
    flex: 1; /* 每个按钮均分可用空间 */
    min-width: 60px; /* 设置按钮最小宽度，确保按钮在小屏幕上不太窄 */
    max-width: 120px; /* 设置按钮最大宽度 */
    padding: 10px 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: center;
    white-space: nowrap; /* 防止按钮文字换行 */
    border-radius: 4px;
}

.filters button:hover {
    background-color: #ddd;
}

.filters button.active {
    background-color: #007bff;
    color: white;
}

/* 搜索框 */
#search-input {
    width: 100%;
    max-width: 100%; /* 确保搜索框不超过容器宽度 */
    padding: 10px;
    margin: 10px 0;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

/* 操作按钮区域样式 */
.action-buttons {
    display: flex;
    justify-content: space-between; /* 在PC端两端对齐 */
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.action-buttons button {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    flex: 1 1 auto;
    max-width: 200px;
}

.action-buttons button:hover {
    background-color: #0056b3;
}

/* 每页显示数量设置样式 */
.items-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    flex: 1 1 auto;
    justify-content: flex-end; /* 在PC端靠右对齐 */
}

.items-per-page label {
    color: #333;
    white-space: nowrap;
}

.items-per-page select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

/* 资源卡片列表 */
.resource-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    max-width: 992px;
    margin-left: auto;
    margin-right: auto;
}

/* 修改为最多3列 */
@media (min-width: 992px) {
    .resource-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 平板设备显示2列 */
@media (max-width: 991px) and (min-width: 768px) {
    .resource-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机设备显示1列 */
@media (max-width: 767px) {
    .resource-list {
        grid-template-columns: 1fr;
    }
}

.resource-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.resource-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    flex-grow: 1;
}

.resource-card p {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.resource-card .source-link {
    display: inline-block;
    margin-top: auto;
    padding: 5px 10px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
}

/* 分页区域样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 12px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap; /* 添加防止文字换行的样式 */
}

.pagination button:hover:not(:disabled) {
    background-color: #e9ecef;
}

.pagination button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination .ellipsis {
    padding: 0 8px;
    color: #6c757d;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .filters {
        gap: 5px; /* 缩小间距，适配小屏幕 */
    }

    .filters button {
        flex: 1; /* 均分宽度，确保按钮在一行显示 */
    }

    .action-buttons {
        justify-content: space-between;
    }

    .items-per-page {
        justify-content: flex-end;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 16px;
    }
}
