/* 全局样式 */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: #333;
    white-space: normal;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}

a {
    color: #0066cc;
    text-decoration: none;
    /* 允许链接在内容容器内换行，移除强制不换行 */
    white-space: normal;
}

a:hover {
    text-decoration: underline;
}

/* 顶部区域样式 */
.header-container {
    display: flex;
    justify-content: center;
    margin: 0 auto;
    width: 800px;
    background-color: #2c3e50;
}

.header-content {
    padding: 20px 0;
    text-align: center;
    width: 100%;
}

.logo-container {
    margin-bottom: 15px;
}

.logo {
    color: white;
    margin: 0;
    font-size: 28px;
}

.logo-description {
    color: #bdc3c7;
    margin: 5px 0 15px;
    font-size: 14px;
    white-space: pre-wrap;
}

/* 搜索框样式 */
.search-container {
    margin: 0 auto;
    max-width: 600px;
}

.search-form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-box {
    display: flex;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    outline: none;
}

.search-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.search-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: #2980b9;
}

.search-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.search-button.loading {
    position: relative;
    padding-left: 35px;
}

.search-button.loading::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

.search-tips {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: pre-wrap;
}

.search-tips.error {
    color: #e74c3c;
    background-color: #ffebee;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ef9a9a;
    opacity: 1;
}

/* 主内容区域样式 */
.main-container {
    padding: 20px 0;
    width: 800px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 22px;
}

.site-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 0;
    list-style: none;
}

.site-item {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px 15px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.site-info {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.site-info h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 20px;
}

/* 核心修复：链接换行对齐逻辑 */
.site-detail {
    margin: 8px 0;
    display: flex;
    align-items: flex-start; /* 内容顶部对齐，避免换行后垂直偏移 */
    width: 100%; /* 确保容器占满宽度 */
}

/* 左侧标签：固定宽度，不换行 */
.site-detail strong {
    width: 120px;
    color: #7f8c8d;
    font-weight: normal;
    flex-shrink: 0; /* 固定宽度，不被挤压 */
    padding-top: 2px; /* 微调垂直位置，与内容对齐 */
}

/* 右侧内容容器：仅在该容器内换行，且换行后与容器左侧对齐 */
.site-detail .site-content {
    flex: 1; /* 占据剩余宽度（父容器宽度 - 左侧标签宽度） */
    min-width: 0; /* 允许容器宽度小于内容宽度，触发换行 */
    overflow-wrap: break-word; /* 超出容器宽度时自动换行 */
    word-break: normal; /* 保持单词完整性（可选） */
}

/* 链接和文字在内容容器内自然换行，不强制单行 */
.site-detail .site-content a,
.site-detail .site-content span {
    white-space: normal; /* 允许换行 */
}

.site-description {
    line-height: 1.6;
    margin-top: 15px;
    white-space: pre-wrap;
}

/* TAG标签页样式 */
.tag-cloud {
    text-align: center;
    padding: 20px 0;
}

.tag-item {
    display: inline-block;
    margin: 5px;
    padding: 5px 15px;
    background-color: #ecf0f1;
    border-radius: 15px;
    transition: background-color 0.3s;
}

.tag-item:hover {
    background-color: #bdc3c7;
    text-decoration: none;
}

/* 底部区域样式 */
.footer-container {
    display: flex;
    justify-content: center;
    margin: 0 auto;
    width: 800px;
    background-color: #2c3e50;
    margin-top: 30px;
}

.footer-content {
    padding: 20px 0;
    text-align: center;
    color: white;
    width: 100%;
    white-space: pre-wrap;
}

.footer-links {
    margin-bottom: 15px;
}

.footer-link {
    color: white;
    margin: 0 10px;
    display: inline-block;
    margin-bottom: 8px;
}

.footer-text {
    font-size: 14px;
    color: #bdc3c7;
}

/* 返回顶部按钮 */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

#back-to-top.visible {
    opacity: 1;
}

#back-to-top:hover {
    background-color: #2980b9;
}

/* 响应式布局 */
@media (max-width: 800px) {
    .header-container,
    .main-container,
    .footer-container {
        width: 100%;
        padding: 0 15px;
        box-sizing: border-box;
    }

    .site-list {
        grid-template-columns: 1fr;
    }

    /* 手机端左侧标签宽度缩小，适配屏幕 */
    .site-detail strong {
        width: 80px;
    }
}

h3 {
    text-align: center;
    margin: 0 auto;
    width: fit-content;
}

a.special-link {
  display: inline-block;
  padding: 4px 16px;
  border: 2px solid #6495ED;
  border-radius: 50px;
  background-color: #6495ED;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  line-height: 1;
}

a.special-link:hover {
  background-color: #4876FF;
  border-color: #4876FF;
}