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

body {
    padding-top: 56px;
    font-family: 'Arial', sans-serif;
    background-color: #f5f7fa;
    background-image: url('https://static.igem.wiki/teams/5710/background/2.avif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #333;
    line-height: 1.6;
}

/*************************** navigation ***************************/
nav {
    width: 100%;
    position: fixed;
    z-index: 99999;
    height: auto;
    min-height: 4rem;
    top: 0;
    left: 0;
    background-color: #79A071;
    justify-content: space-between;
    display: flex;
    backdrop-filter: blur(0.5rem);
    transition: height 0.3s ease;
    overflow: visible;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

a {
    text-decoration: none;
}

a.navbar-brand {
    height: 4rem;
    width: 10vw;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.3rem 1vw 0vw 8vw;
}

a.navbar-brand img {
    height: 90%;
    width: auto;
}

.team-name {
    font-family: "Georgia", serif;
    font-weight: 700;
    font-size: 1.8vw;
    color: #746ce8;
    margin-left: 0.5rem;
    white-space: nowrap;
}

nav>.navbar {
    margin: 0 0.8vw;
    margin-right: -28vw;
    /* 向左移动，减少右边距 */
    font-family: "Barlow Condensed";
    font-weight: 600;
    font-size: 1.4vw;
    position: relative;
    display: flex;
    align-items: center;
    list-style-type: none;
    padding-left: 0;
    transition: margin-right 0.3s ease;
}

nav .nav-item {
    position: relative;
    margin: 0;
    margin-right: 3.2vw;
    /* 增大一般菜单间距 */
    list-style-type: none;
}

/* 特定菜单项的间距调整 */
nav .nav-item:nth-child(5) {
    /* Human Practice */
    margin-right: 2.2vw;
    /* 保持与Sustainability的原间距 */
}

nav .nav-item:nth-child(6) {
    /* Sustainability */
    margin-right: 2.2vw;
    /* 保持与Education的原间距 */
}

nav .nav-item>li {
    list-style-type: none;
    height: 1.4vw;
}

nav .nav-item>a {
    font-size: 1.2vw;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    transition: color 0.15s linear;
    position: relative;
    flex-direction: column;
}

nav .nav-item>a::after {
    content: "";
    position: absolute;
    bottom: -0.3rem;
    left: 0;
    width: 0;
    height: 0.25rem;
    background-color: #00c1a4;
    transition: width 0.3s ease;
    z-index: 99998;
}

nav .nav-item:hover>a::after {
    width: 100%;
}

.nav-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 4px;
}

.nav-text {
    font-size: 16px;
}

/* 下拉菜单容器 - 修改为相对于屏幕居中 */
.son {
    margin: 0;
    padding: 1.5rem;
    list-style: none;
    position: fixed;
    /* 改为固定定位 */
    top: 5rem;
    /* 距离顶部距离 */
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    background-image: url('https://static.igem.wiki/teams/5710/background/1.avif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 100000;
    width: 75vw;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 -1px 0 rgba(0, 0, 0, 0.05) inset;
}

/* 显示状态 */
.son.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* 下拉菜单项 */
.son li {
    padding: 0;
    width: 100%;
    line-height: 1.4;
    white-space: normal;
    box-sizing: border-box;
}

/* 下拉菜单链接 */
.son li a {
    font-size: 1rem;
    color: #032d30;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 6px;
}

/* 新增样式 */
.menu-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #032d30;
    display: flex;
    align-items: center;
}

.menu-subtitle {
    font-size: 0.875rem;
    font-weight: 400;
    color: #666;
    margin-left: 0rem;
    line-height: 1.4;
}

/* 悬停效果 */
.son li a:hover {
    background-color: #f0f9ff;
    color: #00c1a4;
    padding-left: 1.2rem;
    transform: translateX(4px);
}

.son li a:hover .menu-title {
    color: #00c1a4;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .son {
        width: 85vw;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .son {
        width: 95vw;
    }

    /* 调整导航栏间距以适应搜索框 */
    nav>.navbar {
        margin-right: -31vw;
        /* 调整平板端的右边距 */
    }
}

/* 修改图标样式 */
.submenu-icon {
    display: inline-block;
    width: 60px;
    height: 60px;
    margin-right: 0px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

/* 如果图标文件不存在，使用字体图标作为备用 */
.submenu-icon::before {
    font-family: 'Arial', sans-serif;
    font-weight: bold;
    font-size: 14px;
    color: #00c1a4;
    display: none;
}

/* 当背景图片加载失败时显示字体图标 */
.submenu-icon[data-icon-failed="true"]::before {
    display: inline-block;
}

/* 为每个子菜单项定义不同的图标和备用字体图标 */
.members-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/27.avif');
}

.members-icon::before {
    content: "👥";
}

.attributions-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/28.avif');
}

