.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    min-width: 0;
}

.logo {
    flex-shrink: 0;
    white-space: nowrap;
}

.nav {
    flex: 1;
    margin: 0 10px;
    min-width: 0;
    overflow: hidden;
}

.nav ul {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: hidden;
    gap: 10px;
    padding: 0;
    margin: 0;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* 隐藏Chrome/Safari/Opera的滚动条 */
.nav ul::-webkit-scrollbar {
    display: none;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* 响应式设计：在小屏幕上调整布局 */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .nav {
        order: 3;
        width: 100%;
        margin: 10px 0 0 0;
        overflow-x: auto;
    }
    
    .nav ul {
        justify-content: center;
        overflow-x: auto;
    }
    
    .search-box {
        margin-left: auto;
    }
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
}

.search-popup {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 10px;
    z-index: 1000;
    width: 280px;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.search-popup.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.search-popup form {
    display: flex;
    gap: 5px;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.search-button {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.search-button:hover {
    background-color: #45a049;
}

.search-button:active {
    background-color: #3e8e41;
    transform: translateY(1px);
}

/* 添加点击外部关闭搜索框的功能 */
.search-popup::before {
    content: '';
    position: absolute;
    top: -10px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
    z-index: -1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .search-popup {
        right: 50%;
        transform: translateX(50%) translateY(-10px);
        width: calc(100vw - 40px);
        max-width: 300px;
    }
    
    .search-popup.active {
        transform: translateX(50%) translateY(0);
    }
    
    .search-popup::before {
        right: 50%;
        transform: translateX(50%);
    }
}