/* ================
   DoMiProt 全局样式
   ================ */

/* ——— 基础重置与全局设置 ——— */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #fafafa;
    color: #2c3e50;
    line-height: 1.6;
}

/* ——— 顶部固定导航栏 ——— */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #003366;
    color: white;
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.top-bar-left,
.top-bar-right {
    flex: 0 0 auto;
    z-index: 1001;
}

/* 搜索框居中（在大屏幕上不受左右内容影响） */
.top-bar-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    max-width: 400px;
    margin: 0 auto;
}

.top-bar-center * {
    pointer-events: auto;
}

.logo {
    font-size: 1.45rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
    letter-spacing: -0.5px;
}

.version {
    font-size: 0.8rem;
    color: #ffcc00;
    margin-left: 0.8rem;
    font-weight: 500;
    vertical-align: middle;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: #e0e7ff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #ffcc00;
    font-weight: 600;
}

/* ——— 顶部搜索框（始终显示） ——— */
.top-search-container {
    display: flex;
    width: 320px;
    opacity: 0;
    animation: fadeInSearch 0.4s forwards;
}

@keyframes fadeInSearch {
    to {
        opacity: 1;
    }
}

.top-search-input {
    flex: 1;
    padding: 0.55rem 0.9rem;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 0.9rem;
    outline: none;
    background: white;
    color: #2c3e50;
}

.top-search-button {
    background: #ff5722;
    color: white;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.top-search-button:hover {
    background: #e64a19;
}


/* ——— 通用标题与文本样式 ——— */
.page-title {
    font-size: 2.2rem;
    color: #003366;
    margin-bottom: 1.5rem;
    font-weight: 700;
    text-align: center;
}

.page-subtitle,
.intro-text {
    color: #4a5568;
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1.8rem;
    text-align: center;
}

.section-title {
    font-size: 1.5rem;
    color: #003366;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* ——— 内容区块（用于 PROTEIN SOURCE / FAQ 等） ——— */
.content-block,
.faq-section {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.content-block p,
.faq-answer {
    font-size: 1rem;
    color: #4a5568;
    line-height: 1.7;
}

.content-block ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

.faq-question {
    font-size: 1.25rem;
    color: #003366;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ——— 分页控件 ——— */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 1.8rem;
    gap: 0.5rem;
}

.pagination button {
    padding: 0.45rem 0.85rem;
    border: 1px solid #cbd5e0;
    background: white;
    color: #2d3748;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #f0f5ff;
    color: #003366;
}

.pagination button.active {
    background: #003366;
    color: white;
    border-color: #003366;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 页码输入容器 */
.page-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.page-input-container span {
    font-size: 0.95rem;
    color: #4a5568;
}

.page-input {
    width: 60px;
    padding: 0.45rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 0.95rem;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.page-input:focus {
    border-color: #003366;
    box-shadow: 0 0 0 2px rgba(0, 51, 102, 0.1);
}

/* ——— 页脚 ——— */
.footer {
    background: #003366;
    color: #cbd5f0;
    padding: 2rem 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.footer-column h3 {
    color: #ffffff;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.footer-column p {
    color: #cbd5f0;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.footer-column a {
    color: #cbd5f0;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-column a:hover {
    color: #ffcc00;
    text-decoration: underline;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #cbd5f0;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #ffcc00;
    text-decoration: underline;
}

/* ——— 响应式页脚 ——— */
@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-column h3 {
        font-size: 1.1rem;
    }
}

a {
    color: #cbd5f0;
    text-decoration: none;
    transition: color 0.2s;
}

/* ——— 响应式断点 ——— */
@media (max-width: 900px) {
    .top-search-container {
        width: 260px;
    }

    .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 0.8rem 1.2rem;
        justify-content: space-between;
        gap: 0.8rem;
    }

    /* 在中等屏幕上调整为垂直布局 */
    .top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .top-bar-left,
    .top-bar-right {
        flex: 0 0 auto;
    }

    .top-bar-right {
        justify-content: center;
        display: flex;
    }

    .top-bar-left {
        display: flex;
        justify-content: center;
    }

    .top-bar-center {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
        order: 3;
    }

    .top-search-container {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }

    .nav-links {
        gap: 1rem;
        justify-content: center;
    }

    .nav-links a {
        font-size: 0.9rem;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .intro-text,
    .page-subtitle {
        font-size: 1rem;
    }

    .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .browse-table th,
    .browse-table td {
        padding: 0.8rem 0.6rem;
        font-size: 0.9rem;
    }

    /* 调整Hero区域 */
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .main-search-box {
        flex-direction: column;
        max-width: 90%;
    }

    .main-search-input,
    .main-search-button {
        width: 100%;
        border-radius: 4px;
        margin-bottom: 0.5rem;
    }

    .main-search-button {
        margin-bottom: 0;
    }
}

@media (max-width: 560px) {
    .top-bar {
        padding: 0.6rem 1rem;
    }

    /* 不隐藏导航链接，无论屏幕多小 */
    .top-bar-right {
        display: flex;
        justify-content: center;
    }

    .nav-links {
        gap: 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }

    .container {
        padding-top: 180px;
        max-width: 100%;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .browse-table {
        overflow-x: auto;
        display: block;
    }

    .browse-table th,
    .browse-table td {
        padding: 0.7rem 0.4rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* 调整首页统计卡片 */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .stat-number {
        font-size: 1.6rem;
    }

    /* 调整表格显示 */
    .example-table {
        overflow-x: auto;
        display: block;
    }

    .example-table th,
    .example-table td {
        white-space: nowrap;
    }

    /* 确保所有内容区块在小屏幕上有适当的内边距 */
    .content-block {
        padding: 1.25rem;
        margin-left: 0;
        margin-right: 0;
    }
}

@media (max-width: 400px) {
    .top-bar {
        padding: 0.5rem 0.8rem;
    }

    .top-search-container {
        width: 100%;
    }

    .container {
        padding-top: 180px;
        max-width: 100%;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* 不隐藏导航链接，无论屏幕多小 */
    .top-bar-right {
        display: flex;
        justify-content: center;
    }

    .nav-links {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links a {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
        white-space: nowrap;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* 确保所有内容区块在极小屏幕上有适当的内边距 */
    .content-block {
        padding: 1rem;
        margin-left: 0;
        margin-right: 0;
    }

    /* 调整标题大小 */
    .page-title {
        font-size: 1.6rem;
    }

    .section-title {
        font-size: 1.3rem;
    }
}