.attributions-icon::before {
    content: "📝";
}

.description-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/30.avif');
}

.description-icon::before {
    content: "📄";
}

.workflow-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/29.avif');
}

.workflow-icon::before {
    content: "⚙️";
}

.contribution-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/31.avif');
}

.contribution-icon::before {
    content: "📊";
}

.drylab-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/32.avif');
}

.drylab-icon::before {
    content: "🤝";
}

.wetlab-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/33.avif');
}

.wetlab-icon::before {
    content: "🧪";
}

.safety-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/34.avif');
}

.safety-icon::before {
    content: "⚠️";
}

.software-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/21.avif');
}

.software-icon::before {
    content: "💻";
}

.practice-journal-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/22.avif');
}

.practice-journal-icon::before {
    content: "💼";
}

.collaboration-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/23.avif');
}

.collaboration-icon::before {
    content: "👥";
}

.sustainable-framework-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/24.avif');
}

.sustainable-framework-icon::before {
    content: "🎓";
}

.realworld-impact-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/25.avif');
}

.realworld-impact-icon::before {
    content: "♻️";
}

.educational-ecosystem-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/26.avif');
}

.educational-ecosystem-icon::before {
    content: "♻️";
}

.life-visualized-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/27.avif');
}

.life-visualized-icon::before {
    content: "♻️";
}

.software-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/28.avif');
}

.software-icon::before {
    content: "♻️";
}

.protocols-icon {
    background-image: url('https://static.igem.wiki/teams/5710/menu/29.avif');
}

.protocols-icon::before {
    content: "♻️";
}

/*************************** search box ***************************/
.search-container {
    margin-right: 2vw;
    display: flex;
    align-items: center;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    padding: 0.3rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-box:hover {
    box-shadow: 0 4px 15px rgba(0, 193, 164, 0.2);
}

#search-input {
    width: 0;
    padding: 0.5rem 0;
    border: none;
    background: transparent;
    color: #032d30;
    font-size: 1rem;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    outline: none;
}

.search-box.active #search-input {
    width: 200px;
    padding: 0.5rem 0.3rem;
    opacity: 1;
    visibility: visible;
    border-bottom-color: #00c1a4;
}

#search-input:focus {
    outline: none;
}

#search-input::placeholder {
    color: #8c8c8c;
    font-weight: 300;
}

#search-button {
    background: #8BBEB3;
    border: none;
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-width: 40px;
    min-height: 40px;
}

#search-button:hover {
    background: #00957e;
    transform: rotate(10deg);
}

.search-icon {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

.search-box.active .search-icon {
    transform: scale(1.1);
}

.navbar.search-active {
    margin-right: -20vw;
    transition: margin-right 0.3s ease;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    right: 0;
    width: 250px;
    background-color: #fcfffe;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    z-index: 100001;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-top: 5px;
}

.search-suggestions.show {
    display: block;
}

.search-suggestions .suggestion-item {
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #032d30;
    font-size: 1rem;
    border-bottom: 1px solid #f1f1f1;
}

.search-suggestions .suggestion-item:hover,
.search-suggestions .suggestion-item.highlighted {
    background-color: #f0f9ff;
    color: #00c1a4;
}

.search-suggestions .no-results {
    padding: 0.8rem 1rem;
    color: #6c757d;
    font-style: italic;
}

/* 移动设备适配 */
@media (max-width: 768px) {
    .search-container {
        margin-right: 1rem;
    }

    .search-box.active #search-input {
        width: 150px;
        font-size: 16px;
    }

    .search-suggestions {
        width: 200px;
        right: -50px;
    }
}

/* CALLOUT */
.bd-callout {
    padding: 1.25rem;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid #e9ecef;
    border-left-width: .25rem;
    border-radius: .25rem;
}

.bd-callout h4 {
    margin-bottom: 1.25rem;
}

.bd-callout p:last-child {
    margin-bottom: 0;
}

.bd-callout code {
    border-radius: .25rem;
}

.bd-callout+.bd-callout {
    margin-top: -.25rem;
}

.bd-callout-info {
    border-left-color: #5bc0de;
}

.bd-callout-warning {
    border-left-color: #f0ad4e;
}

