/* 殆知阁文本参考系统 - 样式表 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 - Arctic reflection 配色 */
#header {
    background: #243C4C;
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.menu {
    display: flex;
    gap: 1rem;
}

.menuitem {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.menuitem:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.menuitem.active {
    background-color: rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

/* 页面内容 */
#pagecontent {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: calc(100vh - 250px);
}

/* 视图切换 */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* 标题 */
h2 {
    color: #243C4C;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid #5289AD;
    padding-bottom: 0.5rem;
}

h3 {
    color: #243C4C;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

/* 信息框 */
.info-box {
    background-color: #F4FCFB;
    border-left: 4px solid #5289AD;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 5px;
}

.info-box ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.info-box li {
    margin-bottom: 0.5rem;
}

/* 搜索框 */
.search-box,
.search-form {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.search-box input,
.search-form input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.search-box input:focus,
.search-form input:focus {
    outline: none;
    border-color: #5289AD;
}

.search-form select {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    background-color: white;
}

button {
    padding: 0.75rem 1.5rem;
    background: #5289AD;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background: #243C4C;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(82, 137, 173, 0.3);
}

button:active {
    transform: translateY(0);
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 2rem;
}

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

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

/* 结果容器 */
.results-container {
    margin-top: 2rem;
}

.result-item {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #5289AD;
    transform: translateY(-2px);
}

.result-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.result-meta {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.result-links {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.external-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #e8f5e9;
    color: #2e7d32;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* 浏览控件 */
.browse-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.browse-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.browse-controls select {
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 5px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination button {
    padding: 0.5rem 1rem;
    min-width: 40px;
}

.pagination button.active {
    background: #764ba2;
}

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

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: #5289AD;
    color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    background: #243C4C;
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 分类列表 */
.category-item {
    background-color: #F4FCFB;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-name {
    font-weight: bold;
    color: #243C4C;
}

.category-count {
    background-color: #5289AD;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.9rem;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 10px;
    max-width: 800px;
    position: relative;
    animation: slideDown 0.3s;
}

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

.close {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-label {
    font-weight: bold;
    color: #243C4C;
    margin-bottom: 0.5rem;
}

.external-links-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.external-link-card {
    background-color: #F4FCFB;
    border-left: 4px solid #5289AD;
    padding: 1rem;
    border-radius: 5px;
}

.external-link-card h4 {
    color: #243C4C;
    margin-bottom: 0.5rem;
}

.external-link-item {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background-color: white;
    border-radius: 3px;
}

.external-link-item a {
    color: #5289AD;
    text-decoration: none;
    font-weight: bold;
}

.external-link-item a:hover {
    text-decoration: underline;
}

/* 外部链接表格样式 */
.external-links-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border: 1px solid #ACBCBF;
}

.external-links-table thead {
    background: #ACBCBF;
    color: #243C4C;
}

.external-links-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #698696;
}

.external-links-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #ACBCBF;
}

.external-links-table tbody tr:hover {
    background: #F4FCFB;
}

.external-links-table a {
    color: #5289AD;
    text-decoration: none;
}

.external-links-table a:hover {
    text-decoration: underline;
}

/* 链接按钮样式 */
.link-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #698696;
    color: #ffffff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.link-button:hover {
    background: #5289AD;
    color: #ffffff;
    transform: translateY(-1px);
}

.link-button.primary {
    background: #5289AD;
    color: #ffffff;
}

.link-button.primary:hover {
    background: #243C4C;
    color: #ffffff;
}

/* 表格样式 */
.browse-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
}

.browse-table thead {
    background: #243C4C;
    color: white;
}

.browse-table th {
    padding: 1rem;
    text-align: left;
    font-weight: bold;
}

.browse-table td {
    padding: 1rem;
    border-bottom: 1px solid #ACBCBF;
}

.browse-table tbody tr {
    transition: all 0.2s;
    cursor: pointer;
}

.browse-table tbody tr:hover {
    background: #F4FCFB;
}

.browse-table .has-links-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #698696;
    color: white;
    border-radius: 3px;
    font-size: 0.8rem;
}

/* 页脚 */
#footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    background-color: #f5f5f5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    #pagecontent {
        padding: 1rem;
        margin: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* 移动端表格优化 - 竖向显示 */
    .browse-table {
        border: 0;
    }

    .browse-table thead {
        display: none;
    }

    .browse-table tbody tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid #ACBCBF;
        border-radius: 8px;
        background: white;
        padding: 1rem;
    }

    .browse-table tbody tr:hover {
        background: #F4FCFB;
    }

    .browse-table td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .browse-table td:last-child {
        border-bottom: none;
    }

    .browse-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #243C4C;
        display: block;
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }

    .browse-table td[data-label="操作"] {
        margin-top: 0.5rem;
    }

    .browse-table .link-button {
        display: block;
        text-align: center;
        width: 100%;
    }

    /* 移动端外部链接表格优化 */
    .external-links-table {
        border: 0;
    }

    .external-links-table thead {
        display: none;
    }

    .external-links-table tbody tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid #ACBCBF;
        border-radius: 8px;
        background: white;
        padding: 1rem;
    }

    .external-links-table tbody tr:hover {
        background: #F4FCFB;
    }

    .external-links-table td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .external-links-table td:last-child {
        border-bottom: none;
    }

    .external-links-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #243C4C;
        display: block;
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }
}