.bd-callout-danger {
    border-left-color: #d9534f;
}

/* footer */
footer a {
    color: white;
    font-weight: bold;
    text-decoration: none;
}

footer a:hover {
    color: white;
    text-decoration: underline;
}

/*************************** notebook ***************************/
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    margin-top: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid #83c4f6;
}

.page-name {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
}

.page-body {
    display: flex;
    gap: 30px;
}

.left-nav {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    backdrop-filter: blur(20px);
    padding: 1rem 0;
    width: 200px;
    height: fit-content;
    position: sticky;
    top: 6rem;
    border: none;
    border-radius: 12px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
    z-index: 1050;
    /* 提高z-index，确保在footer上方 */
}

.left-nav-title {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
    margin: 0 1rem 1rem 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.02em;
    line-height: 1.3;
    position: relative;
}

.left-nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1rem;
    margin: 0 1rem 0.5rem 1rem;
    color: rgba(255, 255, 255);
    text-decoration: none;
    border-radius: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.95rem;
    font-weight: 450;
    letter-spacing: -0.01em;
    line-height: 1.5;
    position: relative;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.left-nav-subitem {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    margin: 0 1rem 0.3rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.4;
    position: relative;
    cursor: pointer;
    border-left: 2px solid transparent;
}

.left-nav-item:hover,
.left-nav-subitem:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #ffffff;
    border-left-color: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
    backdrop-filter: blur(10px);
}

.left-nav-item.active,
.left-nav-subitem.active {
    background: rgba(255, 255, 255, 0.03);
    color: #ffffff;
    border-left-color: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
    backdrop-filter: blur(10px);
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .left-nav {
        top: 5rem !important;
        margin-top: 3rem;
        width: 280px;
    }

    .scrolled .left-nav {
        top: 1.5rem !important;
    }
}

@media (max-width: 768px) {
    .left-nav {
        position: relative;
        top: auto !important;
        margin-top: 2rem;
        width: 100%;
        max-width: 100%;
    }
}

.right-text {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.text-content {
    margin-bottom: 40px;
}

.text-content-h1 {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
    color: #2c3e50;
}

.text-content-h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin: 25px 0 15px 0;
    color: #2c3e50;
    border-left: 4px solid #3498db;
    padding-left: 15px;
}

.text-content-p {
    margin-bottom: 15px;
    text-align: justify;
}

.text-img-container {
    margin: 25px 0;
    text-align: center;
}

.text-img,
.life-img,
.grid-img,
.protocols-img,
.ecosystem-img,
.workflow-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.text-img:hover,
.life-img:hover,
.grid-img:hover,
.protocols-img:hover,
.ecosystem-img:hover,
.workflow-img:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.figure-caption {
    font-style: italic;
    color: #7f8c8d;
    margin-top: 8px;
    font-size: 14px;
}

.references {
    margin-top: 40px;
}

.references ul {
    list-style-type: none;
}

.references li {
    margin-bottom: 15px;
    padding-left: 20px;
    text-indent: -20px;
    text-align: justify;
}

/* 滚动行为 */
html {
    scroll-behavior: smooth;
}

/* 回到顶部按钮 */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #3498db;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.scroll-top.visible {
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .page-body {
        flex-direction: column;
    }

    .left-nav {
        position: static;
        flex: 1;
        margin-bottom: 20px;
        max-height: none;
    }

    nav>.navbar {
        font-size: 1.8vw;
    }

    nav .nav-item>a {
        font-size: 1.6vw;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-mid {
        margin-top: 15px;
    }

    .right-text {
        padding: 20px;
    }

    .team-name {
        font-size: 3vw;
    }

    nav>.navbar {
        font-size: 2.2vw;
        margin-right: -36vw;
        /* 调整移动端的右边距 */
    }

    nav .nav-item>a {
        font-size: 2vw;
    }

    .son li {
        width: 20rem;
    }

    .son li a {
        font-size: 1.4vw;
    }
}

@media (max-width: 576px) {
    .page-container {
        padding: 10px;
    }

    .left-nav {
        padding: 15px;
    }

    .right-text {
        padding: 15px;
    }

    .team-name {
        font-size: 4vw;
    }

    nav>.navbar {
        font-size: 2.8vw;
        margin-right: -41vw;
        /* 调整小屏幕的右边距 */
    }

    nav .nav-item>a {
        font-size: 2.5vw;
    }

    .son li {
        width: 18rem;
        padding: 0.6rem 1rem;
    }

    .son li a {
        font-size: 1.8vw;
    }
}